Skip to main content

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

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:

  1. In your Application, click Settings > Integration API Keys.

  2. Click Create API Key.

  3. In the Create API Key drawer, select Production as the key type.

  4. In Key name, type a name to identify the key.

  5. In Key expiration date, select a date.

  6. In Third-party integration, select Yes.

  7. From Platform, select Customer Engagement Platform.

  8. Click Create API Key.

  9. Click to copy the key for use.

    note

    You 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:

  1. In CleverTap, in the sidebar, open Settings > Setup > Linked Content.

  2. Click + Linked Content.

  3. In API name, type a name for the linked content.

  4. In Endpoint URL, set the method to GET and enter the following URL:
    https://integration.talon.one/customer_engagement/loyalty?profileIntegrationId={{profileIntegrationId}}&loyaltyProgramId={{loyaltyProgramId}}.

    note

    We use double curly braces {{...}} to personalize the endpoint URL and add two query parameters. You can verify them in the Parameters tab.

  5. Click Headers and add the following key-value pairs:

    KeyValue
    AuthorizationApiKey-v1 YOUR_API_KEY, where YOUR_API_KEY is the API key you created.
    customer-engagement-platform-nameCleverTap
    destination-hostnameThe base URL of your Talon.One deployment, for example, mycompany.europe-west1.talon.one.
  6. 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.

      tip

      To see the loyalty program ID, open the Loyalty page in Talon.One. The ID is displayed in the first column of the list.

  7. Click Send Request.
    If the request is successful, the response will be displayed as JSON in the Response section.

  8. Click Auto-Fill Objects with Response to automatically populate the Custom Labels list with objects from the response.
    For this tutorial, we only need the name and ledger.currentBalance fields. You can remove the other fields.

  9. Click Test & save changes.

Creating the campaign in CleverTap

Now that we created the linked content, let's use it in an email campaign.

  1. In CleverTap, in the sidebar, open Campaigns.

  2. Click + Campaign > Email.

  3. In Name, type a name for your campaign.

  4. In Start here > Qualification criteria, select Past behavior/Custom list and click Done.

  5. In Email Service Provider, select the email provider you configured and click Done.

  6. In Set a goal, click Done.

  7. In Who > Target Segment > Find users from segment, select the segment you created and click Done.

  8. In Control group and target segment cap, click Done.

  9. In What, select Single Message and click Go To Editor.

  10. At the top right of the page, click Personalization.

  11. In APIs, select the name of the linked content you created.

  12. In API Parameters, make the following settings:

    ParameterPropertyValue
    profileIntegrationIdProfileThe CleverTap field containing the unique identifier that is equal to the customer integration ID in Talon.One. In this tutorial, we use Email.
    loyaltyProgramIdCustomThe ID of your loyalty program in Talon.One, for example, 35.
  13. Click Apply.

  14. Select an email template.

  15. 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)" }}.
  16. In Sender Details, fill in the sender information as required and click Done.

  17. In When > Date and time, click Done.

  18. In Delivery preferences, click Done.

  19. 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.