Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Channel Webhook Resource


(error)

Danger

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(link takes you to an external page).

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

channelwebhook-properties page anchor
Resource properties
sidtype: SID<WH>Not PII

The unique string that we created to identify the Channel Webhook resource.


account_sidtype: SID<AC>Not PII

The SID of the Account(link takes you to an external page) that created the Channel Webhook resource.


service_sidtype: SID<IS>Not PII

The SID of the Service(link takes you to an external page) the Channel Webhook resource is associated with.


channel_sidtype: SID<CH>Not PII

The SID of the Channel(link takes you to an external page) the Channel Webhook resource belongs to.


typetype: stringNot PII

The type of webhook. Can be: webhook, studio, or trigger.


urltype: string<URI>Not PII

The absolute URL of the Channel Webhook resource.


configurationtype: objectNot PII

The JSON string that describes how the channel webhook is configured. The configuration object contains the url, method, filters, and retry_count values that are configured by the create and update actions.


date_createdtype: string<DATE TIME>Not PII

The date and time in GMT when the resource was created specified in ISO 8601(link takes you to an external page) format.


date_updatedtype: string<DATE TIME>Not PII

The date and time in GMT when the resource was last updated specified in ISO 8601(link takes you to an external page) format.


Create a ChannelWebhook resource

create-a-channelwebhook-resource page anchor
POST https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks

The {ChannelSid} value can be the Channel's sid or its unique_name.

Parameters

create-parameters page anchor
URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) with the Channel to create the Webhook resource under.


ChannelSidtype: stringNot PII
Path Parameter

The SID of the Channel(link takes you to an external page) the new Channel Webhook resource belongs to. This value can be the Channel resource's sid or unique_name.


Request body parameters
Typetype: enum<STRING>Not PII
Required

The type of webhook. Can be: webhook, studio, or trigger.

Possible values:
webhooktriggerstudio

Configuration.Urltype: stringNot PII

The URL of the webhook to call using the configuration.method.


Configuration.Methodtype: enum<STRING>Not PII

The HTTP method used to call configuration.url. Can be: GET or POST and the default is POST.

Possible values:
GETPOST

Configuration.Filterstype: string[]Not PII

The events that cause us to call the Channel Webhook. Used when type is webhook. 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(link takes you to an external page).


Configuration.Triggerstype: string[]Not PII

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.


Configuration.FlowSidtype: SID<FW>Not PII

The SID of the Studio Flow(link takes you to an external page) to call when an event in configuration.filters occurs. Used only when type is studio.


Configuration.RetryCounttype: integerNot PII

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.

Create a Channel Webhook resource

create-a-channel-webhook-resource page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.webhooks
_12
.create({type: 'webhook'})
_12
.then(webhook => console.log(webhook.sid));

Output

_19
{
_19
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"sid": "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"type": "webhook",
_19
"configuration": {
_19
"url": "dummy",
_19
"method": "GET",
_19
"filters": [
_19
"onMessageSent",
_19
"onChannelDestroyed"
_19
],
_19
"retry_count": 2
_19
},
_19
"date_created": "2016-03-24T21:05:50Z",
_19
"date_updated": "2016-03-24T21:05:50Z",
_19
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks/WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_19
}


Fetch a ChannelWebhook resource

fetch-a-channelwebhook-resource page anchor
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}

The {ChannelSid} value can be the Channel's sid or its unique_name.

URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) with the Channel to fetch the Webhook resource from.


ChannelSidtype: stringNot PII
Path Parameter

The SID of the Channel(link takes you to an external page) the Channel Webhook resource to fetch belongs to. This value can be the Channel resource's sid or unique_name.


Sidtype: SID<WH>Not PII
Path Parameter

The SID of the Channel Webhook resource to fetch.

Fetch a Channel Webhook resource

fetch-a-channel-webhook-resource page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.webhooks('WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.fetch()
_12
.then(webhook => console.log(webhook.sid));

Output

_13
{
_13
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"sid": "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"type": "studio",
_13
"configuration": {
_13
"flow_sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_13
},
_13
"date_created": "2016-03-24T21:05:50Z",
_13
"date_updated": "2016-03-24T21:05:50Z",
_13
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks/WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_13
}


Read multiple ChannelWebhook resources

read-multiple-channelwebhook-resources page anchor
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks

The {ChannelSid} value can be the Channel's sid or its unique_name.

URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) with the Channel to read the resources from.


ChannelSidtype: stringNot PII
Path Parameter

The SID of the Channel(link takes you to an external page) the Channel Webhook resources to read belong to. This value can be the Channel resource's sid or unique_name.


PageSizetype: integerNot PII
Query Parameter

