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

Conversations Webhooks


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.

(information)

Info

Conversations webhooks have a maximum timeout of 5 seconds.

(information)

Info

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.


Table of Contents

table-of-contents page anchor

Configuring Webhook Targets and Filtering

configuring-webhook-targets-and-filtering page anchor

You can configure the global (Account-level) webhook target and service-level webhook target through the Console, or through the REST API.

  • For the global webhook target, go to Conversations > Global webhooks .
  • For the service-level webhook target, select your Conversation Service, then go to Webhooks .
Configuring global webhooks for Conversations in the Twilio Console.

Note: The Conversation-scoped webhooks may only be modified via the REST API.

Webhook Filtering

webhook-filtering page anchor

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:

  • For the global webhook target, go to Conversations > Global webhooks and scroll down to Webhook Filtering .
  • For the service-level webhook target, select your Conversation Service, then go to Webhooks . Scroll down to Webhook Filtering .
Webhook Filtering Conversations.

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-ActionPost-ActionDescription (incl. Post-Action)
onMessageAddonMessageAddedFires when a new message is posted to a conversation.
onMessageRemoveonMessageRemovedFires when a message is deleted from a conversation.
onMessageUpdateonMessageUpdatedFires when a posted message's body or any attribute is changed.
onConversationAddonConversationAddedFires when a new conversation is created.
onConversationRemoveonConversationRemovedFires when a conversation is removed from the Service.
onConversationUpdateonConversationUpdatedFires when any attribute of a conversation is changed.
onParticipantAddonParticipantAddedFires when a Participant has joined a Conversation as a Member.
onParticipantRemoveonParticipantRemovedFires when a User is removed from the set of Conversation Members.
onParticipantUpdateonParticipantUpdatedFires when any configurable attribute of a User is changed. Will not be fired for reachability events.
---onConversationStateUpdatedFires when the state of a Conversation is updated, e.g., from "active" to "inactive"
---onDeliveryUpdatedFires when delivery receipt status is updated
---onUserAddedFires when a new user is added
onUserUpdateonUserUpdatedFires when a user is changed

Triggering Webhooks for REST API Events

triggering-webhooks-for-rest-api-events page anchor

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.

Using Pre-Action Webhooks to Modify or Reject Changes

using-pre-action-webhooks-to-modify-or-reject-changes page anchor

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 CodeBodyResult
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/AConversations will reject the change and no publication will be made.
HTTP 50x (any error condition)N/AConversations 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.

Conversation Actions

conversation-actions page anchor

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


_10
HTTP 200 OK
_10
Content-Type: application/json
_10
{
_10
"friendly_name": "friendly name of conversation"
_10
}

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.


_10
HTTP 200 OK
_10
Content-Type: application/json
_10
{
_10
"body": "modified message text",
_10
"author": "modified author name",
_10
"attributes": "{\"key\" : \"value\"}"
_10
}


Configuring Webhooks with the REST API

configuring-webhooks-with-the-rest-api page anchor

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).

Retrieve Existing Global Webhook Configuration for a Conversation Service

retrieve-existing-global-webhook-configuration-for-a-conversation-service page anchor

This API retrieves the configuration of a global webhook capturing events for entire service instance.

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.conversations.v1.configuration
_11
.webhooks()
_11
.fetch()
_11
.then(webhook => console.log(webhook.method));

Output

_12
{
_12
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"pre_webhook_url": "https://example.com/pre",
_12
"post_webhook_url": "https://example.com/post",
_12
"method": "GET",
_12
"filters": [
_12
"onMessageSend",
_12
"onConversationUpdated"
_12
],
_12
"target": "webhook",
_12
"url": "https://conversations.twilio.com/v1/Configuration/Webhooks"
_12
}

Update Global Webhook Configuration for a Conversation Service

update-global-webhook-configuration-for-a-conversation-service page anchor

This API updates the configuration of global webhook capturing events for entire service instance.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_17
// Download the helper library from https://www.twilio.com/docs/node/install
_17
// Find your Account SID and Auth Token at twilio.com/console
_17
// and set the environment variables. See http://twil.io/secure
_17
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_17
const authToken = process.env.TWILIO_AUTH_TOKEN;
_17
const client = require('twilio')(accountSid, authToken);
_17
_17
client.conversations.v1.configuration
_17
.webhooks()
_17
.update({
_17
filters: ['onMessageAdd', 'onMessageUpdate', 'onMessageRemove'],
_17
target: 'webhook',
_17
preWebhookUrl: 'https://YOUR_APPLICATION.com/webhook',
_17
postWebhookUrl: 'https://YOUR_APPLICATION.com/webhook',
_17
method: 'POST'
_17
})
_17
.then(webhook => console.log(webhook.method));

Output

_13
{
_13
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"pre_webhook_url": "https://YOUR_APPLICATION.com/webhook",
_13
"post_webhook_url": "https://YOUR_APPLICATION.com/webhook",
_13
"method": "POST",
_13
"filters": [
_13
"onMessageAdd",
_13
"onMessageUpdate",
_13
"onMessageRemove"
_13
],
_13
"target": "webhook",
_13
"url": "https://conversations.twilio.com/v1/Configuration/Webhooks"
_13
}

List the Scoped Webhooks for a Conversation

list-the-scoped-webhooks-for-a-conversation page anchor

This API retrieves the list of scoped webhooks configured for a specific Conversation.

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.conversations.v1.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.webhooks
_11
.list({limit: 20})
_11
.then(webhooks => webhooks.forEach(w => console.log(w.sid)));

Output

_59
{
_59
"meta": {
_59
"page": 0,
_59
"page_size": 5,
_59
"first_page_url": "https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks?PageSize=5&Page=0",
_59
"previous_page_url": "https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks?PageSize=5&Page=0",
_59
"url": "https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks?PageSize=5&Page=0",
_59
"next_page_url": "https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks?PageSize=5&Page=1",
_59
"key": "webhooks"
_59
},
_59
"webhooks": [
_59
{
_59
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_59
"conversation_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_59
"sid": "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_59
"target": "webhook",
_59
"configuration": {
_59
"url": "https://example.com",
_59
"method": "get",
_59
"filters": [
_59
"onMessageSent",
_59
"onConversationDestroyed"
_59
]
_59
},
_59
"date_created": "2016-03-24T21:05:50Z",
_59
"date_updated": "2016-03-24T21:05:50Z",
_59
"url": "https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks/WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_59
},
_59
{
_59
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_59
"conversation_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_59
"sid": "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_59
"target": "trigger",
_59
"configuration": {
_59
"url": "https://example.com",
_59
"method": "post",
_59
"filters": [
_59
"keyword1",
_59
"keyword2"
_59
]
_59
},
_59
"date_created": "2016-03-24T21:05:50Z",
_59
"date_updated": "2016-03-24T21:05:50Z",
_59
"url": "https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks/WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_59
},
_59
{
_59
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_59
"conversation_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_59
"sid": "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_59
"target": "studio",
_59
"configuration": {
_59
"flow_sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_59
},
_59
"date_created": "2016-03-24T21:05:50Z",
_59
"date_updated": "2016-03-24T21:05:50Z",
_59
"url": "https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks/WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_59
}
_59
]
_59
}

Retrieve the Configuration for a Specific Webhook

retrieve-the-configuration-for-a-specific-webhook page anchor

