Conversations sends pre-action and post-action webhooks for most events that happen in your application. These webhooks allow you to monitor and intercept user actions in your own backend service, in a Function, or in a Studio flow. You can also use these webhooks to store activity logs in a system of record or in a logging server as part of your own application.
Conversations webhooks have a maximum timeout of 5 seconds.
Twilio can send your web application an HTTP request when certain events happen, such as an incoming text message to one of your Twilio phone numbers. These requests are called webhooks, or status callbacks. For more, check out our guide to Getting Started with Twilio Webhooks. Find other webhook pages, such as a security guide and an FAQ in the Webhooks section of the docs.
You can configure the global (Account-level) webhook target and service-level webhook target through the Console, or through the REST API.
Note: The Conversation-scoped webhooks may only be modified via the REST API.
In addition to configuring the URLs for pre-action and post-action webhooks, you can also choose to send only certain webhooks to your servers. This helps avoid unnecessarily burdening your web application with traffic.
These can also be configured at an account level (globally) or at the service level in the Twilio Console:
Most actions — but not all of them — have both a pre-action and a post-action webhook. The former is fired before the action has been published, and Twilio waits for a response before publishing it. The latter is fired after publication, assuming the action was not rejected by your pre-action webhook response.
The below table enumerates all Conversations webhook actions in corresponding pairs.
Pre-Action | Post-Action | Description (incl. Post-Action) |
---|---|---|
onMessageAdd | onMessageAdded | Fires when a new message is posted to a conversation. |
onMessageRemove | onMessageRemoved | Fires when a message is deleted from a conversation. |
onMessageUpdate | onMessageUpdated | Fires when a posted message's body or any attribute is changed. |
onConversationAdd | onConversationAdded | Fires when a new conversation is created. |
onConversationRemove | onConversationRemoved | Fires when a conversation is removed from the Service. |
onConversationUpdate | onConversationUpdated | Fires when any attribute of a conversation is changed. |
onParticipantAdd | onParticipantAdded | Fires when a Participant has joined a Conversation as a Member. |
onParticipantRemove | onParticipantRemoved | Fires when a User is removed from the set of Conversation Members. |
onParticipantUpdate | onParticipantUpdated | Fires when any configurable attribute of a User is changed. Will not be fired for reachability events. |
--- | onConversationStateUpdated | Fires when the state of a Conversation is updated, e.g., from "active" to "inactive" |
--- | onDeliveryUpdated | Fires when delivery receipt status is updated |
--- | onUserAdded | Fires when a new user is added |
onUserUpdate | onUserUpdated | Fires when a user is changed |
Upon configuration, only actions from SDK-driven clients (like mobile phones or browsers) or SMS-based Participants will cause webhooks without further action on your part. This includes both Service-level webhooks and Conversation-Scoped Webhooks. This is a default behavior to help avoid infinite feedback loops.
Your Post-Event Webhook target, however, may be an important tool for archiving. In this case, you may also want to enable webhook "echoes" from actions you take on the REST API. To do so, you can add a header X-Twilio-Webhook-Enabled=true
to any such request. Requests bearing this header will yield webhooks to the configured Post-Event webhook target.
In the case of Pre-Action webhooks, Twilio will wait for a response from your service before publishing a result. The arrival, HTTP status code, and content of your response determines how Conversations will proceed.
Response Status Code | Body | Result |
---|---|---|
HTTP 200 OK | {} (or no content) | Conversations will publish the change unmodified. |
HTTP 200 OK | { "body": "modified message" } (See the list of modifiable fields.) | Conversations will publish the change with modifications as given in the response. All values are optional, and missing fields will be left unmodified from the original event. See below for which fields can be modified for each data type (Conversations or Messages). If modified values fail validation, the error will be returned to the SDK (or REST client) that triggered the event. |
HTTP 40x (any error condition) | N/A | Conversations will reject the change and no publication will be made. |
HTTP 50x (any error condition) | N/A | Conversations will reject the change and no publication will be made. |
(no response or timeout) | Conversations will publish the change unmodified after a timeout of 5 seconds; your messages will be delayed accordingly. |
In response to the onConversationAdd
and onConversationUpdate
actions, your Pre-Action Webhook response may modify the following property of the conversation:
friendly_name
An example response modifying a conversation
1HTTP 200 OK2Content-Type: application/json3{4"friendly_name": "friendly name of conversation"5}
In response to onMessageAdd
and onMessageUpdate
actions, your Pre-Action Webhook response may modify the following properties of the message:
body
author
attributes
An example response modifying a message.
1HTTP 200 OK2Content-Type: application/json3{4"body": "modified message text",5"author": "modified author name",6"attributes": "{\"key\" : \"value\"}"7}
Your Conversations service can have global webhooks that apply to every conversation within the service, or you can specify webhooks per conversation.
Post-action webhooks are available for all three types of webhooks (global, service-level and conversation-scoped). Pre-action webhooks are only available for two types of webhooks (global and service-level).
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}
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: ["onMessageAdd", "onMessageUpdate", "onMessageRemove"],15method: "POST",16postWebhookUrl: "https://YOUR_APPLICATION.com/webhook",17preWebhookUrl: "https://YOUR_APPLICATION.com/webhook",18target: "webhook",19});2021console.log(webhook.accountSid);22}2324updateConfigurationWebhook();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"pre_webhook_url": "https://YOUR_APPLICATION.com/webhook",4"post_webhook_url": "https://YOUR_APPLICATION.com/webhook",5"method": "POST",6"filters": [7"onConversationUpdated"8],9"target": "webhook",10"url": "https://conversations.twilio.com/v1/Configuration/Webhooks"11}
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 listConversationScopedWebhook() {11const webhooks = await client.conversations.v112.conversations("ConversationSid")13.webhooks.list({ limit: 20 });1415webhooks.forEach((w) => console.log(w.sid));16}1718listConversationScopedWebhook();
1{2"meta": {3"page": 0,4"page_size": 5,5"first_page_url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks?PageSize=5&Page=0",6"previous_page_url": null,7"url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks?PageSize=5&Page=0",8"next_page_url": null,9"key": "webhooks"10},11"webhooks": [12{13"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"sid": "WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"target": "webhook",17"configuration": {18"url": "https://example.com",19"method": "get",20"filters": [21"onMessageSent",22"onConversationDestroyed"23]24},25"date_created": "2016-03-24T21:05:50Z",26"date_updated": "2016-03-24T21:05:50Z",27"url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"28},29{30"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",31"conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",32"sid": "WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",33"target": "trigger",34"configuration": {35"url": "https://example.com",36"method": "post",37"filters": [38"keyword1",39"keyword2"40]41},42"date_created": "2016-03-24T21:05:50Z",43"date_updated": "2016-03-24T21:05:50Z",44"url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"45},46{47"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",48"conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",49"sid": "WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",50"target": "studio",51"configuration": {52"flow_sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"53},54"date_created": "2016-03-24T21:05:50Z",55"date_updated": "2016-03-24T21:05:50Z",56"url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"57}58]59}
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 fetchConversationScopedWebhook() {11const webhook = await client.conversations.v112.conversations("ConversationSid")13.webhooks("WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.fetch();1516console.log(webhook.sid);17}1819fetchConversationScopedWebhook();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"conversation_sid": "ConversationSid",4"sid": "WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"target": "studio",6"configuration": {7"flow_sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"8},9"date_created": "2016-03-24T21:05:50Z",10"date_updated": "2016-03-24T21:05:50Z",11"url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"12}
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 createConversationScopedWebhook() {11const webhook = await client.conversations.v112.conversations("ConversationSid")13.webhooks.create({14"configuration.filters": ["onMessageAdded", "onMessageUpdated"],15"configuration.url": "https://YOUR_APPLICATION.com/webhook",16target: "webhook",17});1819console.log(webhook.sid);20}2122createConversationScopedWebhook();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"conversation_sid": "ConversationSid",4"sid": "WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"target": "webhook",6"configuration": {7"url": "https://example.com",8"method": "get",9"filters": [10"onMessageSent",11"onConversationDestroyed"12]13},14"date_created": "2016-03-24T21:05:50Z",15"date_updated": "2016-03-24T21:05:50Z",16"url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/WHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"17}
When Twilio makes an HTTP request to your server, it includes information about the action that triggered the webhook call to your web application. Each action has its own event type.
In addition to the event-specific parameters, each request also contains the following parameters and information:
parameter name | type | description |
---|---|---|
AccountSid | string, SID | The Twilio Account SID that the Conversation belongs to |
EventType | string | The type of action that triggered this webhook event (see details for each event type below) |
Source | string | The source of the action that created this event - possible values are SDK or API |
ClientIdentity | string | The identity of the user that performed the action (SDK-originating events only) |
Note: Each HTTP request is issued with the Content-Type
header application/x-www-urlencoded
.
You may modify the FriendlyName
of this conversation by replying to this webhook with a JSON object that contains the new friendly name.
parameter name | type | description |
---|---|---|
EventType | string | Always onConversationAdd |
FriendlyName | string, optional | The friendly name of the conversation, if set |
UniqueName | string | The unique name of the conversation |
Attributes | string | Conversation metadata as set by the customer, represented as stringified JSON |
ChatServiceSid | string, SID | Conversation Service SID |
MessagingServiceSid | string, SID | Messaging Service instance SID |
MessagingBinding.ProxyAddress | string, optional (see note) | Twilio Brand phone number used by channel creator |
MessagingBinding.Address | string, optional (see note) | Originating phone number of the channel creator |
MessagingBinding.ProjectedAddress | string, optional* | The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity |
MessagingBinding.AuthorAddress | string, optional* | Number of the message author when auto-creating Group MMS |
MessageBody | string, optional | Initial conversation message string |
Media | string, JSON, optional | Stringified JSON array of attached media objects |
State | string | Enumerated type representing state of the conversation |
ChannelMetadata | string | Stringified and escaped JSON pass-through metadata from OTT channels. Only available for GBM. See sample payload. |
Note: MessagingBinding.ProxyAddress
and MessagingBinding.Address
attributes are null
if the Conversation is created from the REST API and there are no participants yet.
Note: When auto-creating Group MMS Conversation, MessagingBinding.Address
is shown as a list of Addresses.
parameter name | type | description |
---|---|---|
EventType | string | Always onConversationRemove |
ConversationSid | string, SID | Conversation String Identifier |
DateCreated | string, ISO8601 time | The date of creation of the conversation |
DateUpdated | string, ISO8601 time | The last modification date of the conversation |
FriendlyName | string, optional | The friendly name of the conversation, if set |
UniqueName | string | The unique name of the conversation |
Attributes | string | Conversation metadata as set by the customer, represented as stringified JSON |
ChatServiceSid | string, SID | Conversation Service SID |
MessagingServiceSid | string, SID | Messaging Service instance SID |
State | string | Enumerated type representing state of the conversation |
You may modify the FriendlyName
of this conversation by replying to this webhook with a JSON object that contains the new friendly name.
parameter name | type | description |
---|---|---|
EventType | string | Always onConversationUpdate |
ConversationSid | string, SID | Conversation String Identifier |
DateCreated | string, ISO8601 time | The date of creation of the conversation |
DateUpdated | string, ISO8601 time | The last modification date of the conversation |
FriendlyName | string, optional | The friendly name of the conversation, if set |
UniqueName | string | The unique name of the conversation |
Attributes | string | Conversation metadata as set by the customer, represented as stringified JSON |
ChatServiceSid | string, SID | Conversation Service SID |
MessagingServiceSid | string, SID | Messaging Service instance SID |
State | string | Enumerated type representing state of the conversation |
Your application may modify the Body
and Author
parameters in the pre-event webhook. To update these parameters, reply to the webhook with a JSON object that contains the relevant keys and values.
parameter name | type | description |
---|---|---|
EventType | string | Always onMessageAdd |
ConversationSid | string | Conversation SID identifier for the conversation the message is being added to. |
Body | string | The body of the message |
Author | string | The author of the message |
ParticipantSid | string, optional | Participant SID of the message author |
Attributes | string | Message metadata as set by customer, represented as stringified JSON |
Media | string, JSON, optional | Stringified JSON array of attached media objects |
ChannelMetadata | string | Stringified and escaped JSON pass-through metadata from OTT channels. Only available for GBM. See sample payload. |
parameter name | type | description |
---|---|---|
EventType | string | Always onMessageRemove |
ConversationSid | string | Conversation SID identifier for the conversation the message is being removed from. |
MessageSid | string | Message sid identifier |
Index | int | Message index in the messages stream |
DateCreated | string, ISO8601 time | Creation date of the message |
DateUpdated | string, ISO8601 time | Last modification date of the message |
Body | string | The body of the message |
Author | string | The author of the message |
ParticipantSid | String, optional | Participant SID of the message author |
Attributes | string | Message metadata as set by customer, represented as stringified JSON |
Media | string, JSON, optional | Stringified JSON array of attached media objects |
Your application may modify the Body
and Author
parameters in the pre-event webhook. To update these parameters, reply to the webhook with a JSON object that contains the relevant keys and values.
parameter name | type | description |
---|---|---|
EventType | string | Always onMessageUpdate |
ConversationSid | string | Conversation SID identifier for the conversation the message is in. |
MessageSid | string | Message sid identifier |
Index | int | Message index in the messages stream |
DateCreated | string, ISO8601 time | Creation date of the message |
DateUpdated | string, ISO8601 time | Last modification date of the message |
Body | string | The body of the message |
Author | string | The author of the message |
ParticipantSid | string, optional | Participant SID of the message author |
Attributes | string | Message metadata as set by customer, represented as stringified JSON |
Media | string, JSON, optional | Stringified JSON array of attached media objects |
parameter name | type | description |
---|---|---|
EventType | string | Always onParticipantAdd |
ConversationSid | string, SID | Conversation String Identifier |
Identity | string, optional (see note) | The Identity of the user being added to the conversation |
RoleSid | string | Role of user that is being added to the conversation |
Attributes | string | Participant metadata as set by the customer, represented as stringified JSON |
MessagingBinding.ProxyAddress | string, optional (see note) | Twilio Brand phone number used by participant |
MessagingBinding.Address | string, optional (see note) | Originating phone number of the participant |
MessagingBinding.ProjectedAddress | string, optional* | The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity |
MessagingBinding.Type | string | Type of the participant, one of: SMS, CHAT, WHATSAPP |
Note: A Conversation Participant has either the Identity
(and MessagingBinding ProjectedAddress
for GroupMMS Participant) or MessagingBinding ProxyAddress
and Address
attributes filled in. In case the added participant is SMS or WhatsApp, Identity
is null and both addresses are supplied. If the added participant is Chat-only, the Identity
value is provided, and both MessagingBinding addresses (MessagingBinding ProxyAddress
and Address
) are null.
parameter name | type | description |
---|---|---|
EventType | string | Always onParticipantRemove |
ConversationSid | string, SID | Conversation String Identifier |
ParticipantSid | string, SID | Participant String Identifier |
DateCreated | string, ISO8601 time | Creation date of the participant |
DateUpdated | string, ISO8601 time | The last modification date of the participant |
Identity | string, optional (see note) | The Identity of the user being removed from the conversation |
RoleSid | string | Role of user that is being removed from the conversation |
Attributes | string | Participant metadata as set by the customer, represented as stringified JSON |
MessagingBinding.ProxyAddress | string, optional (see note) | Twilio Brand phone number used by participant |
MessagingBinding.Address | string, optional (see note) | Originating phone number of the participant |
MessagingBinding.ProjectedAddress | string, optional* | The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity |
MessagingBinding.Type | string | Type of the participant, one of: SMS, CHAT, WHATSAPP |
Note: A Conversation Participant has either the Identity
(and MessagingBinding ProjectedAddress
for GroupMMS Participant) or MessagingBinding ProxyAddress
and Address
attributes filled in. In case the added participant is SMS or WhatsApp, Identity
is null and both addresses are supplied. If the added participant is Chat-only, the Identity
value is provided, and both MessagingBinding addresses (MessagingBinding ProxyAddress
and Address
) are null.
parameter name | type | description |
---|---|---|
EventType | string | Always onParticipantUpdate |
ConversationSid | string, SID | Conversation String Identifier |
ParticipantSid | string, SID | Participant String Identifier |
DateCreated | string, ISO8601 time | Creation date of the participant |
DateUpdated | string, ISO8601 time | The last modification date of the participant |
Identity | string, optional (see note) | The Identity of the user being added to the conversation |
RoleSid | string | Role of the user that is being added to the conversation |
Attributes | string | Participant metadata as set by the customer, represented as stringified JSON |
MessagingBinding.ProxyAddress | string, optional (see note) | Twilio Brand phone number used by participant |
MessagingBinding.Address | string, optional (see note) | Originating phone number of the participant |
MessagingBinding.ProjectedAddress | string, optional* | The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity |
MessagingBinding.Type | string | Type of the participant, one of: SMS, CHAT, WHATSAPP |
Note: A Conversation Participant has either the Identity
(and MessagingBinding ProjectedAddress
for GroupMMS Participant) or MessagingBinding ProxyAddress
and Address
attributes filled in. In case the added participant is SMS or WhatsApp, Identity
is null and both addresses are supplied. If the added participant is Chat-only, the Identity
value is provided, and both MessagingBinding addresses (MessagingBinding ProxyAddress
and Address
) are null.
parameter name | type | description |
---|---|---|
EventType | string | Always onUserUpdate |
ChatServiceSid | string, SID | Conversation Service String Identifier |
UserSid | String, SID | User String Identifier |
DateUpdated | string, ISO8601 time | User modification date |
Identity | string, optional (see note) | The Identity of the user being updated |
RoleSid | string | Role of the user being updated |
Attributes | string | User metadata, as set by the customer, represented as stringified JSON |
FriendlyName | string | Friendly name of the User |
parameter name | type | description |
---|---|---|
EventType | string | Always onConversationAdded |
ConversationSid | string, SID | Conversation Sid identifier |
DateCreated | string, ISO8601 time | The date of creation of the conversation |
DateUpdated | string, ISO8601 time | The last modification date of the conversation |
FriendlyName | string, optional | The friendly name of the conversation, if set |
UniqueName | string, optional | The unique name of the conversation |
Attributes | string | Conversation metadata as set by the customer, represented as stringified JSON |
ChatServiceSid | string, SID | Conversation Service SID |
MessagingServiceSid | string, SID | Messaging Service instance SID |
MessagingBinding.ProxyAddress | string, optional (see note) | Twilio Brand phone number used by channel creator |
MessagingBinding.Address | string, optional (see note) | Originating phone number of the channel creator |
MessagingBinding.ProjectedAddress | string, optional* | The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity |
MessagingBinding.AuthorAddress | string, optional* | Number of the message author when auto-creating Group MMS |
State | string | Enumerated type representing state of the conversation |
ChannelMetadata | string | Stringified and escaped JSON pass-through metadata from OTT channels. Only available for GBM. See sample payload. |
parameter name | type | description |
---|---|---|
EventType | string | Always onConversationRemoved |
ConversationSid | string, SID | Conversation String Identifier |
DateCreated | string, ISO8601 time | The date of creation of the conversation |
DateUpdated | string, ISO8601 time | The last modification date of the conversation |
DateRemoved | string, ISO8601 time | The date the conversation was removed |
FriendlyName | string, optional | The friendly name of the conversation, if set |
UniqueName | string, optional | The unique name of the conversation |
Attributes | string | Conversation metadata as set by the customer, represented as stringified JSON |
ChatServiceSid | string, SID | Conversation Service SID |
MessagingServiceSid | string, SID | Messaging Service instance SID |
State | string | Enumerated type representing state of the conversation |
You may modify the FriendlyName
of this conversation by replying to this webhook with a JSON object that contains the new friendly name.
parameter name | type | description |
---|---|---|
EventType | string | Always onConversationUpdated |
ConversationSid | string, SID | Conversation String Identifier |
DateCreated | string, ISO8601 time | The date of creation of the conversation |
DateUpdated | string, ISO8601 time | The last modification date of the conversation |
FriendlyName | string, optional | The friendly name of the conversation, if set |
UniqueName | string, optional | The unique name of the conversation |
Attributes | string | Conversation metadata as set by the customer, represented as stringified JSON |
ChatServiceSid | string, SID | Conversation Service SID |
MessagingServiceSid | string, SID | Messaging Service instance SID |
State | string | Enumerated type representing state of the conversation |
parameter name | type | description |
---|---|---|
EventType | string | onConversationStateUpdated |
ChatServiceSid | string, SID | Conversation Service SID |
StateUpdated | string, ISO8601 time | Modification date of the state |
StateFrom | String | State that conversation was transitioned from, e.g. "active", "inactive" or "closed". |
StateTo | String | State that conversation was transitioned to, e.g. "active", "inactive" or "closed". |
ConversationSid | String, SID | Conversation String Identifier |
Reason | String | Source of the state change, e.g., "API", "TIMER", "EVENT" |
MessagingServiceSid | String, SID | Messaging Service SID |
parameter name | type | description |
---|---|---|
EventType | string | Always onMessageAdded |
ConversationSid | string | Conversation SID identifier for the conversation the message is being added to. |
MessageSid | string | Message sid identifier |
MessagingServiceSid | string, SID | The Messaging Service SID attached to the conversation this message is being added to. |
Index | int | Message index in the messages stream |
DateCreated | string, ISO8601 time | Creation date of the message |
Body | string | The body of the message |
Author | string | The author of the message |
ParticipantSid | string, optional | Participant SID of the message author |
Attributes | string | Message metadata as set by customer, represented as stringified JSON |
Media | string, JSON, optional | Stringified JSON array of attached media objects |
ChannelMetadata | string | Stringified and escaped JSON pass-through metadata from OTT channels. Only available for GBM. See sample payload. |
parameter name | type | description |
---|---|---|
EventType | string | Always onMessageUpdated |
ConversationSid | string | Conversation SID identifier for the conversation the message is in. |
MessageSid | string | Message sid identifier |
Index | int | Message index in the messages stream |
DateCreated | string, ISO8601 time | Creation date of the message |
DateUpdated | string, ISO8601 time | Last modification date of the message |
Body | string | The body of the message |
Author | string | The author of the message |
ParticipantSid | string, optional | Participant SID of the message author |
Attributes | string | Message metadata as set by customer, represented as stringified JSON |
Media | string, JSON, optional | Stringified JSON array of attached media objects |
parameter name | type | description |
---|---|---|
EventType | string | Always onMessageRemoved |
ConversationSid | string | Conversation SID identifier for the conversation the message was removed from. |
MessageSid | string | Message sid identifier |
Index | int | Message index in the messages stream |
DateCreated | string, ISO8601 time | Creation date of the message |
DateUpdated | string, ISO8601 time | Last modification date of the message |
DateRemoved | string, ISO8601 time | Date that the message was removed from the conversation |
Body | string | The body of the message |
Author | string | The author of the message |
ParticipantSid | string, optional | Participant SID of the message author |
Attributes | string | Message metadata as set by customer, represented as stringified JSON |
Media | string, JSON, optional | Stringified JSON array of attached media objects |
parameter name | type | description |
---|---|---|
EventType | string | Always onParticipantAdded |
ConversationSid | string, SID | Conversation String Identifier |
ParticipantSid | string, SID | Participant String Identifier |
DateCreated | string, ISO8601 time | The date of creation of the participant |
Identity | string, optional (see note) | The Identity of the user being added to the conversation |
RoleSid | string | Role of user that is being added to the conversation |
Attributes | string | Participant metadata as set by the customer, represented as stringified JSON |
MessagingBinding.ProxyAddress | string, optional (see note) | Twilio Brand phone number used by participant |
MessagingBinding.Address | string, optional (see note) | Originating phone number of the participant |
MessagingBinding.ProjectedAddress | string, optional* | The address of the Twilio phone number that is used in Group MMS |
MessagingBinding.Type | string | Type of the participant, one of: SMS, CHAT, WHATSAPP |
Note: A Conversation Participant has either the Identity
(and MessagingBinding ProjectedAddress
for GroupMMS Participant) or MessagingBinding ProxyAddress
and Address
attributes filled in. In case the added participant is SMS or WhatsApp, Identity
is null and both addresses are supplied. If the added participant is Chat-only, the Identity
value is provided, and both MessagingBinding addresses (MessagingBinding ProxyAddress
and Address
) are null.
parameter name | type | description |
---|---|---|
EventType | string | Always onParticipantRemoved |
ConversationSid | string, SID | Conversation String Identifier |
ParticipantSid | string, SID | Participant String Identifier |
DateCreated | string, ISO8601 time | Creation date of the participant |
DateUpdated | string, ISO8601 time | The last modification date of the participant |
DateRemoved | string, ISO8601 time | The date the participant was removed |
Identity | string, optional (see note) | The Identity of the user being removed from the conversation |
RoleSid | string | Role of user that is being removed from the conversation |
Attributes | string | Participant metadata as set by the customer, represented as stringified JSON |
MessagingBinding.ProxyAddress | string, optional (see note) | Twilio Brand phone number used by participant |
MessagingBinding.Address | string, optional (see note) | Originating phone number of the participant |
MessagingBinding.ProjectedAddress | string, optional* | The address of the Twilio phone number that is used in Group MMS |
MessagingBinding.Type | string | Type of the participant, one of: SMS, CHAT, WHATSAPP |
Note: A Conversation Participant has either the Identity
(and MessagingBinding ProjectedAddress
for GroupMMS Participant) or MessagingBinding ProxyAddress
and Address
attributes filled in. In case the added participant is SMS or WhatsApp, Identity
is null and both addresses are supplied. If the added participant is Chat-only, the Identity
value is provided, and both MessagingBinding addresses (MessagingBinding ProxyAddress
and Address
) are null.
parameter name | type | description |
---|---|---|
EventType | string | Always onParticipantUpdated |
ConversationSid | string, SID | Conversation String Identifier |
ParticipantSid | string, SID | Participant String Identifier |
DateCreated | string, ISO8601 time | Creation date of the participant |
DateUpdated | string, ISO8601 time | The last modification date of the participant |
Identity | string, optional (see note) | The Identity of the user being added to the conversation |
RoleSid | string | Role of user that is being added to the conversation |
Attributes | string | Participant metadata as set by the customer, represented as stringified JSON |
MessagingBinding.ProxyAddress | string, optional (see note) | Twilio Brand phone number used by participant |
MessagingBinding.Address | string, optional (see note) | Originating phone number of the participant |
MessagingBinding.ProjectedAddress | string, optional* | The address of the Twilio phone number that is used in Group MMS |
MessagingBinding.Type | string | Type of the participant, one of: SMS, CHAT, WHATSAPP |
LastReadMessageIndex | int | Index of last "read" message in the Conversation for the participant |
Note: A Conversation Participant has either the Identity
(and MessagingBinding ProjectedAddress
for GroupMMS Participant) or MessagingBinding ProxyAddress
and Address
attributes filled in. In case the added participant is SMS or WhatsApp, Identity
is null and both addresses are supplied. If the added participant is Chat-only, the Identity
value is provided, and both MessagingBinding addresses (MessagingBinding ProxyAddress
and Address
) are null.
parameter name | type | description |
---|---|---|
EventType | string | onDeliveryUpdated |
AccountSid | string, SID | SID of the account that the message belongs to, ACxx |
ConversationSid | string, SID | Conversation String Identifier, CHxx |
ChatServiceSid | string, SID | Conversation Service SID, ISxx |
MessageSid | string, SID | Identifier of Conversation Message, IMxxx |
DeliveryReceiptSid | string, SID | SID of the Delivery Receipt, DYxx |
ChannelMessageSid | string, SID | SID of the 'channel' message e.g WAxx for WhatsApp, SMxx for SMS |
ParticipantSid | string, SID | Participant String Identifier, MBxx |
Status | string, enum | Status of the message, one of "read", "failed", "delivered", "undelivered", "sent" |
ErrorCode | integer | Twilio documented numeric error code |
DateCreated | string, ISO8601 time | Date delivery receipt was created |
DateUpdated | string, ISO8601 time | Date that delivery receipt was last created |
parameter name | type | description |
---|---|---|
EventType | string | Always onUserAdded |
ChatServiceSid | string, SID | Conversation Service String Identifier |
UserSid | string, SID | String identifier of newly created User |
DateCreated | string, ISO8601 time | The date of creation of the User |
Identity | string, optional (see note) | The Identity of the user being added to the conversation |
RoleSid | string | Role of the user that is being added to the conversation |
Attributes | string | User metadata as set by the customer, represented as stringified JSON |
FriendlyName | string | Friendly name of the User |
parameter name | type | description |
---|---|---|
EventType | string | Always onUserUpdated |
ChatServiceSid | string, SID | Conversation Service String Identifier |
UserSid | string, SID | User String Identifier |
DateCreated | string, ISO8601 time | The date of creation of the User |
DateUpdated | string, ISO8601 time | User modification date |
Identity | string, optional (see note) | The Identity of the user being added to the conversation |
RoleSid | string | Role of the user that was updated |
Attributes | string | User metadata as set by the customer, represented as stringified JSON |
FriendlyName | string | Friendly name of the User |
isOnline | Boolean | Whether the User is actively connected to this Conversations Service and online |
isNotifiable | Boolean | Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service |
Pass-through metadata from the OTT channel. Currently, only supported for Google Business Messages. The channel key (gbm)
is always available, but the values passed inside are set by Google and are subject to change.
Google Business Messages (GBM) will be turned off on July 31, 2024. The Twilio GBM API and Google Business Profiles chat will no longer work after that point.
1"ChannelMetadata": "{2\"gbm\": {3\"context\": {4\"placeId\": \"ChIJU6DUSUUVkCQRxl6dlKFV8ok\",5\"entryPoint\": \"PLACESHEET\",6\"userInfo\": { \"displayName\": \"Sample Name\", \"userDeviceLocale\": \"en-US\" },7\"resolvedLocale\": \"en\"8}9}10}"