Event webhooks in Servicem8 M8 manifest file

Originally posted by Michael Knight

Hi Cody,
Just wanting to check to see if it is possible to subscribe to the new event webhooks issuing the manifest file for simple function add on. Or is a webhook only able to be registered through a request to the webhooks endpoint

@Cody anything further to this. or are event webhooks only available to subscribe via api key only. It looks like I can also register for event webhooks using the oauth bearer token. Does this register the webhook automatically to the addon. If so how is the webhook manages, eg if the user disconnects from the addon or the oauth connection breaks does the webhhook unsubscribe? and need to be subscribed again.

Hi Michael,

In the Add-on SDK manifest, the webhooks section lets your add-on subscribe to change notifications by specifying an object and the fields you care about.
When one of those manifest webhooks fires, ServiceM8 invokes your add-on and the eventName you receive is webhook_subscription.

For the newer business event webhooks (for example job.created, job.completed, etc.), you register those via the Webhooks API using POST /webhook_subscriptions/event, and you provide an event plus a callback_url to receive the webhook.
(If you want the API-managed object/field change style instead, that’s POST /webhook_subscriptions/object with object, fields, and callback_url.)

And you’re right, this isn’t API-key only. OAuth apps can subscribe too, but Public (OAuth 2) apps need to handle the callback “challenge” verification step, while API key subscriptions don’t.

Docs here:

Thanks,
Cody

Thanks for the clarification