Fetch Segment Profile Data in Pendula
A GET request to Segment can be used at any point in a flow to utilise additional information about a profile. This can take the form of:
- Profile Traits
- Profile Events
- Profile External IDs
- Profile Metadata
- Profile Links
An example of when to fetch data would be to get a customer's name and phone, when the initial triggering event only contains a UserID.
Pre-requisites
To fetch Segment Profile Data within a Pendula flow, you'll need:
- A Segment Business plan, with Unify
- A set of Segment web request credentials - see Segment Documentation for details.
-
Request Headers setup within Pendula, with the Segment generated web request credentials.
-
Header -
Authorization
-
Value - 'Basic
Base64 encoded access token
'- Before encoding the token, add a colon at the end - Segment requires a blank password after the username.
-
Header -
Creating a Pendula Web Request to Segment
- Drag the Web Request node into your flow at the point where you want to fetch Segment profile data.
- Set the Request type to GET.
- Select Headers from the Authentication drop down.
- Select the credential you have configured for Segment.
- Copy and paste the following into the API endpoint URL field:
https://profiles.segment.com/v1/spaces/SpaceID
/collections/users/profiles/User_id
:UserID
/Route
-
-
SpaceID
is supplied based upon Segment Space ID (in Unify Settings → API Access) -
User_id
is an external ID that is tracked within Segment profiles as an Identifier. -
UserID
should be a merge field that identifies the specific profile. -
Route
depends on what should be returned by the request. e.g. traits - By default, the response includes 20 records. You can return up to 200 records by appending
?limit=200
- See Segment Profile Documentation for further information around Profile API.
-
-
- Paste a payload sample of traits into the node for reference within the flow. It should look similar to below:
-
{
"traits": {
"email": "example@gmail.com",
"logins": 5,
"name": "Example",
"phone":"6140000000",
"plan": "premium"
}
}
-