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 in Flex.
Unified Profiles in Flex has limited source and destination support
Unified Profiles supports the following connections:
Sources: Salesforce, RETL sources (Postgres, Snowflake, Redshift, BigQuery)
Destinations: Postgres, Snowflake, Redshift, BigQuery
Prerequisites
- You must have requested access from the CustomerAI page in your Flex Console and been accepted into the Agent Copilot and Unified Profiles beta program.
- Your Segment workspace must be on the Business Tier plan with a Unify Plus entitlement. To upgrade to the Business Tier 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 Flex. If you have an existing Segment Unify space you’d like to use, proceed directly to Step 2: Connect your data to Unify. If your existing Unify space includes a Salesforce source, RETL source, and a Segment Profiles destination, proceed directly to Step 3: Connect your Unify space to Flex.
Segment recommends creating a development or sandbox Unify space, verifying that your profiles appear as you would expect, and then creating a production Unify space.
In order to create a Segment Unify space, your Segment workspace must be on the Business Tier plan with a Unify Plus entitlement. To upgrade to the Business Tier plan, communicate with your sales contact or request a demo from Segment’s sales team.
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.
- Set identity rules for your space by clicking Set identity rules.
- Connect a source to your Unify space by clicking Connect sources.
- Verify that your profiles appear as expected. When you’re confident in the data quality of your profiles, repeat steps 1-4 to create a
prod
space. - After creating your
prod
space, navigate to the settings for 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 Flex.
- Click Generate Token. Enter a name for your Profile API token, enter the password for your Segment 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 data to Unify
After you’ve created a Unify space, you must also connect a Salesforce CRM source, a data warehouse, and a Segment Profiles destination to your Unify space to link your customers’ data to Unified Profiles.
This section is about setting up a Salesforce source, RETL source, and a Segment Profiles destination 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 Step 3: Connect your Unify space to Flex.
Set up Salesforce
- From the catalog page in your workspace, select the Salesforce source and click Add Source.
- Enter a name for your Salesforce source and click Authenticate.
- You are redirected to the Salesforce login page. Sign in with a username and password of a user that has View all Permissions access.
- You are redirected to the Permissions Verified page in Segment. Click Next.
- On the SQL Schema name page, review the schema name and SQL query used to create the schema, then click Next.
- You’ve connected Salesforce. Click the Do it later button and continue to Connect a data warehouse .
Connect a data warehouse
- From the catalog page in your workspace, search for and select a BigQuery, Postgres, Redshift, or Snowflake destination.
- On the Choose Data Source page, select the Salesforce source you set up in the previous step and click Next.
- Give your data warehouse destination a name and enter the credentials for a user with read and write access to your database. Click Connect.
- Review the information on the Next Steps screen and click Done.
Segment’s initial sync with your data warehouse might take up to 24 hours to complete.
Add a Reverse ETL source
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.
Unified Profiles supports Postgres, Snowflake, Redshift, and BigQuery Reverse ETL sources.
- In the Reverse ETL section of the Sources catalog, select the warehouse you previously connected to Salesforce 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.
Segment recommends a model with the following format:
SELECT * FROM salesforce.accounts
-
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.
- From the catalog page in your workspace, select the Segment Profiles destination and click Add destination.
- On the Choose Data Source page, select the Salesforce source you set up in the previous step 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.
Step 3: Connect your Unify space to Flex
To connect your Unify space to Flex, follow the Connect an existing Segment Unify space instructions in the Flex documentation.
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
Step 4: Create Computed Traits and Predictions
After linking your customer data to Flex through a Unify space, you can set up computed traits and Predictions to better understand your users.
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 Flex 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 an 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.
Segment recommends that you configure the following computed traits for Unified Profiles:
- 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
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 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 to your Segment source, so you can troubleshoot your Segment connections. With the debugger, you can check that calls are sent in the expected format without having to wait for any data processing.
For more information about the Source debugger, see the Source debugger 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: 03 Mar 2024
Need support?
Questions? Problems? Need more info? Contact Segment Support for assistance!