Programmable Chat has been deprecated and is no longer supported. Instead, we'll be focusing on the next generation of chat: Twilio Conversations. Find out more about the EOL process here.
If you're starting a new project, please visit the Conversations Docs to begin. If you've already built on Programmable Chat, please visit our Migration Guide to learn about how to switch.
The Message resource of Programmable Chat represents a single message within a Channel in a Service instance. Creating a new Message resource sends a message to the Channel. Fetching and Reading Message resources provide information about previously sent messages.
Each Message resource contains these properties.
sid
type: SID<IM>The unique string that we created to identify the Message resource.
^IM[0-9a-fA-F]{32}$
34
34
account_sid
type: SID<AC>The SID of the Account that created the Message resource.
^AC[0-9a-fA-F]{32}$
34
34
attributes
type: stringThe JSON string that stores application-specific data. If attributes have not been set, {}
is returned.
service_sid
type: SID<IS>The SID of the Service the Message resource is associated with.
^IS[0-9a-fA-F]{32}$
34
34
to
type: SID<CH>The SID of the Channel that the message was sent to.
^CH[0-9a-fA-F]{32}$
34
34
channel_sid
type: SID<CH>The SID of the Channel the Message resource belongs to.
^CH[0-9a-fA-F]{32}$
34
34
date_created
type: string<date-time>The date and time in GMT when the resource was created specified in ISO 8601 format.
date_updated
type: string<date-time>The date and time in GMT when the resource was last updated specified in ISO 8601 format.
index
type: integerThe index of the message within the Channel. Indices may skip numbers, but will always be in order of when the message was received.
media
type: objectAn object that describes the Message's media, if the message contains media. The object contains these fields: content_type
with the MIME type of the media, filename
with the name of the media, sid
with the SID of the Media resource, and size
with the media object's file size in bytes. If the Message has no media, this value is null
.
POST https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages
The {ChannelSid}
value can be the Channel resource's sid
or unique_name
.
Creating a new Message resource in a Channel sends a message to the Channel.
X-Twilio-Webhook-Enabled
type: enum<string>The X-Twilio-Webhook-Enabled HTTP request header
true
false
ServiceSid
type: SID<IS>The SID of the Service to create the Message resource under.
^IS[0-9a-fA-F]{32}$
34
34
ChannelSid
type: stringThe SID of the Channel the new Message resource belongs to. This value can be the Channel resource's sid
or unique_name
.
DateCreated
type: string<date-time>The date, specified in ISO 8601 format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. This parameter should only be used when a Chat's history is being recreated from a backup/separate source.
DateUpdated
type: string<date-time>The date, specified in ISO 8601 format, to assign to the resource as the date it was last updated.
Body
type: stringThe message to send to the channel. Can be an empty string or null
, which sets the value as an empty string. You can send structured data in the body by serializing it as a string.
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}
The {ChannelSid}
value can be the Channel resource's sid
or unique_name
.
ServiceSid
type: SID<IS>The SID of the Service to fetch the Message resource from.
^IS[0-9a-fA-F]{32}$
34
34
ChannelSid
type: stringThe SID of the Channel the Message resource to fetch belongs to. This value can be the Channel resource's sid
or unique_name
.
Sid
type: SID<IM>The SID of the Message resource to fetch.
^IM[0-9a-fA-F]{32}$
34
34
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages
The {ChannelSid}
value can be the Channel resource's sid
or unique_name
.
ServiceSid
type: SID<IS>The SID of the Service to read the Message resources from.
^IS[0-9a-fA-F]{32}$
34
34
ChannelSid
type: stringThe SID of the Channel the Message resource to read belongs to. This value can be the Channel resource's sid
or unique_name
.
Order
type: enum<string>The sort order of the returned messages. Can be: asc
(ascending) or desc
(descending) with asc
as the default.
asc
desc
PageSize
type: integerHow many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Page
type: integerThe page index. This value is simply for client state.
0
POST https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}
The {ChannelSid}
value can be the Channel resource's sid
or unique_name
.
X-Twilio-Webhook-Enabled
type: enum<string>The X-Twilio-Webhook-Enabled HTTP request header
true
false
ServiceSid
type: SID<IS>The SID of the Service to update the Message resource in.
^IS[0-9a-fA-F]{32}$
34
34
ChannelSid
type: stringThe SID of the Channel the Message resource to update belongs to. This value can be the Channel resource's sid
or unique_name
.
Sid
type: SID<IM>The SID of the Message resource to update.
^IM[0-9a-fA-F]{32}$
34
34
Body
type: stringThe message to send to the channel. Can be an empty string or null
, which sets the value as an empty string. You can send structured data in the body by serializing it as a string.
DateCreated
type: string<date-time>The date, specified in ISO 8601 format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. This parameter should only be used when a Chat's history is being recreated from a backup/separate source.
DateUpdated
type: string<date-time>The date, specified in ISO 8601 format, to assign to the resource as the date it was last updated.
DELETE https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}
The {ChannelSid}
value can be the Channel resource's sid
or unique_name
.
X-Twilio-Webhook-Enabled
type: enum<string>The X-Twilio-Webhook-Enabled HTTP request header
true
false
ServiceSid
type: SID<IS>The SID of the Service to delete the Message resource from.
^IS[0-9a-fA-F]{32}$
34
34
ChannelSid
type: stringThe SID of the Channel the Message resource to delete belongs to. This value can be the Channel resource's sid
or unique_name
.
Sid
type: SID<IM>The SID of the Message resource to delete.
^IM[0-9a-fA-F]{32}$
34
34