Transfer of Data & Variables in a Journey
Updated
Introduction
The Journey Facilitator in Sprinklr is a robust tool designed for marketers to craft unified, omnichannel customer journeys. This advanced feature offers a visual flow builder, allowing you to map the entire customer journey and engage with your audience across various channels. A crucial element in creating effective customer journeys is the ability to transfer data and use variables within your workflows. In this article, we will delve into the process of transferring data and utilizing variables in Sprinklr's Journey Facilitator to optimize your marketing campaigns.
Understanding Data Transfer
Data transfer in the Journey Facilitator involves two main components:
External Data Transfer: This process includes transferring data or parameters from key-value pairs in the API payload to variables or custom fields within the journey.
Internal Data Transfer: This process involves moving information between different nodes, actions, and conditions within your workflow. This is crucial for creating personalized and targeted customer messages sent from the Journey Facilitator.
Let's explore how to transfer data and use variables effectively in your workflows.
External Data Transfer
This section applies exclusively to trigger-based journeys. Most trigger-based journeys utilize the "triggerWithNewProfile" API endpoint. If you are not familiar with this endpoint, please contact your solution consultant.
To transfer data from the API payload to variables in the journey, use the Variable Operation node.
For example, let's say you are using the following API payload to trigger your journey:
As shown, the API payload contains three main key-value pairs in the contextParams section. These pairs can be used for personalizing messages, creating decision trees, and more. To utilize these keys in the Journey, enter the key name in the value field on the right side by selecting the Enter Custom Code option, as illustrated below.
The name of the variable you are creating to hold the data from this key should be added to the value field on the left side. Once this is done, the final node for our scenario will look something like this:
Note: If you are using a Profile List/Segment based journey, all relevant data (such as country, language, etc.) must be passed as profile level custom fields when uploading the audience.
Internal Data Transfer
In the Update Properties node of the Journey Facilitator, click on the Resource icon located on the right-hand side box.
Then, click Enter Custom Code to define a Groovy script.
Groovy scripts can perform a wide range of operations and access data as needed. Here are a couple of examples:
Example 1: Concatenating Strings
// Concatenating first name and last name to create a full name property
def firstName = PROFILE.FIRST_NAME.get(0);
def lastName = PROFILE.LAST_NAME.get(0);
def fullName = firstName + " " + lastName;
return fullName;
Example 2: Date Manipulation
// Adding 7 days to the current date
def currentDate = new Date();
def sevenDaysLater = currentDate + 7;
return sevenDaysLater;
These examples demonstrate how Groovy scripts can be used to perform operations like string concatenation and date manipulation within Journey Facilitator, allowing for dynamic updates and customization of properties based on various criteria.
Next, create a new variable to store the fetched value from a Groovy script. This variable will be visible in the Standard Resources section of your journey.
Once the value is saved in this variable, you can utilize it in various ways, for example:
Saving to Custom Fields: You can save the value from the variable to any associated custom field.
Decision Making: Use the value stored in the variable to create decision trees within your journey. This allows you to make decisions based on specific values.
Personalizing Messages: Customize messages and content utilizing the value stored in the variable. This enables you to create personalized experiences for your audience.
By creating and utilizing variables in this manner, you can enhance the functionality and customization of your customer journeys in Sprinklr's Journey Facilitator, allowing for tailored interactions and targeted engagement with your audience.