Connect an Existing Segment Workspace
If you already have a Segment workspace, you can use a new or pre-existing Segment Unify space to connect your customer data to Unified Profiles.
Your new Segment workspace must be on one of Segment’s Customer Data Platform (CDP) plans. To upgrade to a CDP plan, communicate with your sales contact or request a demo from Segment’s sales team.
Step 1: Set up your Unify space
This section is about setting up a new Segment Unify space to link to Twilio. If you have an existing Segment Unify space you’d like to use, proceed directly to Connect your Unify space to Twilio.
Your Unify space acts as a central location for your Profiles, or collated information that you have for each of your customers.
Segment recommends connecting a development or sandbox Unify space to Twilio before creating a production Unify space.
To create a Segment Unify space:
- In Segment, navigate to Unify and click Create Space.
- Enter a name for your space, select Dev space, then click Create space.
- Click Set identity rules to set identity rules for your space.
- Navigate to the settings of your Unify space and select API access.
- Copy the Segment Unify Space ID to a safe location, as you’ll need this value to connect your Unify space to Twilio.
- Click Generate Token. Enter a name for your Profile API token, enter the password for your Twilio account, then click Generate token.
- Copy your Profile API token to a safe location and click the I have written down this access token checkbox, then click Done.
Step 2: Connect your Unify space to Twilio
To connect your Unify space to Twilio, follow the Set up your Segment space instructions in the Unified Profiles documentation.
By connecting your Unify space to Twilio, you can create a Unified Profiles Service and can use Unified Profiles in Flex and Studio.
Before leaving Segment, note the following information about your Segment workspace and Unify space:
- Workspace ID: Located in the General Settings section of your Segment workspace
- Workspace slug: Located in the General Settings section of your Segment workspace
- Unify space slug: Located in the address bar between
/spaces/
and/explorer/
. For example:app.segment.com/workspace-slug/unify/spaces/unify-space-slug/explorer
- Unify space ID: Located in the API access settings for your Unify space (Unify > Unify settings > API access)
- Profile API access token: Either the access token you created in Step 1: Set up your Unify Space, or for existing Unify spaces, a new token.
Twilio Flex customers have their Flex interactions added to Unify as a customer data source. The customer interactions automatically update the Profiles you have for each of your customers.
Twilio Studio customers have profile read access through the Search for a Profile widget and profile write access using Update Profile Traits widget for chatbot and IVR workflows.
Step 3: Connect additional customer data sources to Unify
After you’ve connected your Unify space to Twilio, you can connect additional data sources to your Segment workspace. For example, you can add a CRM, like Salesforce or Hubspot, as a data source to create rich, personalized support interactions for your agents in Twilio Flex, implement the Analytics.js library on your website to collect more granular data about the way your customers interact with your web properties, or link your helpdesk to your IVR workflow with Twilio Studio to gather a complete view of the reasons your customers are reaching out for support. If a data warehouse is your single source of truth about your customers, use Reverse ETL to import that data into Twilio to facilitate personalized interactions across your customer touchpoints, then use Profiles Sync to hydrate your Profiles with information gathered during customer interactions.
This section is about setting up sources and destinations to link to your Unify space. If you have an existing Segment Unify space with these connections that you’d like to use, proceed directly to Optional: Create computed traits and Predictions.
Connect a cloud app or library source
To connect a cloud app or library source:
- From the catalog page in your workspace, select your preferred business tool and click Add Source.
- Enter a name for your source, fill in any additional settings, and click Add Source.
Set up Reverse ETL
Reverse ETL (Extract, Transform, Load) sources extract object and event data from a data warehouse using a query you provide and sync the data to your third party destinations. For example, with Reverse ETL, you can sync records from Snowflake, a data warehouse, to Flex, a digital engagement center solution. Reverse ETL supports customer profile data, subscriptions, product tables, shopping cart tables, and more.
To extract customer data from your warehouse, you must:
- Add a Reverse ETL source: You can use your Azure, BigQuery, Databricks, Postgres, Redshift, or Snowflake data warehouse as a data source.
- Add a Segment Profiles destination: When you connect a Segment Profiles destination to your Reverse ETL source, you can send your warehouse data back to Segment to create and update Profiles that can then be accessed through the Profile API and activated within Unified Profiles.
Add a Reverse ETL source
To add a Reverse ETL source:
- In the Reverse ETL section of the Sources catalog, select your preferred data warehouse and click Add Source.
- Give your source a name and enter the credentials for a user with read and write access to your database.
- Click Test Connection. If Segment can successfully connect to your warehouse, click Add Source.
- On the Models page, click Add Model.
- Select SQL Editor and click Next.
- Create a SQL query that defines your model. After you’ve created a model, Segment uses your model to map data to your Reverse ETL destinations.
- Click Preview to return 10 records from your warehouse. When you’ve verified that your records return as expected, click Next.
- Enter a name for your SQL model and click Create Model.
Add a Segment Profiles destination
Create a Segment Profiles destination to add a mapping to your Reverse ETL source. To add a Segment Profiles destination:
- From the catalog page in your workspace, select the Segment Profiles destination and click Add destination.
- On the Choose Data Source page, select your data source you set up in the previous steps and click Next.
- Enter a name for your destination and click Create destination.
- On the Mappings tab, click Add Mapping.
- Search for the model you created when you added your Reverse ETL source, select Send Identify and click Create Mapping.
-
You’re redirected to the Edit Mapping page. Under the Select mappings section, map event fields from your data source to the pre-filled values that Segment expects to receive. Add additional traits by entering your properties and event names in the Traits section. Clicking into an event field lets you search your destination’s record fields.
(Optional): To test your mapping, click the Test Mapping button. - When you’ve finished mapping all relevant event fields and verified that your test record contains all of the relevant user information, click Save Mapping.
- You’re returned to the Mappings page for your Segment Profiles destination. Under the Mapping status column, enable the mapping you created in the previous step.
Connect a warehouse for Profiles Sync
Profiles Sync connects identity-resolved customer profiles to a data warehouse of your choice.
To set up Profiles Sync, complete the instructions in the Set up Profiles Sync documentation.
Optional: Create Computed Traits and Predictions
After linking your customer data to Twilio through a Unify space, you can set up computed traits and Predictions to better understand your users.
Flex customers must complete an interaction in Flex before creating computed traits in Segment
Before you can create computed traits in Segment, you must connect your Unify space to Flex and then complete a customer interaction in Flex.
Computed traits
Computed traits allow you to quickly create user or account-level calculations that Segment keeps up-to-date over time. These computations are based on the events and event properties that you are sending through Segment.
To create a computed trait:
- Navigate to the Unify space you linked to Twilio and click Traits.
- Click Create computed trait.
- Select the type of event you’d like to create and click Next.
- Select an event to be the base of your computed trait.
- Add conditions and optionally, an event property.
- Conditions: These restrict the messages considered when calculating the final value of a computed trait. For more information, see the Conditions documentation.
- Event properties: These refine the computed traits to include only the specified properties.
- Verify that your trait contains at least one member by clicking the Preview Trait button.
- When you’ve verified that your trait contains at least one member, click Next.
- On the Select Destinations page, don’t add a destination. Instead, click Next.
- Enter a name for your trait and click Create Trait.
Computed Traits for Flex
Segment recommends the following computed traits created using Flex customer interaction data:
- Total inbounds: Number of inbound attempts resulting in customer engagement
- Frequent inbound channel: Identifies the user’s most frequently used channel of communication
Other computed traits that might be helpful include:
- Total outbounds: Number of outbound attempts resulting in customer engagement
- Last known service agent: Identifies the last agent to allow connecting to the same agent
- Last interaction duration: The duration (in seconds) of the customer’s last interaction with an agent
- Sentiment in last interaction: AI-inferred sentiment in last interaction
Total inbounds
Create an Event counter trait based on the “Flex - Engagement Initiated” event and add the following:
- Event property: direction
- Operator: equals
- Value: Inbound
Frequent inbound channel
Create a Most frequent trait based on the “Flex - Engagement Initiated” event and add the following:
- Event property: direction
- Operator: equals
- Value: Inbound
Add the following event property:
- Event property: channelType
- Value: Text
And add a Minimum frequency of 2.
Total outbounds
Create an Event counter trait based on the “Flex - Engagement Initiated” event and add the following:
- Event property: direction
- Operator: equals
- Value: Outbound
Last known service agent
Create a Last trait based on the “Flex - Engagement Initiated” event and add the following:
- Event property: lastKnownAgentWorkerSid
- Value: Text
Last interaction duration
Create a Last trait based on the “Flex - Engagement Initiated” event and add the following:
- Event property: duration
- Value: Number(100)
Sentiment in last interaction
Create a Last trait based on the “Flex - Engagement Completed” event and add the following:
- Event property: sentiment
- Value: Text
If you have the Twilio Engage add-on, you can use Audiences to build a cohort of Profiles that all share a computed trait.
For example, you could personalize the marketing your customers receive by creating an Audience of the Profiles that have a frequent inbound channel computed trait of email
and sending those customers a promotion over email for your newest product.
Predictions
Predictions, Segment’s artificial intelligence and machine learning feature, lets you predict the likelihood that users will perform any event tracked in Segment. With Predictions, you can identify users with, for example, a high propensity to purchase, refer a friend, or use a promo code. Predictions also lets you predict a user’s lifetime value (LTV).
Segment recommends that you select the following Predictions for Unified Profiles:
For more information about Predictions, see the Predictions FAQ and Predictions Nutrition Facts Label.
Troubleshooting
You can use the following tools to debug issues you may encounter while configuring your Segment resources for Unified Profiles.
Source debugger
The Source debugger is a real-time tool that helps you confirm that API calls made from your website, mobile app, or servers arrive at your Segment source, so you can troubleshoot your Segment connections. With the debugger, you can check that calls send in the expected format without having to wait for any data processing.
For more information about the Source debugger, see the Source debugger documentation.
Delivery Overview
Delivery Overview is a visual observability tool designed to help Segment users diagnose event delivery issues for any cloud-streaming destination receiving events from cloud-streaming sources.
For more information about Delivery Overview, see the Delivery Overview documentation.
Profile explorer
Use the Profile explorer to view all user data, including their event history, traits, and identifiers. With the Profile explorer, you have a complete view of your customers.
For more information about the Profile explorer, see the Profile explorer documentation.
This page was last modified: 13 Mar 2025
Need support?
Questions? Problems? Need more info? Contact Segment Support for assistance!