Conversation Orchestrator quickstart
In this quickstart, you'll create a conversation configuration with capture rules. Conversation Orchestrator then observes your existing Twilio traffic and groups matching messages and calls into conversations.
See Create conversations programmatically or Connect Conversations API (classic) for other ways to start using Conversation Orchestrator.
Voice transcription fees
When you use Conversation Orchestrator with the voice channel, Twilio transcribes your calls to populate the conversation. Transcription fees apply. For pricing details, see Twilio Voice pricing.
Complete the prerequisites:
- Create a Twilio account.
- Buy a voice- and SMS-enabled phone number.
- Store your Twilio credentials in environment variables.
A conversation configuration defines how Conversation Orchestrator groups your interaction traffic. To link conversations with customer profiles, you also need a memory store. Create both using the Console or the API.
To create a conversation configuration using the Twilio Console, follow these steps:
- Sign in to the Twilio Console.
- Go to Products & services > Conversation Orchestrator > Conversation configurations.
- Click Create a Conversation configuration.
- On the Name Configuration step, enter a name and description, and then click Next.
- On the Messaging and chat traffic step, click Next. This quickstart uses voice traffic, so no selections are needed here.
- On the Voice traffic step, do the following:
- Select the Set up automatic capture checkbox.
- From the Voice phone numbers list, select your Twilio phone number.
- Click Next.
- On the Configure lifecycle step, accept the default Basic lifecycle, select a "Closed" timeout value for each active channel, and then click Next.
- On the Enable Conversation Memory step, create a memory store:
- Click Create new memory store.
- In the Memory store name field, enter a name.
- Click Save.
- From the Memory store list, select the memory store you just created.
- Clear the Turn on observations and summaries checkbox.
- Click Next.
- On the Voice transcription step, review the transcription summary. If this is your first time using AI features on this account, select the Predictive and Generative AI/ML Features Addendum checkbox to agree to the terms.
- Click Next.
- On the Summary step, review your settings and click Create Conversation configuration.
- Copy the conversation configuration ID for use in the next steps.
Send an SMS from your Twilio phone number using the Programmable Messaging API:
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 at twilio.com/console5// Provision API Keys at twilio.com/console/runtime/api-keys6// and set the environment variables. See http://twil.io/secure7// For local testing, you can use your Account SID and Auth token8const accountSid = process.env.TWILIO_ACCOUNT_SID;9const apiKey = process.env.TWILIO_API_KEY;10const apiSecret = process.env.TWILIO_API_SECRET;11const client = twilio(apiKey, apiSecret, { accountSid: accountSid });1213async function createMessage() {14const message = await client.messages.create({15body: "Hello there",16from: "TWILIO_PHONE_NUMBER",17to: "TEST_PHONE_NUMBER",18});1920console.log(message.body);21}2223createMessage();
Replace TWILIO_PHONE_NUMBER with your Twilio phone number and TEST_PHONE_NUMBER with a test phone number. Conversation Orchestrator detects the message, creates a conversation, adds customer and agent participants, and records the message as a communication.
Conversation Orchestrator captures voice calls the same way it captures SMS messages.
- From your test phone number, call your Twilio phone number.
- When the call connects, say a few words so the call has content to transcribe.
- End the call.
Use the Conversation Orchestrator API to verify that your test communications are in a conversation.
To retrieve all your conversations, send a GET request:
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 at twilio.com/console5// Provision API Keys at twilio.com/console/runtime/api-keys6// and set the environment variables. See http://twil.io/secure7// For local testing, you can use your Account SID and Auth token8const accountSid = process.env.TWILIO_ACCOUNT_SID;9const apiKey = process.env.TWILIO_API_KEY;10const apiSecret = process.env.TWILIO_API_SECRET;11const client = twilio(apiKey, apiSecret, { accountSid: accountSid });1213async function listConversationByAccount() {14const conversations = await client.conversations.v2.conversations.list({15limit: 20,16});1718conversations.forEach((c) => console.log(c.id));19}2021listConversationByAccount();
The response includes a list of conversations. Note the id of the conversation you want to inspect.
To retrieve the list of participants in a conversation, send a GET request to the Participants endpoint:
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 at twilio.com/console5// Provision API Keys at twilio.com/console/runtime/api-keys6// and set the environment variables. See http://twil.io/secure7// For local testing, you can use your Account SID and Auth token8const accountSid = process.env.TWILIO_ACCOUNT_SID;9const apiKey = process.env.TWILIO_API_KEY;10const apiSecret = process.env.TWILIO_API_SECRET;11const client = twilio(apiKey, apiSecret, { accountSid: accountSid });1213async function listParticipantByConversation() {14const participants = await client.conversations.v215.participants("CONVERSATION_ID")16.list({ limit: 20 });1718participants.forEach((p) => console.log(p.id));19}2021listParticipantByConversation();
Replace CONVERSATION_ID with your conversation ID.
To see the messages in a conversation, send a GET request to the Communications endpoint:
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 at twilio.com/console5// Provision API Keys at twilio.com/console/runtime/api-keys6// and set the environment variables. See http://twil.io/secure7// For local testing, you can use your Account SID and Auth token8const accountSid = process.env.TWILIO_ACCOUNT_SID;9const apiKey = process.env.TWILIO_API_KEY;10const apiSecret = process.env.TWILIO_API_SECRET;11const client = twilio(apiKey, apiSecret, { accountSid: accountSid });1213async function listCommunicationByConversation() {14const communications = await client.conversations.v215.communications("CONVERSATION_ID")16.list({ limit: 20 });1718communications.forEach((c) => console.log(c.id));19}2021listCommunicationByConversation();
Replace CONVERSATION_ID with your conversation ID.
This endpoint returns a list of communications. The content property of each communication contains a transcription of your voice call or the body of your text message.
- Core concepts: Learn about the main objects in Conversation Orchestrator.
- Create conversations programmatically: Build conversations with the API or TwiML instead of capture rules.
- Troubleshooting: Resolve common errors.
- Conversation Memory: Use customer profiles to personalize interactions.
- Conversation Intelligence: Analyze your conversations with language operators.