Create channel webhook
Webhooks for specific channels
Path parameters
-
The SID of the Service with the Channel to create the Webhook resource under.
Minimum length is
34
, maximum length is34
. Format should match the following pattern:^IS[0-9a-fA-F]{32}$
. -
The SID of the Channel the new Channel Webhook resource belongs to. This value can be the Channel resource's
sid
orunique_name
.
Body
-
The type of webhook. Can be:
webhook
,studio
, ortrigger
.Values are
webhook
,trigger
, orstudio
. -
The URL of the webhook to call using the
configuration.method
. -
Values are
GET
orPOST
. -
The events that cause us to call the Channel Webhook. Used when
type
iswebhook
. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see Webhook Event Triggers. -
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
type
=trigger
. -
The SID of the Studio Flow to call when an event in
configuration.filters
occurs. Used only whentype
isstudio
.Minimum length is
34
, maximum length is34
. Format should match the following pattern:^FW[0-9a-fA-F]{32}$
. -
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.
curl \
--request POST 'https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks' \
--user "username:password" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data 'Type=webhook&Configuration.Url=dummy&Configuration.Method=GET&Configuration.Filters=onMessageSent&Configuration.Filters=onChannelDestroyed&Configuration.RetryCount=2'
{"Type"=>"webhook", "Configuration.Url"=>"dummy", "Configuration.Method"=>"GET", "Configuration.Filters"=>["onMessageSent", "onChannelDestroyed"], "Configuration.RetryCount"=>2}
{
"sid": "WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"type": "webhook",
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"date_created": "2016-03-24T21:05:50Z",
"date_updated": "2016-03-24T21:05:50Z",
"configuration": {
"url": "dummy",
"method": "GET",
"filters": [
"onMessageSent",
"onChannelDestroyed"
],
"retry_count": 2
}
}