The Webhook Configuration resource allows you to precisely control the effects of account-scoped webhooks. Sending a POST
request to the Webhook Configuration endpoint is equivalent to configuring session webhooks in the Twilio Console.
Good applications of the configured webhooks in Conversations include:
Note: You can send pre-hooks and post-hooks to different targets.
Our guide to Conversations Webhooks includes the specific pre- and post-event webhooks that fire, as well as the webhook payloads.
The unique ID of the Account responsible for this conversation.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The HTTP method to be used when sending a webhook request.
GET
POST
The list of webhook event triggers that are enabled for this Service: onMessageAdded
, onMessageUpdated
, onMessageRemoved
, onConversationUpdated
, onConversationRemoved
, onParticipantAdded
, onParticipantUpdated
, onParticipantRemoved
The absolute url the pre-event webhook request should be sent to.
The absolute url the post-event webhook request should be sent to.
The routing target of the webhook. Can be ordinary or route internally to Flex
webhook
flex
An absolute API resource API resource URL for this webhook.
GET https://conversations.twilio.com/v1/Configuration/Webhooks
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 fetchConfigurationWebhook() {11const webhook = await client.conversations.v1.configuration12.webhooks()13.fetch();1415console.log(webhook.accountSid);16}1718fetchConfigurationWebhook();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"pre_webhook_url": "https://example.com/pre",4"post_webhook_url": "https://example.com/post",5"method": "GET",6"filters": [7"onMessageSend",8"onConversationUpdated"9],10"target": "webhook",11"url": "https://conversations.twilio.com/v1/Configuration/Webhooks"12}
POST https://conversations.twilio.com/v1/Configuration/Webhooks
application/x-www-form-urlencoded
The list of webhook event triggers that are enabled for this Service: onMessageAdded
, onMessageUpdated
, onMessageRemoved
, onConversationUpdated
, onConversationRemoved
, onParticipantAdded
, onParticipantUpdated
, onParticipantRemoved
The absolute url the post-event webhook request should be sent to.
The routing target of the webhook.
webhook
flex
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 updateConfigurationWebhook() {11const webhook = await client.conversations.v1.configuration12.webhooks()13.update({14filters: ["onConversationUpdated", "onMessageRemoved"],15method: "POST",16postWebhookUrl: "https://company.com/archive-every-action",17preWebhookUrl: "https://company.com/filtering-and-permissions",18});1920console.log(webhook.accountSid);21}2223updateConfigurationWebhook();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"pre_webhook_url": "https://company.com/filtering-and-permissions",4"post_webhook_url": "https://company.com/archive-every-action",5"method": "POST",6"filters": [7"onConversationUpdated"8],9"target": "webhook",10"url": "https://conversations.twilio.com/v1/Configuration/Webhooks"11}