ConversationsConversation

Create Service Conversation

POST
/v1/Services/{ChatServiceSid}/Conversations

Create a new conversation in your service

Authorization

accountSid_authToken
AuthorizationBasic <token>

In: header

Path Parameters

ChatServiceSid*string

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

Match^IS[0-9a-fA-F]{32}$
Length34 <= length <= 34

Header Parameters

X-Twilio-Webhook-Enabled?ServiceConversationWebhookEnabledType

The X-Twilio-Webhook-Enabled HTTP request header

Value in

  • "true"
  • "false"

Request Body

application/x-www-form-urlencoded

FriendlyName?string

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

UniqueName?string

An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's sid in the URL.

Attributes?string

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.

MessagingServiceSid?string

The unique ID of the Messaging Service this conversation belongs to.

Match^MG[0-9a-fA-F]{32}$
Length34 <= length <= 34
DateCreated?string

The date that this resource was created.

Formatdate-time
DateUpdated?string

The date that this resource was last updated.

Formatdate-time
State?ServiceConversationState

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

Value in

  • "inactive"
  • "active"
  • "closed"
  • "initializing"
Timers.Inactive?string

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

Timers.Closed?string

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

Bindings.Email.Address?string

The default email address that will be used when sending outbound emails in this conversation.

Bindings.Email.Name?string

The default name that will be used when sending outbound emails in this conversation.

Response Body

application/json

curl -X POST "https://example.com/v1/Services/stringstringstringstringstringstri/Conversations" \  -H "Content-Type: application/x-www-form-urlencoded" \  -d 'FriendlyName=friendly_name&UniqueName=unique_name&Attributes=%7B+%22topic%22%3A+%22feedback%22+%7D&DateCreated=2015-12-16T22%3A18%3A37Z&DateUpdated=2015-12-16T22%3A18%3A38Z&MessagingServiceSid=MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&State=inactive&Timers.Inactive=PT1M&Timers.Closed=PT10M'

{  "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "friendly_name": "friendly_name",  "unique_name": "unique_name",  "attributes": "{ \"topic\": \"feedback\" }",  "date_created": "2015-12-16T22:18:37Z",  "date_updated": "2015-12-16T22:18:38Z",  "state": "inactive",  "timers": {    "date_inactive": "2015-12-16T22:19:38Z",    "date_closed": "2015-12-16T22:28:38Z"  },  "bindings": {},  "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",  "links": {    "participants": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",    "messages": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",    "webhooks": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks",    "export": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Export"  }}