Conversations API (v2) - Communication endpoints
Legal information
Conversation Orchestrator, including the APIs, may use artificial intelligence or machine learning technologies and is subject to the terms of the Predictive and Generative AI/ML Features Addendum. For details on AI usage and data, see the AI Nutrition Facts for Real-Time Transcription and Conversation Relay.
Conversation Orchestrator is not a HIPAA Eligible Service or PCI compliant and should not be enabled in workflows that are subject to HIPAA or PCI.
A communication is the smallest unit of interaction within a conversation. Each communication represents a single event—such as an SMS message or a voice utterance.
Create Communication
List Communications
Fetch Communication
POST/v2/Conversations/{ConversationSid}/Communications
Base url: https://conversations.twilio.com (base url)
Create a Communication.
application/jsonCreated
Conversation ID.
conv_conversation_01k1etk2y5f1y9fpe2epfdtvv2{"address":"+18005550100","channel":"SMS","participantId":"conv_participant_01k1etx3jbfx88476ccja0889c"}The content of the Communication using type field for discrimination.
External resource identifier for this Communication (e.g. MessageSid for SMS/RCS/WhatsApp, TranscriptionSid + MessageIndex for Voice). When set, used for Communication deduplication/uniqueness within a Conversation.
SM12345678901234567890123456789012Min length: 1Timestamp when this Communication was created.
2023-07-01T12:15:00ZTimestamp when this Communication was last updated.
2023-07-01T12:15:00ZISO 8601 timestamp when the communication occurred.
2023-07-01T12:15:00Z1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createCommunicationInConversation() {11const communication = await client.conversations.v212.communications("ConversationSid")13.create({14author: {15address: "address",16channel: "VOICE",17participantId: "participantId",18},19content: {20type: "TEXT",21text: "text",22},23recipients: [24{25address: "address",26channel: "VOICE",27participantId: "participantId",28},29],30});3132console.log(communication.id);33}3435createCommunicationInConversation();
Response
1{2"accountId": "ZGkrHSypTsudrGkmdpJJ",3"author": {4"address": "address",5"channel": "VOICE",6"participantId": "participantId"7},8"channelId": "channelId",9"content": {10"type": "TEXT",11"text": "text"12},13"conversationId": "conversationId",14"createdAt": "2009-07-06T20:30:00Z",15"id": "id",16"occurredAt": "2009-07-06T20:30:00Z",17"recipients": [18{19"address": "address",20"channel": "VOICE",21"participantId": "participantId"22}23],24"resourceId": "resourceId",25"updatedAt": "2009-07-06T20:30:00Z"26}
GET/v2/Conversations/{ConversationSid}/Communications
Base url: https://conversations.twilio.com (base url)
Retrieve a list of Communications in a Conversation.
Maximum number of items to return
50Example: 50Minimum: 1Maximum: 1000Page token for pagination
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listCommunicationByConversation() {11const communications = await client.conversations.v212.communications("ConversationSid")13.list({ limit: 20 });1415communications.forEach((c) => console.log(c.id));16}1718listCommunicationByConversation();
Response
1{2"communications": [3{4"id": "id",5"conversationId": "conversationId",6"accountId": "accountId",7"author": {8"address": "address",9"channel": "SMS",10"participantId": "participantId"11},12"content": "cannot-guess",13"channelId": "channelId",14"resourceId": "resourceId",15"recipients": [16{17"address": "address",18"channel": "SMS",19"participantId": "participantId",20"deliveryStatus": "INITIATED"21}22],23"createdAt": "2009-07-06T20:30:00Z",24"updatedAt": "2009-07-06T20:30:00Z",25"occurredAt": "2009-07-06T20:30:00Z"26}27],28"meta": {29"key": "key",30"pageSize": 42,31"previousToken": "previousToken",32"nextToken": "nextToken"33}34}
GET/v2/Conversations/{ConversationSid}/Communications/{Sid}
Base url: https://conversations.twilio.com (base url)
Retrieve a Communication.
OK
Conversation ID.
conv_conversation_01k1etk2y5f1y9fpe2epfdtvv2{"address":"+18005550100","channel":"SMS","participantId":"conv_participant_01k1etx3jbfx88476ccja0889c"}The content of the Communication using type field for discrimination.
External resource identifier for this Communication (e.g. MessageSid for SMS/RCS/WhatsApp, TranscriptionSid + MessageIndex for Voice). When set, used for Communication deduplication/uniqueness within a Conversation.
SM12345678901234567890123456789012Min length: 1Timestamp when this Communication was created.
2023-07-01T12:15:00ZTimestamp when this Communication was last updated.
2023-07-01T12:15:00ZISO 8601 timestamp when the communication occurred.
2023-07-01T12:15:00Z1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchCommunication() {11const communication = await client.conversations.v212.communications("ConversationSid", "Sid")13.fetch();1415console.log(communication.id);16}1718fetchCommunication();
Response
1{2"accountId": "ZGkrHSypTsudrGkmdpJJ",3"author": {4"address": "address",5"channel": "SMS",6"participantId": "participantId"7},8"channelId": "channelId",9"content": {},10"conversationId": "conversationId",11"createdAt": "2009-07-06T20:30:00Z",12"id": "id",13"occurredAt": "2009-07-06T20:30:00Z",14"recipients": [15{16"address": "address",17"channel": "SMS",18"participantId": "participantId",19"deliveryStatus": "INITIATED"20}21],22"resourceId": "resourceId",23"updatedAt": "2009-07-06T20:30:00Z"24}