Service-Scoped Conversation-Scoped Webhooks provide a way to attach a unique monitor, bot, or other integration to each service-scoped Conversation within a non-default Conversation Service.
Each individual service-scoped Conversation can have as many as five such webhooks, as needed for your use case.
Please see the API Reference for the Conversation-Scoped Webhook resource for creating and managing Conversation-Scoped Webhooks within the default Conversation Service.
All URLs in the reference documentation use the following base URL:
1https://conversations.twilio.com/v12
For Conversations applications that build on more than one Conversation Service instance, you will need to specify the Conversation Service SID in the REST API call:
1GET /v1/Services/ISxx/Conversations/CHxx/Messages2
A 34 character string that uniquely identifies this resource.
^WH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique ID of the Account responsible for this conversation.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Conversation Service the Participant resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique ID of the Conversation for this webhook.
^CH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The date that this resource was last updated.
POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks
The SID of the Conversation Service the Participant resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique ID of the Conversation for this webhook.
application/x-www-form-urlencoded
The target of this webhook: webhook
, studio
, trigger
webhook
trigger
studio
The HTTP method to be used when sending a webhook request.
GET
POST
The list of events, firing webhook event for this Conversation.
The list of keywords, firing webhook event for this Conversation.
The studio flow SID, where the webhook should be sent to.
^FW[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The message index for which and it's successors the webhook will be replayed. Not set by default
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createServiceConversationScopedWebhook() {11const webhook = await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.conversations("ConversationSid")14.webhooks.create({ target: "webhook" });1516console.log(webhook.sid);17}1819createServiceConversationScopedWebhook();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"conversation_sid": "ConversationSid",5"sid": "WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"target": "webhook",7"configuration": {8"url": "https://example.com",9"method": "get",10"filters": [11"onMessageSent",12"onConversationDestroyed"13]14},15"date_created": "2016-03-24T21:05:50Z",16"date_updated": "2016-03-24T21:05:50Z",17"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"18}
GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks/{Sid}
The SID of the Conversation Service the Participant resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A 34 character string that uniquely identifies this resource.
^WH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchServiceConversationScopedWebhook() {11const webhook = await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.conversations("ConversationSid")14.webhooks("WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")15.fetch();1617console.log(webhook.sid);18}1920fetchServiceConversationScopedWebhook();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"conversation_sid": "ConversationSid",5"sid": "WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"target": "studio",7"configuration": {8"flow_sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"9},10"date_created": "2016-03-24T21:05:50Z",11"date_updated": "2016-03-24T21:05:50Z",12"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"13}
GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks
The SID of the Conversation Service the Participant resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique ID of the Conversation for this webhook.
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listServiceConversationScopedWebhook() {11const webhooks = await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.conversations("ConversationSid")14.webhooks.list({ limit: 20 });1516webhooks.forEach((w) => console.log(w.sid));17}1819listServiceConversationScopedWebhook();
1{2"meta": {3"page": 0,4"page_size": 5,5"first_page_url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks?PageSize=5&Page=0",6"previous_page_url": null,7"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks?PageSize=5&Page=0",8"next_page_url": null,9"key": "webhooks"10},11"webhooks": [12{13"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"sid": "WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"target": "webhook",18"configuration": {19"url": "https://example.com",20"method": "get",21"filters": [22"onMessageSent",23"onConversationDestroyed"24]25},26"date_created": "2016-03-24T21:05:50Z",27"date_updated": "2016-03-24T21:05:50Z",28"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"29},30{31"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",32"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",33"conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",34"sid": "WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",35"target": "trigger",36"configuration": {37"url": "https://example.com",38"method": "post",39"filters": [40"keyword1",41"keyword2"42]43},44"date_created": "2016-03-24T21:05:50Z",45"date_updated": "2016-03-24T21:05:50Z",46"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"47},48{49"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",50"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",51"conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",52"sid": "WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",53"target": "studio",54"configuration": {55"flow_sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"56},57"date_created": "2016-03-24T21:05:50Z",58"date_updated": "2016-03-24T21:05:50Z",59"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"60}61]62}
POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks/{Sid}
The SID of the Conversation Service the Participant resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A 34 character string that uniquely identifies this resource.
^WH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
application/x-www-form-urlencoded
The HTTP method to be used when sending a webhook request.
GET
POST
The list of events, firing webhook event for this Conversation.
The list of keywords, firing webhook event for this Conversation.
The studio flow SID, where the webhook should be sent to.
^FW[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateServiceConversationScopedWebhook() {11const webhook = await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.conversations("ConversationSid")14.webhooks("WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")15.update({ "configuration.url": "Configuration.Url" });1617console.log(webhook.sid);18}1920updateServiceConversationScopedWebhook();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"conversation_sid": "ConversationSid",5"sid": "WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"target": "trigger",7"configuration": {8"url": "https://example.com",9"method": "post",10"filters": [11"keyword1",12"keyword2"13]14},15"date_created": "2016-03-24T21:05:50Z",16"date_updated": "2016-03-24T21:05:51Z",17"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"18}
DELETE https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks/{Sid}
The SID of the Conversation Service the Participant resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A 34 character string that uniquely identifies this resource.
^WH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deleteServiceConversationScopedWebhook() {11await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.conversations("ConversationSid")14.webhooks("WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")15.remove();16}1718deleteServiceConversationScopedWebhook();