This guide describes how to use monitoring to listen for changes associated with subscribed businesses on Middesk’s Identity Platform.
Before you begin:
Here’s the typical lifecycle of a business with monitoring enabled:
You can enable monitoring on Middesk businesses using four different strategies.
Use the POST /monitor API to create, update, and delete business monitors for fine-grained control within your application.
Depending on the type of monitor that you want to listen for, register a new webhook with the corresponding event types selected.
Webhook requests contain a few top level fields:
data. Contains the event-specific payload and all the information about a monitoring event.
id. The Middesk-generated identifier for the webhook. It’s useful for debugging. Use it to search for pertinent webhook logs on the Middesk webhooks page.
type. The type of webhook provided.
account_id. The Middesk-generated identifier for the account the webhook is sent for. Useful if you route traffic across multiple Middesk accounts.
While it’s possible to consume monitoring-specific payloads (example payloads), for typical use cases, it’s usually sufficient to retrieve the business associated with the event.
To retrieve the business associated with the event:
Access the business’s ID using the data.object.business_id field included in the webhook payload.
Retrieve the Middesk business using the GET /businesses endpoint.
The response includes the full business record.