Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Outgoing Conversations


Starting Outgoing Conversations

starting-outgoing-conversations page anchor

So far we have seen ways to programmatically create a new conversation by either processing an incoming message or doing a direct API call, but how can an app user do that? Twilio Frontline has a dedicated Outgoing Conversation callback for that. Whenever a user initiates a new conversation from the Customer Details screen, the app will make an API request to the configured callback URL to facilitate the process.

When a user initiates a new conversation, the app does the following:

  1. Creates a new conversation
  2. Calls an outgoing callback with GetProxyAddress location. In order to add a customer to conversation the app needs to know how they're in contact with — i.e. what phone number or WA number they reach out to at — your business.
  3. Adds a customer to the new conversation.
  4. Adds a worker to the new conversation.
  5. Navigates a user to the new conversation.
Twilio Frontline integration with Conversations API and customer via outgoing callback URL and Twilio number.

To configure it, open Frontline console(link takes you to an external page) and set the Outgoing Conversation Callback URL configuration option to a URL that will respond back with a proxy phone number.

Outgoing Conversation Callback URL.

Responding to Outgoing Conversation Callback

responding-to-outgoing-conversation-callback page anchor

When the Frontline application makes a POST HTTP request to your server, it includes information about the action that triggered the callback to your web application. Each action has its own Location type. The Location will be sent with the rest of the parameters in the request body in application/x-www-urlencoded format.

In addition to the location-specific parameters, each request also contains the following parameters and information:

Parameter nameTypeDescription
LocationstringA single callback URL might be used for different purposes. This parameter is meant to help to determine how to process a request
WorkerstringThe app user identity
(information)

Info

Frontline will send a request with Content-Type header of application/x-www-urlencoded and will expect a response with Content-Type header of application/json and a body based on the Location parameter.


The application needs to know a proxy address in order to add a customer as a participant to an outgoing conversation. See an example in src/routes/callbacks/outgoing-conversation.js file.

Request parameters:

Parameter nameTypeDescription
CustomerIdstringCustomer ID provided by the server
ChannelTypestringThe channel type. It can be sms, whatsapp, chat
ChannelValuestringThe channel address. Example: +123456789 or whatsapp:+123456789

Response format:

Parameter nameTypeDescription
proxy_addressstringA Twilio proxy number to be used in outgoing conversation

JSON response example:

1
{
2
"proxy_address": "+123456789"
3
}