Webhooks are a system that allows you to be proactively notified when users take a particular action in the CRM. You can create and manage them using the API functions listed here. This page explains a bit about how they work, as well as a full code example of registering, triggering, and parsing the body of a webhook.
Add a new webhook using the Api call CreateWebhook. Note webhooks cannot be updated once created; you must delete the old one and create another. Here are the parameters the function takes:
EndpointUrl
X-Hook-Secret
.WebhookScope
Events
Please note this system is new, and we currently only support webhooks for a limited number of CRM events. We are planning to expand this list; you can contact us if there is a particular event you would like to see added.
You will only receive webhooks for objects that you have permission to see. Payloads will always include UserId
of the user who triggered the event, as well as TriggeringEvent
, the name of the event that caused the hook to fire.
Contact.Create
{
Contacts: [
{ ContactId, ... },
...
]
}
For full contact format, see GetContacts.
Event.Create, Event.Update
{
Event: { EventId, ... }
}
For full event format, see GetEvent.
Event.Delete
{ EventId }
GroupMembership.Create
{
Group: { GroupId, ... }
Contacts: [
{ ContactId, ... },
...
]
}
For full group format, see GetGroup. For full contact format, see GetContacts.
PipelineItemStatus.Create, PipelineItemStatus.Update
{
PipelineItems: [
{ PipelineItemId, ... },
...
]
}
For full pipeline item format, see GetPipelineItem.
Once a webhook has been created, any triggered event in the CRM will send a POST to the provided URL. It will include the header X-Hook-Signature
.
This is a SHA-256 HMAC hash of the body, using the X-Hook-Secret
from the original handshake as the key. You can use it to verify the legitimacy of the payload.
We will retry failed sends with exponential backoff. The send MUST return a good HTTP code (<300) to be considered a success. If we do not succeed after several retries, we will disable the webhook and notify you via email.
GetWebhook will return LastSendDate
, the date of the last successful send.
Here is a full example of registering, triggering, and parsing the body of a webhook.