How many resources to return in each list page. The default is 50, and the maximum is 1000.


Pagetype: integerNot PII
Query Parameter

The page index. This value is simply for client state.


PageTokentype: stringNot PII
Query Parameter

The page token. This is provided by the API.

Read multiple Channel Webhook resources

read-multiple-channel-webhook-resources page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.webhooks
_12
.list({limit: 20})
_12
.then(webhooks => webhooks.forEach(w => console.log(w.sid)));

Output

_64
{
_64
"meta": {
_64
"page": 0,
_64
"page_size": 5,
_64
"first_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks?PageSize=5&Page=0",
_64
"previous_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks?PageSize=5&Page=0",
_64
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks?PageSize=5&Page=0",
_64
"next_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks?PageSize=5&Page=1",
_64
"key": "webhooks"
_64
},
_64
"webhooks": [
_64
{
_64
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_64
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_64
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_64
"sid": "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_64
"type": "webhook",
_64
"configuration": {
_64
"url": "dummy",
_64
"method": "GET",
_64
"filters": [
_64
"onMessageSent",
_64
"onChannelDestroyed"
_64
],
_64
"retry_count": 2
_64
},
_64
"date_created": "2016-03-24T21:05:50Z",
_64
"date_updated": "2016-03-24T21:05:50Z",
_64
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks/WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_64
},
_64
{
_64
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_64
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_64
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_64
"sid": "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_64
"type": "trigger",
_64
"configuration": {
_64
"url": "dummy",
_64
"method": "POST",
_64
"filters": [
_64
"keyword1",
_64
"keyword2"
_64
],
_64
"retry_count": 3
_64
},
_64
"date_created": "2016-03-24T21:05:50Z",
_64
"date_updated": "2016-03-24T21:05:50Z",
_64
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks/WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_64
},
_64
{
_64
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_64
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_64
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_64
"sid": "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_64
"type": "studio",
_64
"configuration": {
_64
"flow_sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_64
},
_64
"date_created": "2016-03-24T21:05:50Z",
_64
"date_updated": "2016-03-24T21:05:50Z",
_64
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks/WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_64
}
_64
]
_64
}


Update a ChannelWebhook resource

update-a-channelwebhook-resource page anchor
POST https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}

The {ChannelSid} value can be the Channel's sid or its unique_name.

URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) with the Channel that has the Webhook resource to update.


ChannelSidtype: stringNot PII
Path Parameter

The SID of the Channel(link takes you to an external page) the Channel Webhook resource to update belongs to. This value can be the Channel resource's sid or unique_name.


Sidtype: SID<WH>Not PII
Path Parameter

The SID of the Channel Webhook resource to update.


Request body parameters
Configuration.Urltype: stringNot PII

The URL of the webhook to call using the configuration.method.


Configuration.Methodtype: enum<STRING>Not PII

The HTTP method used to call configuration.url. Can be: GET or POST and the default is POST.

Possible values:
GETPOST

Configuration.Filterstype: string[]Not PII

The events that cause us to call the Channel Webhook. Used when type is webhook. 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(link takes you to an external page).


Configuration.Triggerstype: string[]Not PII

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.


Configuration.FlowSidtype: SID<FW>Not PII

The SID of the Studio Flow(link takes you to an external page) to call when an event in configuration.filters occurs. Used only when type = studio.


Configuration.RetryCounttype: integerNot PII

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.

Update a Channel Webhook resource

update-a-channel-webhook-resource page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.webhooks('WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.update({'configuration.url': 'configuration.url'})
_12
.then(webhook => console.log(webhook.sid));

Output

_19
{
_19
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"sid": "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"type": "trigger",
_19
"configuration": {
_19
"url": "dummy",
_19
"method": "POST",
_19
"filters": [
_19
"keyword1",
_19
"keyword2"
_19
],
_19
"retry_count": 3
_19
},
_19
"date_created": "2016-03-24T21:05:50Z",
_19
"date_updated": "2016-03-24T21:05:51Z",
_19
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks/WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_19
}


Delete a ChannelWebhook resource

delete-a-channelwebhook-resource page anchor
DELETE https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}

The {ChannelSid} value can be the Channel's sid or its unique_name.

URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) with the Channel to delete the Webhook resource from.


ChannelSidtype: stringNot PII
Path Parameter

The SID of the Channel(link takes you to an external page) the Channel Webhook resource to delete belongs to. This value can be the Channel resource's sid or unique_name.


Sidtype: SID<WH>Not PII
Path Parameter

The SID of the Channel Webhook resource to delete.

Delete a Channel Webhook resource

delete-a-channel-webhook-resource page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.webhooks('WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.remove();


Rate this page: