Channel Webhook Resource
Programmable Chat has been deprecated and is no longer supported. Instead, we'll be focusing on the next generation of chat: Twilio Conversations. Find out more about the EOL process here.
If you're starting a new project, please visit the Conversations Docs to begin. If you've already built on Programmable Chat, please visit our Migration Guide to learn about how to switch.
A Channel Webhook resource describes a webhook target that is specific to a Channel. By default, events in a Programmable Chat instance are delivered to a webhook address that is specified for the whole Chat Service. However, you can use this resource to specify up to five unique webhook targets for each channel to handle exceptional cases.
The webhook target can be a Web URL or a Studio Flow.
ChannelWebhook properties
Resource Properties in REST API format | |
---|---|
sid
|
The unique string that we created to identify the Channel Webhook resource. |
account_sid
|
The SID of the Account that created the Channel Webhook resource. |
service_sid
|
The SID of the Service the Channel Webhook resource is associated with. |
channel_sid
|
The SID of the Channel the Channel Webhook resource belongs to. |
type
|
The type of webhook. Can be: |
url
|
The absolute URL of the Channel Webhook resource. |
configuration
|
The JSON string that describes how the channel webhook is configured. The configuration object contains the |
date_created
|
The date and time in GMT when the resource was created specified in ISO 8601 format. |
date_updated
|
The date and time in GMT when the resource was last updated specified in ISO 8601 format. |
Create a ChannelWebhook resource
https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks
The {ChannelSid}
value can be the Channel's sid
or its unique_name
.
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service with the Channel to create the Webhook resource under. |
channel_sid
Path
|
The SID of the Channel the new Channel Webhook resource belongs to. This value can be the Channel resource's |
type
Required
|
The type of webhook. Can be: |
configuration.url
Optional
|
The URL of the webhook to call using the |
configuration.method
Optional
|
The HTTP method used to call |
configuration.filters
Optional
|
The events that cause us to call the Channel Webhook. Used when |
configuration.triggers
Optional
|
A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when |
configuration.flow_sid
Optional
|
The SID of the Studio Flow to call when an event in |
configuration.retry_count
Optional
|
The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0. |
Example 1
Fetch a ChannelWebhook resource
https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}
The {ChannelSid}
value can be the Channel's sid
or its unique_name
.
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service with the Channel to fetch the Webhook resource from. |
channel_sid
Path
|
The SID of the Channel the Channel Webhook resource to fetch belongs to. This value can be the Channel resource's |
sid
Path
|
The SID of the Channel Webhook resource to fetch. |
Example 1
Read multiple ChannelWebhook resources
https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks
The {ChannelSid}
value can be the Channel's sid
or its unique_name
.
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service with the Channel to read the resources from. |
channel_sid
Path
|
The SID of the Channel the Channel Webhook resources to read belong to. This value can be the Channel resource's |
Example 1
Update a ChannelWebhook resource
https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}
The {ChannelSid}
value can be the Channel's sid
or its unique_name
.
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service with the Channel that has the Webhook resource to update. |
channel_sid
Path
|
The SID of the Channel the Channel Webhook resource to update belongs to. This value can be the Channel resource's |
sid
Path
|
The SID of the Channel Webhook resource to update. |
configuration.url
Optional
|
The URL of the webhook to call using the |
configuration.method
Optional
|
The HTTP method used to call |
configuration.filters
Optional
|
The events that cause us to call the Channel Webhook. Used when |
configuration.triggers
Optional
|
A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when |
configuration.flow_sid
Optional
|
The SID of the Studio Flow to call when an event in |
configuration.retry_count
Optional
|
The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0. |
Example 1
Delete a ChannelWebhook resource
https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}
The {ChannelSid}
value can be the Channel's sid
or its unique_name
.
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service with the Channel to delete the Webhook resource from. |
channel_sid
Path
|
The SID of the Channel the Channel Webhook resource to delete belongs to. This value can be the Channel resource's |
sid
Path
|
The SID of the Channel Webhook resource to delete. |
Example 1
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.