This API fetches the configuration of a specific scoped webhook configured for the given Conversation.

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.conversations.v1.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.webhooks('WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.fetch()
_11
.then(webhook => console.log(webhook.sid));

Output

_12
{
_12
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"conversation_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"sid": "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"target": "studio",
_12
"configuration": {
_12
"flow_sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_12
},
_12
"date_created": "2016-03-24T21:05:50Z",
_12
"date_updated": "2016-03-24T21:05:50Z",
_12
"url": "https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks/WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_12
}

Create New Scoped Webhook Configuration

create-new-scoped-webhook-configuration page anchor

This API creates a new scoped webhook for the given Conversation.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_15
// Download the helper library from https://www.twilio.com/docs/node/install
_15
// Find your Account SID and Auth Token at twilio.com/console
_15
// and set the environment variables. See http://twil.io/secure
_15
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_15
const authToken = process.env.TWILIO_AUTH_TOKEN;
_15
const client = require('twilio')(accountSid, authToken);
_15
_15
client.conversations.v1.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_15
.webhooks
_15
.create({
_15
'configuration.filters': ['onMessageAdded', 'onMessageUpdated'],
_15
'configuration.url': 'https://YOUR_APPLICATION.com/webhook',
_15
target: 'webhook'
_15
})
_15
.then(webhook => console.log(webhook.sid));

Output

_17
{
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"conversation_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"sid": "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"target": "webhook",
_17
"configuration": {
_17
"url": "https://example.com",
_17
"method": "get",
_17
"filters": [
_17
"onMessageSent",
_17
"onConversationDestroyed"
_17
]
_17
},
_17
"date_created": "2016-03-24T21:05:50Z",
_17
"date_updated": "2016-03-24T21:05:50Z",
_17
"url": "https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks/WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
}


Webhook Bodies by Event Type

webhook-bodies page anchor

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 nametypedescription
AccountSidstring, SIDThe Twilio Account SID that the Conversation belongs to
EventTypestringThe type of action that triggered this webhook event (see details for each event type below)
SourcestringThe source of the action that created this event - possible values are SDK or API
ClientIdentitystringThe 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.

Pre-action Webhooks Request Parameters

pre-action-webhooks page anchor

You may modify the FriendlyName of this conversation by replying to this webhook with a JSON object that contains the new friendly name.

parameter nametypedescription
EventTypestringAlways onConversationAdd
FriendlyNamestring, optionalThe friendly name of the conversation, if set
UniqueNamestringThe unique name of the conversation
AttributesstringConversation metadata as set by the customer, represented as stringified JSON
ChatServiceSidstring, SIDConversation Service SID
MessagingServiceSidstring, SIDMessaging Service instance SID
MessagingBinding.ProxyAddressstring, optional (see note)Twilio Brand phone number used by channel creator
MessagingBinding.Addressstring, optional (see note)Originating phone number of the channel creator
MessagingBinding.ProjectedAddressstring, optional*The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity
MessagingBinding.AuthorAddressstring, optional*Number of the message author when auto-creating Group MMS
MessageBodystring, optionalInitial conversation message string
Mediastring, JSON, optionalStringified JSON array of attached media objects
StatestringEnumerated type representing state of the conversation
ChannelMetadatastringStringified 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 nametypedescription
EventTypestringAlways onConversationRemove
ConversationSidstring, SIDConversation String Identifier
DateCreatedstring, ISO8601 timeThe date of creation of the conversation
DateUpdatedstring, ISO8601 timeThe last modification date of the conversation
FriendlyNamestring, optionalThe friendly name of the conversation, if set
UniqueNamestringThe unique name of the conversation
AttributesstringConversation metadata as set by the customer, represented as stringified JSON
ChatServiceSidstring, SIDConversation Service SID
MessagingServiceSidstring, SIDMessaging Service instance SID
StatestringEnumerated 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 nametypedescription
EventTypestringAlways onConversationUpdate
ConversationSidstring, SIDConversation String Identifier
DateCreatedstring, ISO8601 timeThe date of creation of the conversation
DateUpdatedstring, ISO8601 timeThe last modification date of the conversation
FriendlyNamestring, optionalThe friendly name of the conversation, if set
UniqueNamestringThe unique name of the conversation
AttributesstringConversation metadata as set by the customer, represented as stringified JSON
ChatServiceSidstring, SIDConversation Service SID
MessagingServiceSidstring, SIDMessaging Service instance SID
StatestringEnumerated 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 nametypedescription
EventTypestringAlways onMessageAdd
ConversationSidstringConversation SID identifier for the conversation the message is being added to.
BodystringThe body of the message
AuthorstringThe author of the message
ParticipantSidstring, optionalParticipant SID of the message author
AttributesstringMessage metadata as set by customer, represented as stringified JSON
Mediastring, JSON, optionalStringified JSON array of attached media objects
ChannelMetadatastringStringified and escaped JSON pass-through metadata from OTT channels. Only available for GBM. See sample payload.
parameter nametypedescription
EventTypestringAlways onMessageRemove
ConversationSidstringConversation SID identifier for the conversation the message is being removed from.
MessageSidstringMessage sid identifier
IndexintMessage index in the messages stream
DateCreatedstring, ISO8601 timeCreation date of the message
DateUpdatedstring, ISO8601 timeLast modification date of the message
BodystringThe body of the message
AuthorstringThe author of the message
ParticipantSidString, optionalParticipant SID of the message author
AttributesstringMessage metadata as set by customer, represented as stringified JSON
Mediastring, JSON, optionalStringified JSON array of attached media objects

Your application may modify the Body and Authorparameters 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 nametypedescription
EventTypestringAlways onMessageUpdate
ConversationSidstringConversation SID identifier for the conversation the message is in.
MessageSidstringMessage sid identifier
IndexintMessage index in the messages stream
DateCreatedstring, ISO8601 timeCreation date of the message
DateUpdatedstring, ISO8601 timeLast modification date of the message
BodystringThe body of the message
AuthorstringThe author of the message
ParticipantSidstring, optionalParticipant SID of the message author
AttributesstringMessage metadata as set by customer, represented as stringified JSON
Mediastring, JSON, optionalStringified JSON array of attached media objects
parameter nametypedescription
EventTypestringAlways onParticipantAdd
ConversationSidstring, SIDConversation String Identifier
Identitystring, optional (see note)The Identity of the user being added to the conversation
RoleSidstringRole of user that is being added to the conversation
AttributesstringParticipant metadata as set by the customer, represented as stringified JSON
MessagingBinding.ProxyAddressstring, optional (see note)Twilio Brand phone number used by participant
MessagingBinding.Addressstring, optional (see note)Originating phone number of the participant
MessagingBinding.ProjectedAddressstring, optional*The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity
MessagingBinding.TypestringType 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 nametypedescription
EventTypestringAlways onParticipantRemove
ConversationSidstring, SIDConversation String Identifier
ParticipantSidstring, SIDParticipant String Identifier
DateCreatedstring, ISO8601 timeCreation date of the participant
DateUpdatedstring, ISO8601 timeThe last modification date of the participant
Identitystring, optional (see note)The Identity of the user being removed from the conversation
RoleSidstringRole of user that is being removed from the conversation
AttributesstringParticipant metadata as set by the customer, represented as stringified JSON
MessagingBinding.ProxyAddressstring, optional (see note)Twilio Brand phone number used by participant
MessagingBinding.Addressstring, optional (see note)Originating phone number of the participant
MessagingBinding.ProjectedAddressstring, optional*The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity
MessagingBinding.TypestringType 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 nametypedescription
EventTypestringAlways onParticipantUpdate
ConversationSidstring, SIDConversation String Identifier
ParticipantSidstring, SIDParticipant String Identifier
DateCreatedstring, ISO8601 timeCreation date of the participant
DateUpdatedstring, ISO8601 timeThe last modification date of the participant
Identitystring, optional (see note)The Identity of the user being added to the conversation
RoleSidstringRole of the user that is being added to the conversation
AttributesstringParticipant metadata as set by the customer, represented as stringified JSON
MessagingBinding.ProxyAddressstring, optional (see note)Twilio Brand phone number used by participant
MessagingBinding.Addressstring, optional (see note)Originating phone number of the participant
MessagingBinding.ProjectedAddressstring, optional*The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity
MessagingBinding.TypestringType 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 nametypedescription
EventTypestringAlways onUserUpdate
ChatServiceSidstring, SIDConversation Service String Identifier
UserSidString, SIDUser String Identifier
DateUpdatedstring, ISO8601 timeUser modification date
Identitystring, optional (see note)The Identity of the user being updated
RoleSidstringRole of the user being updated
AttributesstringUser metadata, as set by the customer, represented as stringified JSON
FriendlyNamestringFriendly name of the User

Post Action Webhooks request parameters

post-action-webhooks page anchor
parameter nametypedescription
EventTypestringAlways onConversationAdded
ConversationSidstring, SIDConversation Sid identifier
DateCreatedstring, ISO8601 timeThe date of creation of the conversation
DateUpdatedstring, ISO8601 timeThe last modification date of the conversation
FriendlyNamestring, optionalThe friendly name of the conversation, if set
UniqueNamestring, optionalThe unique name of the conversation
AttributesstringConversation metadata as set by the customer, represented as stringified JSON
ChatServiceSidstring, SIDConversation Service SID
MessagingServiceSidstring, SIDMessaging Service instance SID
MessagingBinding.ProxyAddressstring, optional (see note)Twilio Brand phone number used by channel creator
MessagingBinding.Addressstring, optional (see note)Originating phone number of the channel creator
MessagingBinding.ProjectedAddressstring, optional*The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity
MessagingBinding.AuthorAddressstring, optional*Number of the message author when auto-creating Group MMS
StatestringEnumerated type representing state of the conversation
ChannelMetadatastringStringified and escaped JSON pass-through metadata from OTT channels. Only available for GBM. See sample payload.
parameter nametypedescription
EventTypestringAlways onConversationRemoved
ConversationSidstring, SIDConversation String Identifier
DateCreatedstring, ISO8601 timeThe date of creation of the conversation
DateUpdatedstring, ISO8601 timeThe last modification date of the conversation
DateRemovedstring, ISO8601 timeThe date the conversation was removed
FriendlyNamestring, optionalThe friendly name of the conversation, if set
UniqueNamestring, optionalThe unique name of the conversation
AttributesstringConversation metadata as set by the customer, represented as stringified JSON
ChatServiceSidstring, SIDConversation Service SID
MessagingServiceSidstring, SIDMessaging Service instance SID
StatestringEnumerated 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 nametypedescription
EventTypestringAlways onConversationUpdated
ConversationSidstring, SIDConversation String Identifier
DateCreatedstring, ISO8601 timeThe date of creation of the conversation
DateUpdatedstring, ISO8601 timeThe last modification date of the conversation
FriendlyNamestring, optionalThe friendly name of the conversation, if set
UniqueNamestring, optionalThe unique name of the conversation
AttributesstringConversation metadata as set by the customer, represented as stringified JSON
ChatServiceSidstring, SIDConversation Service SID
MessagingServiceSidstring, SIDMessaging Service instance SID
StatestringEnumerated type representing state of the conversation

onConversationStateUpdated

onconversationstateupdated page anchor
parameter nametypedescription
EventTypestringonConversationStateUpdated
ChatServiceSidstring, SIDConversation Service SID
StateUpdatedstring, ISO8601 timeModification date of the state
StateFromStringState that conversation was transitioned from, e.g. "active", "inactive" or "closed".
StateToStringState that conversation was transitioned to, e.g. "active", "inactive" or "closed".
ConversationSidString, SIDConversation String Identifier
ReasonStringSource of the state change, e.g., "API", "TIMER", "EVENT"
MessagingServiceSidString, SIDMessaging Service SID
parameter nametypedescription
EventTypestringAlways onMessageAdded
ConversationSidstringConversation SID identifier for the conversation the message is being added to.
MessageSidstringMessage sid identifier
MessagingServiceSidstring, SIDThe Messaging Service SID attached to the conversation this message is being added to.
IndexintMessage index in the messages stream
DateCreatedstring, ISO8601 timeCreation date of the message
BodystringThe body of the message
AuthorstringThe author of the message
ParticipantSidstring, optionalParticipant SID of the message author
AttributesstringMessage metadata as set by customer, represented as stringified JSON
Mediastring, JSON, optionalStringified JSON array of attached media objects
ChannelMetadatastringStringified and escaped JSON pass-through metadata from OTT channels. Only available for GBM. See sample payload.
parameter nametypedescription
EventTypestringAlways onMessageUpdated
ConversationSidstringConversation SID identifier for the conversation the message is in.
MessageSidstringMessage sid identifier
IndexintMessage index in the messages stream
DateCreatedstring, ISO8601 timeCreation date of the message
DateUpdatedstring, ISO8601 timeLast modification date of the message
BodystringThe body of the message
AuthorstringThe author of the message
ParticipantSidstring, optionalParticipant SID of the message author
AttributesstringMessage metadata as set by customer, represented as stringified JSON
Mediastring, JSON, optionalStringified JSON array of attached media objects
parameter nametypedescription
EventTypestringAlways onMessageRemoved
ConversationSidstringConversation SID identifier for the conversation the message was removed from.
MessageSidstringMessage sid identifier
IndexintMessage index in the messages stream
DateCreatedstring, ISO8601 timeCreation date of the message
DateUpdatedstring, ISO8601 timeLast modification date of the message
DateRemovedstring, ISO8601 timeDate that the message was removed from the conversation
BodystringThe body of the message
AuthorstringThe author of the message
ParticipantSidstring, optionalParticipant SID of the message author
AttributesstringMessage metadata as set by customer, represented as stringified JSON
Mediastring, JSON, optionalStringified JSON array of attached media objects
parameter nametypedescription
EventTypestringAlways onParticipantAdded
ConversationSidstring, SIDConversation String Identifier
ParticipantSidstring, SIDParticipant String Identifier
DateCreatedstring, ISO8601 timeThe date of creation of the participant
Identitystring, optional (see note)The Identity of the user being added to the conversation
RoleSidstringRole of user that is being added to the conversation
AttributesstringParticipant metadata as set by the customer, represented as stringified JSON
MessagingBinding.ProxyAddressstring, optional (see note)Twilio Brand phone number used by participant
MessagingBinding.Addressstring, optional (see note)Originating phone number of the participant
MessagingBinding.ProjectedAddressstring, optional*The address of the Twilio phone number that is used in Group MMS
MessagingBinding.TypestringType 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 nametypedescription
EventTypestringAlways onParticipantRemoved
ConversationSidstring, SIDConversation String Identifier
ParticipantSidstring, SIDParticipant String Identifier
DateCreatedstring, ISO8601 timeCreation date of the participant
DateUpdatedstring, ISO8601 timeThe last modification date of the participant
DateRemovedstring, ISO8601 timeThe date the participant was removed
Identitystring, optional (see note)The Identity of the user being removed from the conversation
RoleSidstringRole of user that is being removed from the conversation
AttributesstringParticipant metadata as set by the customer, represented as stringified JSON
MessagingBinding.ProxyAddressstring, optional (see note)Twilio Brand phone number used by participant
MessagingBinding.Addressstring, optional (see note)Originating phone number of the participant
MessagingBinding.ProjectedAddressstring, optional*The address of the Twilio phone number that is used in Group MMS
MessagingBinding.TypestringType 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 nametypedescription
EventTypestringAlways onParticipantUpdated
ConversationSidstring, SIDConversation String Identifier
ParticipantSidstring, SIDParticipant String Identifier
DateCreatedstring, ISO8601 timeCreation date of the participant
DateUpdatedstring, ISO8601 timeThe last modification date of the participant
Identitystring, optional (see note)The Identity of the user being added to the conversation
RoleSidstringRole of user that is being added to the conversation
AttributesstringParticipant metadata as set by the customer, represented as stringified JSON
MessagingBinding.ProxyAddressstring, optional (see note)Twilio Brand phone number used by participant
MessagingBinding.Addressstring, optional (see note)Originating phone number of the participant
MessagingBinding.ProjectedAddressstring, optional*The address of the Twilio phone number that is used in Group MMS
MessagingBinding.TypestringType of the participant, one of: SMS, CHAT, WHATSAPP
LastReadMessageIndexintIndex 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 nametypedescription
EventTypestringonDeliveryUpdated
AccountSidstring, SIDSID of the account that the message belongs to, ACxx
ConversationSidstring, SIDConversation String Identifier, CHxx
ChatServiceSidstring, SIDConversation Service SID, ISxx
MessageSidstring, SIDIdentifier of Conversation Message, IMxxx
DeliveryReceiptSidstring, SIDSID of the Delivery Receipt, DYxx
ChannelMessageSidstring, SIDSID of the 'channel' message e.g WAxx for WhatsApp, SMxx for SMS
ParticipantSidstring, SIDParticipant String Identifier, MBxx
Statusstring, enumStatus of the message, one of "read", "failed", "delivered", "undelivered", "sent"
ErrorCodeintegerTwilio documented numeric error code
DateCreatedstring, ISO8601 timeDate delivery receipt was created
DateUpdatedstring, ISO8601 timeDate that delivery receipt was last created
parameter nametypedescription
EventTypestringAlways onUserAdded
ChatServiceSidstring, SIDConversation Service String Identifier
UserSidstring, SIDString identifier of newly created User
DateCreatedstring, ISO8601 timeThe date of creation of the User
Identitystring, optional (see note)The Identity of the user being added to the conversation
RoleSidstringRole of the user that is being added to the conversation
AttributesstringUser metadata as set by the customer, represented as stringified JSON
FriendlyNamestringFriendly name of the User
parameter nametypedescription
EventTypestringAlways onUserUpdated
ChatServiceSidstring, SIDConversation Service String Identifier
UserSidstring, SIDUser String Identifier
DateCreatedstring, ISO8601 timeThe date of creation of the User
DateUpdatedstring, ISO8601 timeUser modification date
Identitystring, optional (see note)The Identity of the user being added to the conversation
RoleSidstringRole of the user that was updated
AttributesstringUser metadata as set by the customer, represented as stringified JSON
FriendlyNamestringFriendly name of the User
isOnlinebooleanWhether the User is actively connected to this Conversations Service and online
isNotifiablebooleanWhether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service

Channel Metadata JSON Sample

channel-metadata-json-sample page anchor

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.


_10
"ChannelMetadata": "{
_10
\"gbm\": {
_10
\"context\": {
_10
\"placeId\": \"ChIJU6DUSUUVkCQRxl6dlKFV8ok\",
_10
\"entryPoint\": \"PLACESHEET\",
_10
\"userInfo\": { \"displayName\": \"Sample Name\", \"userDeviceLocale\": \"en-US\" },
_10
\"resolvedLocale\": \"en\"
_10
}
_10
}
_10
}"


Rate this page: