Page 1 of 1

Webhook, finding scheduleID

Posted: Thu Feb 09, 2023 11:59 pm
by GenLocalz
Hi simPRO Group,

we have web hook configured in simPRO to call our API endpoint.
Consider the situation where there is a Job 300555 and there is an Employee scheduled for the job (hence there is a schedule created).
When Employee press Travelling in simPRO mobile application, the only webhook we are receiving is the following:

Code: Select all

{
    "build": ".......",
    "date_triggered": "2023-01-31T09:05:27+00:00",
    "name": "Job",
    "ID": "job.status",
    "reference": {
      "companyID": 0,
      "jobID": 300555,
      "statusID": 10
    },
    "action": "status",
    "description": "Status of Job #300555 set to \"Job : In Progress\""
  },
  "request_body": "{\"ID\":\"job.status\",\"build\":\".......................\",\"description\":\"Status of Job #300555 set to \\\"Job : In Progress\\\"\",\"name\":\"Job\",\"action\":\"status\",\"reference\":{\"companyID\":0,\"jobID\":300555,\"statusID\":10},\"date_triggered\":\"2023-01-31T09:05:27+00:00\"}",
  "request_method": "POST",
  "request_headers": {
       .........................
  },
  "request_uri_args": {},
  "request_uri": "........."
}

From this webhook, we see the jobID 300555, but does not have scheduleID.
What is the best and the most performance efficient way to find out which scheduleID was used to trigger this change?


Thank you

Re: Webhook, finding scheduleID

Posted: Mon Feb 13, 2023 3:07 am
by Sindre
GenLocalz,
I have looked into the webhooks for work orders and schedules.

This is a separate option in the webhook setup. Are you subscribing to all the Schedules webhooks? In simPRO these trigger a separate update which contains the ScheduleID. If the webhooks are turned on and you don't receive updates when changes are done in Mobile app let us know so we can investigate.

Regards

Re: Webhook, finding scheduleID

Posted: Tue Feb 14, 2023 3:31 am
by GenLocalz
Hi Sindre,

thank you for your reply. Yes we are subscribing for Schedules webhooks - for Create, Update and Delete.
When I create a Schedule, we do get event with ScheduleID, which is perfect:

Code: Select all

{
  "request_headers": {
  },
  "request_uri_args": {},
  "request_uri": "...",
  "request_body_args": {
    "build": "", 
    "date_triggered": "2023-02-14T03:19:51+00:00",
    "name": "Job schedule",
    "ID": "job.schedule.created",
    "reference": {
      "companyID": 0,
      "scheduleID": 5,
      "jobID": 9,
      "sectionID": 1,
      "costCenterID": 2
    },
    "action": "created",
    "description": "Job schedule #5 has been created."
  },
  "request_body": "...", 
  "request_method": "POST"
}
However, when Employee press "START TRAVEL" in simPRO mobile application, we are not getting any events with ScheduleID, we are only getting one event (for job):

Code: Select all

{
  "request_uri_args": {},
  "request_uri": "...", 
  "request_body_args": {
    "ID": "job.status",
    "action": "status",
    "date_triggered": "2023-02-14T03:21:17+00:00",
    "reference": {
      "companyID": 0,
      "jobID": 9,
      "statusID": 10
    },
    "description": "Status of Job #9 set to \"Job : In Progress\"",
    "build": "",
    "name": "Job"
  },
  "request_body": "",
  "request_method": "POST",
  "request_headers": { 
  }
}
Mobile Triggers are setup in this way :
Name Job Stage Job Status Codes
Travelling Progress Job - traveling
Onsite Progress Job : made safe

Ideally, yes we would only want to get events for Schedules, but as you see for Mobile Travelling status, we get no events with ScheduleID, hence we need to subscribe to job updates (which have no ScheduleID).


Thank you

Re: Webhook, finding scheduleID

Posted: Wed Feb 15, 2023 1:23 am
by Sindre
Hi,
Thanks for checking you settings.

I've had a closer look at the workflow and starting travel in the simPRO mobile app does not make any updates or changes to the schedule. So there are no webhooks triggered for schedules. It updates on the job and you will get the webhook that you refer to with job status set to in progress.

There will add entries made to the mobile logs and job timeline. These probably won't help you get the schedule ID you are looking for unfortunately.

You can add a feature request here on the forum with a suggestion on updates in the workflow and how the webhooks are triggered and it will be evaluated for future development.

Regards