Fetching a loyalty ledger in CleverTap
Let's set up CleverTap to retrieve the loyalty ledger information of a customer from Talon.One.
To do so, we rely on CleverTap's linked content functionality and Talon.One's Get loyalty ledger endpoint.
Talon.One requirements
- You are an Admin user.
- You have set up an Application that contains at least one customer profile. This profile also exists in CleverTap.
- You have set up a profile-based loyalty program.
CleverTap requirements
- You are an Admin user.
- You have configured an email provider and tested it.
- You have created a segment that contains at least one customer profile.
- You have a way to identify a given customer across Talon.One and CleverTap. In this tutorial, we use the customer's email address as a unique identifier.
Creating an API key in Talon.One
In the Campaign Manager, create a CleverTap-specific API key:
-
In your Application, click Settings > Integration API Keys.
-
Click Create API Key.
-
In the Create API Key drawer, select Production as the key type.
-
In Key name, type a name to identify the key.
-
In Key expiration date, select a date.
-
In Third-party integration, select Yes.
-
From Platform, select Customer Engagement Platform.
-
Click Create API Key.
-
Click to copy the key for use.
noteYou cannot view or copy the API key after closing the drawer. If you lose it, create another API key.
Creating linked content in CleverTap
Linked content allows you to call Talon.One's API endpoints and retrieve data from them.
To create linked content that calls the Get loyalty ledger endpoint:
-
In CleverTap, in the sidebar, open Settings > Setup > Linked Content.
-
Click + Linked Content.
-
In API name, type a name for the linked content.
-
In Endpoint URL, set the method to GET and enter the following URL:
https://integration.talon.one/customer_engagement/loyalty?profileIntegrationId={{profileIntegrationId}}&loyaltyProgramId={{loyaltyProgramId}}
.noteWe use double curly braces
{{...}}
to personalize the endpoint URL and add two query parameters. You can verify them in the Parameters tab. -
Click Headers and add the following key-value pairs:
Key Value Authorization
ApiKey-v1 YOUR_API_KEY
, whereYOUR_API_KEY
is the API key you created.customer-engagement-platform-name
CleverTap
destination-hostname
The base URL of your Talon.One deployment, for example, mycompany.europe-west1.talon.one
. -
Click Test Linked Content and enter sample values for the query parameters:
-
profileIntegrationId
: The integration ID of an existing customer in your Talon.One Application. -
loyaltyProgramId
: The ID of your loyalty program in Talon.One.tipTo see the loyalty program ID, open the Loyalty page in Talon.One. The ID is displayed in the first column of the list.
-
-
Click Send Request.
If the request is successful, the response will be displayed as JSON in the Response section. -
Click Auto-Fill Objects with Response to automatically populate the Custom Labels list with objects from the response.
For this tutorial, we only need thename
andledger.currentBalance
fields. You can remove the other fields. -
Click Test & save changes.
Creating the campaign in CleverTap
Now that we created the linked content, let's use it in an email campaign.
-
In CleverTap, in the sidebar, open Campaigns.
-
Click + Campaign > Email.
-
In Name, type a name for your campaign.
-
In Start here > Qualification criteria, select Past behavior/Custom list and click Done.
-
In Email Service Provider, select the email provider you configured and click Done.
-
In Set a goal, click Done.
-
In Who > Target Segment > Find users from segment, select the segment you created and click Done.
-
In Control group and target segment cap, click Done.
-
In What, select Single Message and click Go To Editor.
-
At the top right of the page, click Personalization.
-
In APIs, select the name of the linked content you created.
-
In API Parameters, make the following settings:
Parameter Property Value profileIntegrationId
Profile The CleverTap field containing the unique identifier that is equal to the customer integration ID in Talon.One. In this tutorial, we use Email. loyaltyProgramId
Custom The ID of your loyalty program in Talon.One, for example, 35
. -
Click Apply.
-
Select an email template.
-
In the email body, add the following text, where
YOUR_LINKED_CONTENT_NAME
is the name of the linked content you created:Hi {{ Profile.name | default:"(name)" }},
Great news! You have collected {{ Linked.YOUR_LINKED_CONTENT_NAME.currentBalance | default:"0" }} points in our loyalty program {{ Linked.YOUR_LINKED_CONTENT_NAME.name | default:"(program name)" }}. -
In Sender Details, fill in the sender information as required and click Done.
-
In When > Date and time, click Done.
-
In Delivery preferences, click Done.
-
Click Publish Campaign.
CleverTap starts sending emails to all customers in the segment. Each email contains information about the customer's loyalty balance and the name of their loyalty program.