Ask a Question
Back to All

Is there a timing problem with registering a webhook on addon registration?

I seem to have a problem where if I register a webhook during the initial Addon Install/Registration, that whil the webhook subscribe request comes back as success=true, but the callback_url is stored wrong within ServiceM8 as a constant. (ADDON_CALLBACK_URL) You can see that by doing a get to the webhook_subscriptions URL...

This is the JSON response to a get request to https://api.servicem8.com/webhook_subscriptions after successfully registering the webhook during the addon install... (i.e. I'm doing this in my callback code after authorisation)

"object": "job",
"callback_url": "ADDON_CALLBACK_URL",
"fields": [
"unique_id": "",
"active": true

If I wait a minute and then try, the registration also returns success as well, but does store the correct callback_url.

Has this been a problem for anyone else? I need to do this on registration as it's the only time I have the vendor ID. (Calls to the vendor.json REST work fine, so data is already populated.)

I'd hate to have to put in some kind of delay/variable that's variable in duration depending on circumstances.