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

Originally posted by Craig

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”: [
“status”
],
“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.

This still seems to be a problem in 2026.

Hi Craig,

If this is an Add-on SDK workflow, the most reliable pattern is to declare your subscriptions in the add-on Manifest via the webhooks section (rather than creating them via the Webhooks API during activation). The Add-on SDK “Webhook Add-on” sample uses this same approach.

When webhooks are registered in the Manifest, ServiceM8 invokes your add-on and the eventName will be webhook_subscription. That webhook invocation also includes auth.accountUUID (which matches the Vendors endpoint UUID), so you can identify the account without having to only “capture” the vendor ID at install time.

If you do need to manage subscriptions yourself via the Webhooks API, the documented endpoint is https://api.servicem8.com/webhook_subscriptions, and callback_url is a required field when creating/updating an object subscription. In the API reference examples, GET /webhook_subscriptions returns callback_url as a real URL (not a constant), so seeing ADDON_CALLBACK_URL stored there doesn’t line up with the expected response format.

Email support@servicem8.com with your app details plus an example GET /webhook_subscriptions response showing ADDON_CALLBACK_URL, and we’ll get this investigated.

Thanks,
Cody