Twilio Segment Personas is now part of Segment’s Twilio Engage product offering.
It’s no mystery that customer expectations are at an all-time high today and that companies that execute real-time personalization strategies delight customers, increase conversion rates, and build brand loyalty.
Still, delivering thoughtful, personalized experiences in real-time remains a dream for most companies. It’s a difficult concept to successfully execute and there aren’t (yet) a plethora of off-the-shelf solutions available to help.
This is especially true in the world of customer support. Many, if not most, consumers have likely experienced long wait times and lengthy back-and-forth making sure support agents have the right information to help. It’s frustrating for customers and agents alike.
With Twilio Flex and Segment Personas, you have all the building blocks you need to implement a next-generation, hyper-personalized contact center. Agents can instantly view a customer’s engagement history across channels and quickly address the customer’s needs. Consumers can look forward to a fast, efficient service.
Step 1: Set up Segment Personas
If you are an existing customer of Segment, login to your workspace, navigate to the Explorer tab in the Personas module. Click on a profile to see the full view of the customer’s Computed Traits, Audience Membership information, Event history, and Identity Graph. All of this data is available via the Profile API, so you can get a sense of the type of information we’ll be able to load into our Flex instance!
Make sure that you take note of the space ID from the Personas API console; you will need this value later on in the recipe when setting up the Twilio Function.
Step 2: Set up Twilio Flex
Next, make sure that you have an instance of Twilio Flex ready to go. You can sign up for a free instance here. The Flex documentation provides a step-by-step guide for setting up a Flex instance if you don’t have one yet.
Step 3: Create a Twilio Function to call the Segment Profile API
Time to integrate Segment and Twilio together!
Generate a Segment Profile API Token: If you haven’t already, generate an API token for Segment’s Profile API. Instructions for creating a token can be found here.
Set up your Twilio Function: In order to make Personas data available in Flex, we are going to fetch the user data by deploying a Twilio Function. Create a new function and give it a name like `/fetch-data`.
With our Segment Profile API token handy and our Twilio Function environment set up, you’re ready to fetch behavioral data from Segment Personas.
Now edit your `fetch-data` Twilio Function to make the API request. You may simply copy the code below, and edit it according to your needs. Make sure you’ve saved your API token and spaceID as Environment Variables Twilio’s Functions environment.
💡 You may also copy the code from a sample code snippet gist or your Twilio function to fetch user data from Segment.
Step 4: Invoke the Function from your Flex environment
Save your Function and hit “Deploy All”. Congrats! You have a live Twilio Function.
Next, you will call it to load data into your Flex Plugin. You may copy and paste the below code into your Flex plugin.
***Please note that you will need to update the URL on line 10 with the URL from your own Twilio Function. You can find the URL for your Twilio Function by clicking the options button and choosing “Copy URL”.
💡You may also use this sample code snippet to load user data into your Flex plugin.
Step 5: Surface customer data to your Customer Support agents
At this point, you’ve brought the data from Segment’s User Explorer (that you viewed in Step 1) full circle and into your Twilio Flex Contact Center.
With Personas data loaded into Flex, contact center agents now have a complete view of the customer available at their fingertips.
Agents will now be able to:
Quickly identify that the customer hasn’t yet viewed an important piece of documentation, and can seamlessly point them to the right material, in real-time.
See the customer’s LTV, purchase history, and intelligently route their request using this information.
Understand where customers are stuck in their journey and provide fast, targeted support in response
To recap, here’s what we learned to accomplish:
Used the Segment Profile API to create a single view of your customer behavior
Used Twilio Functions to query customer data in real-time from Segment’s Profile API
Built a Flex Plugin to enrich your Cloud Contact Center with real-time customer data.