Formatting a request
Just like the POST Create Webhook endpoint, this API requires that the request parameters be included in a JSON object called webhook
. For example:
{
"webhook": {
"active": true,
"name": "Sample webhook",
"settings": {
"customer_state_changed": "true"
}
}
}
Unlike creating a webhook, the following parameters are optional. Any parameter included in a PUT Update request will be updated while parameters omitted from the request are not modified. For example, you may want to use a PUT Update to deactivate an active webhook. In this example, the request body can include {"webhook": {"active": false}}
and omit any other parameters.
- active
- url
- http_method
- name
- settings
The settings
parameter
settings
parameterThe settings
parameter, within the webhook
object, in the request body specifies the event(s) that should trigger a webhook. Refer to Custom Webhooks for examples of the webhook payload for each event type.
The settings
parameter is a JSON object containing key:value pairs. To subscribe to an event, include the event name as the key and include "true" (as a string) as the value. For example:
"settings": {
"new_assigned_message": "true",
"new_unassigned_message": "true"
}
If the settings
object is included in a PUT Update request, the entire settings object is overwritten. This means that if you want to add new events to an existing webhook, you must include all desired events in the PUT Update request, including any events that were already enabled for the webhook.
For example, consider an existing webhook which is subscribed to the "new_assigned_message" and "new_unassigned_message" events. You want to add "outbound_message" to this webhook. You must include all three events in the settings
object of a PUT Update request. Like this:
"settings": {
"new_assigned_message": "true",
"new_unassigned_message": "true",
"outbound_message": true
}
The following table lists the events available. To see examples of the payload delivered by a webhook see the Webhook Payloads section on the Custom Webhooks page.
Events | Accepted Values | Description |
---|---|---|
"new_assigned_message" | "true", "false" | Triggers webhook when a message comes from an assigned customer |
"new_unassigned_message" | "true", "false" | Triggers webhook when a message comes from an unassigned customer |
"outbound_message" | "true", "false" | Triggers webhook when a user sends a message to a customer |
"customer_subscribed" | "true", "false" | Triggers webhook when a customer gets subscribed |
"customer_unsubscribed" | "true", "false" | Triggers webhook when a customer gets unsubscribed |
"user_assignment" | "true", "false" | Triggers webhook when a customer is assigned to a user |
"customer_created" | "true", "false" | Triggers webhook when a new customer record is created |
"tag_added_to_message" | "true", "false" | Triggers webhook when a user adds a tag to a message |
"tag_removed_from_message" | "true", "false" | Triggers webhook when a user removes a tag from a message |
"customer_double_opted_in" | "true", "false" | Triggers webhook when a customer sends a message that matches the opt-in keyword configured in the your account's Double Opt-In settings. |
"customer_state_changed" | "true", "false" | Triggers webhook on several events which change the state of the customer record: close, unassign, assign, create, unsubscribe, subscribe, and snooze. |