Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Conversation Resource

A Conversation is a unique thread of a conversation.

Each Conversation includes a list of current Participants and the Messages that they have sent amongst each other.

API Base URL

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

https://conversations.twilio.com/v1

Conversation properties

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

The unique id of the Account responsible for this conversation.

chat_service_sid
sid<IS> Not PII

The unique id of the Chat Service this conversation belongs to.

messaging_service_sid
sid<MG> Not PII

The unique id of the SMS Service this conversation belongs to.

sid
sid<CH> Not PII

A 34 character string that uniquely identifies this resource.

friendly_name

The human-readable name of this conversation, limited to 256 characters. Optional.

attributes

An optional 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.

state
enum:state Not PII

Current state of this conversation. Can be either active, inactive or closed and defaults to active

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.

timers
object Not PII

Timer date values representing state update for this conversation.

url
url Not PII

An absolute URL for this conversation.

links
uri_map Not PII

Absolute URLs to access the Participants of this Conversation.

Create a Conversation resource

post
https://conversations.twilio.com/v1/Conversations
Parameters
Parameters in REST API format
friendly_name
Optional
post string PII MTL: 120 DAYS

The human-readable name of this conversation, limited to 256 characters. Optional.

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.

messaging_service_sid
Optional
post sid<MG> Not PII

The unique id of the SMS Service this conversation belongs to.

attributes
Optional
post string PII MTL: 120 DAYS

An optional 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.

state
Optional
post ienum:state Not PII

Current state of this conversation. Can be either active, inactive or closed and defaults to active

timers.inactive
Optional
post string Not PII

ISO8601 duration when conversation will be switched to inactive state. Minimum value for this timer is 1 minute.

timers.closed
Optional
post string Not PII

ISO8601 duration when conversation will be switched to closed state. Minimum value for this timer is 10 minutes.

Example 1
        
        
        
        

        Fetch a Conversation resource

        get
        https://conversations.twilio.com/v1/Conversations/{Sid}

        You can fetch a Conversation by providing your account credentials and the conversation SID (provided when the Conversation is created).

        The most valuable part of the Conversation resource itself is the attributes key, which includes metadata attached to the conversation from the moment of its creation.

        The other relevant parts of a Conversation include its Participants (the entities who are currently conversing) and the Messages they've sent. Both of these are linked directly from the top-level url key.

        Parameters
        Parameters in REST API format
        sid
        Path
        get sid<CH> Not PII

        A 34 character string that uniquely identifies this resource.

        Example 1
              
              
              
              
              Fetch Conversation by SID

              Fetch Conversation

              Fetch Conversation by SID

              Read multiple Conversation resources

              get
              https://conversations.twilio.com/v1/Conversations
              Example 1
                    
                    
                    
                    

                    Update Conversation

                    post
                    https://conversations.twilio.com/v1/Conversations/{Sid}

                    The core definition of any Conversation can be modified on the fly. Update a Conversation to attach metadata that you extract on the fly (e.g. "customer-loyalty-status": "gold", or "aml-risk-level": "heightened"), or to correct mistakes manually.

                    Parameters
                    Parameters in REST API format
                    sid
                    Path
                    post sid<CH> Not PII

                    A 34 character string that uniquely identifies this resource.

                    friendly_name
                    Optional
                    post string PII MTL: 120 DAYS

                    The human-readable name of this conversation, limited to 256 characters. Optional.

                    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.

                    attributes
                    Optional
                    post string PII MTL: 120 DAYS

                    An optional 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.

                    messaging_service_sid
                    Optional
                    post sid<MG> Not PII

                    The unique id of the SMS Service this conversation belongs to.

                    state
                    Optional
                    post ienum:state Not PII

                    Current state of this conversation. Can be either active, inactive or closed and defaults to active

                    timers.inactive
                    Optional
                    post string Not PII

                    ISO8601 duration when conversation will be switched to inactive state. Minimum value for this timer is 1 minute.

                    timers.closed
                    Optional
                    post string Not PII

                    ISO8601 duration when conversation will be switched to closed state. Minimum value for this timer is 10 minutes.

                    Example 1
                          
                          
                          
                          
                          Update a Conversation's property

                          Update Conversation

                          Update a Conversation's property

                          Delete a Conversation resource

                          delete
                          https://conversations.twilio.com/v1/Conversations/{Sid}
                          Parameters
                          Parameters in REST API format
                          sid
                          Path
                          delete sid<CH> Not PII

                          A 34 character string that uniquely identifies this resource.

                          Example 1
                                
                                
                                
                                
                                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 browsing the Twilio tag on Stack Overflow.