Webhook, finding scheduleID

Posts about the simPRO API. Help/support/how-to etc.
Forum rules
  • Check the documentation first. Before posting questions, please check the documentation to ensure it doesn't already cover what you need.
  • No spam. All automated messages, advertisements, and links to competitor websites will be deleted immediately.
  • Post in relevant sub-forums only. Messages posted in the wrong topic area will be removed and placed in the correct sub-forum by moderators.
  • Respect other users. No flaming or abusing fellow forum members. Users who continue to post inflammatory, abusive comments will be deleted from the forum after two warnings are issued by moderators.
  • Harassment. No threats or harassment of other users will be tolerated. Any instance of threatening or harassing behavior is grounds for deletion from the forums.
  • Adult content. No profanity or pornography is allowed. Posts containing adult material will be deleted.
  • Bandwidth. All images and signatures must be 500 x 500 pixels or smaller. Posts containing over-sized images and signatures will be removed.
  • Illegal content. No re-posting of copyrighted materials or other illegal content is allowed. Any posts containing illegal content or copyrighted materials will be deleted.
Post Reply
GenLocalz
Posts: 4
Joined: Tue Jan 10, 2023 11:24 pm

Webhook, finding scheduleID

Post by GenLocalz » Thu Feb 09, 2023 11:59 pm

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
Sindre
Posts: 493
Joined: Wed Apr 20, 2022 4:51 am
Location: Brisbane

Re: Webhook, finding scheduleID

Post by Sindre » Mon Feb 13, 2023 3:07 am

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
Sindre
API Developer | Simpro Software Group
GenLocalz
Posts: 4
Joined: Tue Jan 10, 2023 11:24 pm

Re: Webhook, finding scheduleID

Post by GenLocalz » Tue Feb 14, 2023 3:31 am

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
Sindre
Posts: 493
Joined: Wed Apr 20, 2022 4:51 am
Location: Brisbane

Re: Webhook, finding scheduleID

Post by Sindre » Wed Feb 15, 2023 1:23 am

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
Sindre
API Developer | Simpro Software Group
Post Reply