Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Manage Conversations SMS Addresses


(information)

Info

Flex Conversations requires Flex UI 2.0. If you are on Flex UI 1.x, please refer to Chat and Messaging pages.

(information)

Info

This guide requires Flex UI 2.0. If you are on Flex UI 1.x, refer to Handle an SMS contact with Legacy-based Messaging.

Flex uses Addresses to describe how new Conversations should be handled and connected to Flex. Conversations Addresses inform the Conversation Service to auto-create a new Conversation for messages that do not belong to an existing Conversation. Once a Conversation is created, all new messages from the same source to the same destination will be routed to the newly created Conversation.

The simplest (and the default) way to route incoming SMS messages for a Phone Number into Flex is to:

  • Buy a Phone Number
  • Create a Conversations Address for the Phone Number via the Flex Console or the API
  • Set the Flex integration on the Address to use the Studio Flow you created earlier

Follow these steps to set up a new SMS Address with the aforementioned configuration via the Flex Console.


Buy a Phone Number

buy-a-phone-number page anchor

If you haven't purchased an SMS-enabled Phone Number yet, or would like to configure a new one, navigate to Phone Numbers > Manage > Buy a number(link takes you to an external page).


Configure your Phone Number for the SMS channel

configure-your-phone-number-for-the-sms-channel page anchor

Under Phone Numbers > Manage > Active numbers(link takes you to an external page), find the number you wish to configure and open it.

For correct operation, make sure your Phone Number Messaging is configured as follows (this should also be the default state):

  • Make sure no Messaging Service is selected in the dropdown. If there is one configured, remove it. (For advanced configuration with Messaging Service refer here .)
  • Make sure the "A message comes in" webhook handler is set to blank (""). The default handler will respond with a default message for every inbound SMS which is not desired.
Phone Number Messaging configuration.

Phone Number configuration for Flex Conversations

(warning)

Warning

If you specify a webhook handler for "A message comes in", it will be executed in parallel to executing the auto-creation functionality defined in the Conversation address. This is most probably undesired for production accounts. Unless you have an advanced use case and know what you're doing, it is recommended to leave the webhook handler blank.


Create an SMS Address for your Phone Number

create-an-sms-address-for-your-phone-number page anchor

via the Flex Console

via-the-flex-console page anchor

To create an Address for your new Phone Number:

  1. Navigate to Flex Console > Manage > Messaging(link takes you to an external page). Select the SMS Numbers tab. (Alternatively you can click "+ Create new SMS Address" on the Addresses tab, and search for your Phone Number on the Create Address form).

    Create an Address for a Phone Number.
  2. Search for or click "+ Create new SMS Address" in the Status field of your unregistered Phone Number. Previously configured Phone Numbers will have an "Address created" indicator.
  3. You can optionally enter a friendly name.
  4. Configure the integration to Flex - either by using Studio Flow you created earlier or your own endpoint URL for the webhook . To learn more about configuring Studio Flows, see Configure pre-agent workflow with Studio.
  5. Click Submit to save your new Flex SMS Address.

You can create, edit or delete Flex SMS Addresses at any point using the Console.

The Conversations API's Address Configuration Resource allows you to create and manage SMS addresses for your Twilio account. On address creation, you can specify autocreation of a Conversation upon receipt of an inbound message. The following example shows you the programmatic version of our Console example using the Studio flow integration with a retry count. To learn more about the different resource properties, see Address Configuration Resource.

Create an SMS Address via the API

create-an-sms-address-via-the-api page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_17
// Download the helper library from https://www.twilio.com/docs/node/install
_17
// Find your Account SID and Auth Token at twilio.com/console
_17
// and set the environment variables. See http://twil.io/secure
_17
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_17
const authToken = process.env.TWILIO_AUTH_TOKEN;
_17
const client = require('twilio')(accountSid, authToken);
_17
_17
client.conversations.v1.addressConfigurations
_17
.create({
_17
'autoCreation.enabled': true,
_17
'autoCreation.type': 'studio',
_17
'autoCreation.studioFlowSid': 'FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_17
'autoCreation.studioRetryCount': 3,
_17
type: 'sms',
_17
address: '+13115552368'
_17
})
_17
.then(address_configuration => console.log(address_configuration.sid));

Output

_22
{
_22
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_22
"sid": "IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_22
"address": "+13115552368",
_22
"type": "sms",
_22
"friendly_name": "My Test Configuration",
_22
"address_country": "CA",
_22
"auto_creation": {
_22
"enabled": true,
_22
"type": "webhook",
_22
"conversation_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_22
"webhook_url": "https://example.com",
_22
"webhook_method": "POST",
_22
"webhook_filters": [
_22
"onParticipantAdded",
_22
"onMessageAdded"
_22
]
_22
},
_22
"date_created": "2016-03-24T21:05:50Z",
_22
"date_updated": "2016-03-24T21:05:50Z",
_22
"url": "https://conversations.twilio.com/v1/Configuration/Addresses/IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_22
}

For deleting an SMS address via the API, see Delete Address Configuration.


You are now ready to try your SMS channel:

  1. Go to Flex > Overview(link takes you to an external page) and click Launch Flex
  2. Log in and change your activity to Active
  3. From your mobile phone, send an SMS to the number you just configured
  4. The Flex UI will display a new task which you can accept to view the inbound message

Under the hood: Conversations

under-the-hood-conversations page anchor
Conversations schema.

Under the hood, Flex uses Conversations to send the messages back and forth between the end-customer and the agent. If a Conversations Address is created for a Phone Number (with autocreation set to true), that Address's configuration will be used to handle new inbound messages to that Phone Number.

The Phone Number's "A message comes in" handler is not used when this Phone Number has a Conversations Address where autocreation is set to true.


Rate this page: