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

My Customers


In the Frontline mobile application, you can access a list of Customers and get their Customer Details. In order to populate the Customer Details and Customers List screens with data, the Frontline application needs information about your customers.


Configuring the CRM Callback URL

configuring-the-crm-callback-url page anchor

To grab the data for the Customers List and Customer Details screens, the app will make an API call to the configured CRM Callback URL to fetch customer data for each screen. Based on the Location parameter, your server can tell which information was requested.

Twilio Frontline diagram shows POST crm_callback_url and Customers data exchange with a customer database.

To configure the CRM Callback URL, open the Frontline console(link takes you to an external page) and set the CRM Callback URL configuration option to a URL that will return customer data in JSON format:

Configure callbacks page with CRM, Outgoing Conversations, and Templates callback URLs and options to reset or save settings.

For an example of a Customer object, check out the Node.js Quickstart section on populating the My Customers list.


Customer ID and Participant properties

customer-id-and-participant-properties page anchor

Customer objects returned from the CRM callback URL contain the property customer_id. This ID is an important part of the Frontline application as some features, such as Customer Details, rely on it. It's also a way to tie together the Conversations API and CRM data under the hood. A Customer ID is not restricted to any particular format, the only requirement is that it's unique.
An additional property of the Customer object is the Participant. The Participant resource allows the user to navigate from the conversation screen to the Customer Details screen, which shows individual information for that particular Customer.

(information)

Info

Each Customer Conversation Participant needs to have a configured customer_id attribute set on a participant each time a new conversation with a customer is created.


Responding to the CRM Callback

responding-to-the-crm-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 Frontline Integration Service. 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. Use this parameter to determine how to process a request.
WorkerstringThe app user identity

In what follows, we'll describe two possible actions: GetCustomerDetailsByCustomerId and GetCustomersList.

(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.


GetCustomerDetailsByCustomerId

getcustomerdetailsbycustomerid page anchor

Gets details for an individual Customer using the customer_id attribute.

Request parameters

Parameter nameTypeDescription
LocationstringAlways GetCustomerDetailsByCustomerId
CustomerIdstringCustomer Id provided by the server
WorkerstringThe app user identity

Response format

Parameter nameTypeDescription
objects.customerCustomerCustomer details to display. If some of the fields are missing, the line won't be rendered

JSON response example

1
{
2
"objects": {
3
"customer": {
4
"display_name": "Bobby S.",
5
"customer_id": "1",
6
"channels": [{ type: "sms", "value":"+123456789" }]
7
}
8
}
9
}

In App example

Customer details page showing Bobby S. with initials 'BS' and contact number +123456789.

Gets a list of Customers and returns them as an array of objects based on a worker identity.

Request parameters

Parameter nameTypeDescription
LocationstringAlways GetCustomersList
PageSizestringThe number of customers to return in a response
Anchorstring, optionalThe Customer ID of the last customer that was loaded
NextPageTokenstring, optionalA string for pagination. See Custom pagination, below
WorkerstringThe app user identity
Querystring, optionalFrontline user's search query in case it is a search request. See Customer search, below

Response format

Parameter nameTypeDescription
objects.customersArray<Customer>List of customers to display. For example: [{ display_name: ‘John D.', customer_id: '13' }]
objects.searchableBooleanWhether the integration service is handling search or not. See Customer search, below
objects.next_page_tokenstringA string for pagination which will be sent with the next request. See Custom pagination, below

JSON response example

1
{
2
"objects": {
3
"customers": [
4
{
5
"display_name":"Bobby S.",
6
"customer_id":"1"
7
}
8
]
9
}
10
}

The Frontline app has built-in search functionality which filters customers locally. We recommend implementing your own search functionality for better performance, especially if your Frontline users have more than 100 customers, or if you'd like to search across additional fields in your CRM.

Search bar under 'My Customers' with a contact named Bobby S.

Frontline uses the GetCustomerList location for searching customers with an additional Query parameter. Your integration service can interpret that as a search operation by checking for the existence of this parameter. If your integration service handles the search, the response should contain the property searchable and set it equal to true.

Response payload example

1
{
2
"objects": {
3
"customers":[
4
{
5
"display_name":"Bobby S.",
6
"customer_id":"1"
7
}
8
],
9
"searchable": true
10
}
11
}

Contact addresses and Phone Number Masking

contact-addresses-and-phone-number-masking page anchor

Phone number masking is a Frontline Administration feature that applies masking to the last four digits of any Channel Address supplied to Frontline from the CRM callback GetCustomerDetailsByCustomerId. Phone number masking applies to all channel addresses including phone numbers and WhatsApp numbers on the Frontline customer details screen.
In App example:

Customer details for Bobby S. with contact number partially hidden as +12345XXXX.

How to set up Phone Number Masking as an account owner or admin

how-to-set-up-phone-number-masking-as-an-account-owner-or-admin page anchor

You can follow the next steps to enable or disable Phone Number masking for all users in the account:

  1. Sign in to the Twilio Console(link takes you to an external page) as an admin with the privilege to edit account settings.
  2. In the Develop menu, navigate to the Frontline console(link takes you to an external page). Go to the Manage > Callbacks section.
  3. Under Contact phone number display setting, click Mask contact phone numbers to enable masking or click Show full contact phone numbers to disable masking.
  4. Click Save.
Configure callbacks interface for Frontline app with options for displaying or masking contact phone numbers.

If the Anchor-based pagination in the Frontline Integration Service (see customers.js(link takes you to an external page)) doesn't suit your needs, you can use the objects.next_page_token field to implement your custom pagination logic. It can be used for token/offset based pagination.
Example request

1
curl --location --request POST 'https://example.com/callbacks/crm' \
2
--header 'Content-Type: application/x-www-form-urlencoded' \
3
--data-urlencode 'Location=GetCustomersList' \
4
--data-urlencode 'Worker=alice' \
5
--data-urlencode 'PageSize=30'

Example response

1
{
2
"objects":{
3
"customers":[
4
{
5
"display_name":"Bobby S.",
6
"customer_id":"1"
7
}
8
...
9
],
10
"next_page_token": "PAGE_TWO_TOKEN"
11
}
12
}

If next_page_token is defined, the app adds the passed next page token as the NextPageToken attribute to the payload, instead of Anchor, to every consecutive request after the first page load.

1
curl --location --request POST 'https://example.com/callbacks/crm' \
2
--header 'Content-Type: application/x-www-form-urlencoded' \
3
--data-urlencode 'Location=GetCustomersList' \
4
--data-urlencode 'Worker=alice' \
5
--data-urlencode 'PageSize=30' \
6
--data-urlencode 'NextPageToken=PAGE_TWO_TOKEN'

Response:

1
{
2
"objects":{
3
"customers":[
4
{
5
"display_name":"John S.",
6
"customer_id":"31"
7
}
8
...
9
],
10
"next_page_token": "PAGE_THREE_TOKEN"
11
}
12
}