Menu

Expand
Rate this page:

Service-Scoped Conversation Message Resource

Use the Service-scoped Conversation Message resource to interact with messages in Conversations that belong to a non-default, service-scoped Conversation resource.

Please see the Conversation Message Resource API Reference page for Messages that belong to Conversations in the default Conversation Service.

API Base URL

All URLs in the reference documentation use the following base URL:

https://conversations.twilio.com/v1

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:

GET /v1/Services/ISxx/Conversations/CHxx/Messages

Service-Scoped Conversation Message Properties

Resource Properties in REST API format
account_sid
sid<AC> Not PII

The unique ID of the Account responsible for this message.

chat_service_sid
sid<IS> Not PII

The SID of the Conversation Service the Participant resource is associated with.

conversation_sid
sid<CH> Not PII

The unique ID of the Conversation for this message.

sid
sid<IM> Not PII

A 34 character string that uniquely identifies this resource.

index
integer Not PII

The index of the message within the Conversation.

author

The channel specific identifier of the message's author. Defaults to system.

body

The content of the message, can be up to 1,600 characters long.

media
object[] PII MTL: 30 DAYS

An array of objects that describe the Message's media, if the message contains media. Each 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.

attributes

A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned.

participant_sid
sid<MB> Not PII

The unique ID of messages's author participant. Null in case of system sent message.

date_created
date_time<iso8601> Not PII

The date that this resource was created.

date_updated
date_time<iso8601> Not PII

The date that this resource was last updated. null if the message has not been edited.

delivery
object Not PII

An object that contains the summary of delivery statuses for the message to non-chat participants.

url
url Not PII

An absolute API resource URL for this message.

links
uri_map Not PII

Contains an absolute API resource URL to access the delivery & read receipts of this message.

content_sid
sid<HX> Not PII

The unique ID of the multi-channel Rich Content template.

Create a Service-Scoped Conversation Message resource

post
https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages
Parameters
Parameters in REST API format
chat_service_sid
Path
post sid<IS> Not PII

The SID of the Conversation Service the Participant resource is associated with.

conversation_sid
Path
post sid_like<CH> Not PII

The unique ID of the Conversation for this message.

author
Optional
post string PII MTL: 30 DAYS

The channel specific identifier of the message's author. Defaults to system.

body
Optional
post string PII MTL: 30 DAYS

The content of the message, can be up to 1,600 characters long.

date_created
Optional
post date_time<iso8601> Not PII

The date that this resource was created.

date_updated
Optional
post date_time<iso8601> Not PII

The date that this resource was last updated. null if the message has not been edited.

attributes
Optional
post string PII MTL: 30 DAYS

A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned.

media_sid
Optional
post sid<ME> Not PII

The Media SID to be attached to the new Message.

content_sid
Optional
post sid<HX> Not PII

The unique ID of the multi-channel Rich Content template, required for template-generated messages. Note that if this field is set, Body and MediaSid parameters are ignored.

content_variables
Optional
post string PII MTL: 30 DAYS

A structurally valid JSON string that contains values to resolve Rich Content template variables.

x_twilio_webhook_enabled
Header
post ienum:webhook_enabled_type Not PII

The X-Twilio-Webhook-Enabled HTTP request header

Example 1
Loading Code Sample...
        
        

        Create Message

        Fetch a Service-Scoped Conversation Message resource

        get
        https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{Sid}
        Parameters
        Parameters in REST API format
        chat_service_sid
        Path
        get sid<IS> Not PII

        The SID of the Conversation Service the Participant resource is associated with.

        conversation_sid
        Path
        get sid_like<CH> Not PII

        The unique ID of the Conversation for this message.

        sid
        Path
        get sid<IM> Not PII

        A 34 character string that uniquely identifies this resource.

        Example 1
        Loading Code Sample...
              
              

              Fetch Message

              Read all Service-Scoped Conversation Message resources

              get
              https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages
              Parameters
              Parameters in REST API format
              chat_service_sid
              Path
              get sid<IS> Not PII

              The SID of the Conversation Service the Participant resource is associated with.

              conversation_sid
              Path
              get sid_like<CH> Not PII

              The unique ID of the Conversation for messages.

              order
              Optional
              get ienum:order_type Not PII

              The sort order of the returned messages. Can be: asc (ascending) or desc (descending), with asc as the default.

              Example 1
              Loading Code Sample...
                    
                    

                    Read Message

                    Update a Service-Scoped Conversation Message resource

                    post
                    https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{Sid}
                    Parameters
                    Parameters in REST API format
                    chat_service_sid
                    Path
                    post sid<IS> Not PII

                    The SID of the Conversation Service the Participant resource is associated with.

                    conversation_sid
                    Path
                    post sid_like<CH> Not PII

                    The unique ID of the Conversation for this message.

                    sid
                    Path
                    post sid<IM> Not PII

                    A 34 character string that uniquely identifies this resource.

                    author
                    Optional
                    post string PII MTL: 30 DAYS

                    The channel specific identifier of the message's author. Defaults to system.

                    body
                    Optional
                    post string PII MTL: 30 DAYS

                    The content of the message, can be up to 1,600 characters long.

                    date_created
                    Optional
                    post date_time<iso8601> Not PII

                    The date that this resource was created.

                    date_updated
                    Optional
                    post date_time<iso8601> Not PII

                    The date that this resource was last updated. null if the message has not been edited.

                    attributes
                    Optional
                    post string PII MTL: 30 DAYS

                    A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned.

                    x_twilio_webhook_enabled
                    Header
                    post ienum:webhook_enabled_type Not PII

                    The X-Twilio-Webhook-Enabled HTTP request header

                    Example 1
                    Loading Code Sample...
                          
                          

                          Update Message

                          Delete a Service-Scoped Conversation Message resource

                          delete
                          https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{Sid}
                          Parameters
                          Parameters in REST API format
                          chat_service_sid
                          Path
                          delete sid<IS> Not PII

                          The SID of the Conversation Service the Participant resource is associated with.

                          conversation_sid
                          Path
                          delete sid_like<CH> Not PII

                          The unique ID of the Conversation for this message.

                          sid
                          Path
                          delete sid<IM> Not PII

                          A 34 character string that uniquely identifies this resource.

                          x_twilio_webhook_enabled
                          Header
                          delete ienum:webhook_enabled_type Not PII

                          The X-Twilio-Webhook-Enabled HTTP request header

                          Example 1
                          Loading Code Sample...
                                
                                

                                Delete Message

                                Rate this page:

                                Need some help?

                                We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                                Loading Code Sample...
                                      
                                      
                                      

                                      Thank you for your feedback!

                                      Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                      Sending your feedback...
                                      🎉 Thank you for your feedback!
                                      Something went wrong. Please try again.

                                      Thanks for your feedback!

                                      thanks-feedback-gif