Skip to main content

Fetching a loyalty ledger in Bloomreach Engagement

In this tutorial, let's set up Bloomreach Engagement to retrieve the loyalty ledger information of a customer from Talon.One.

Talon.One requirements

Bloomreach requirements

  • You have set up an email provider.
  • You have set up a consent category.
  • You have a way to identify a given customer across Talon.One and Bloomreach. For example, the customer's email address in Bloomreach matches the integration ID in Talon.One.
tip

A good understanding of email marketing can help you tailor your scenarios effectively. We highly recommend you read the Bloomreach documentation first.

Creating an Integration API key

An Integration API key allows authentication for incoming webhook requests. In Talon.One, let's create an API key to aid authentication in a later step.

To create an API key:

  1. In your Talon.One Application, click Settings > Developer settings.

  2. Click Create API Key.

  3. For Do you want to use this API Key with a 3rd party service?, select Yes.

  4. From Platform, select Customer Engagement Platform.

  5. Select an expiration date, and click Create API Key.

  6. Copy the key for later use.

    note

    You cannot display the API key after this step. If you lose the value, create a new API key.

Configuring webhook authentication

In Bloomreach Engagement, let's configure the webhook authentication for Talon.One so that data can be passed securely in the webhook request. We will use this webhook authentication while creating a scenario in a later step.

To configure the webhook authentication:

  1. In Bloomreach Engagement, open Data & Assets > Integrations.

  2. Click Add new integration

  3. Click HTTP Authentication Schemas.

  4. In Endpoint, type the following endpoint URL:

    GET Get loyalty ledger
    https://integration.talon.one/customer_engagement/loyalty
    See API Docs
  5. Click Custom headers, and enter the following headers:

    KeyValueType
    AuthorizationApiKey-v1 YOUR_API_KEY, where YOUR_API_KEY is the API key you created.public
    destination-hostnameThe base URL of your Talon.One deployment, for example, mycompany.europe-west1.talon.one.public
    customer-engagement-platform-nameBloomreachEngagementpublic
  6. At the top-left of the page, click the name of the integration to rename it appropriately.

  7. Click Save integration.

Creating a scenario

In Bloomreach Engagement, let's create a scenario to fetch loyalty ledger information from Talon.One and use it in an email.

For this tutorial, we'll create a simple demo scenario that sends an email one minute after you start the scenario. To do so:

  1. In Bloomreach Engagement, open Campaigns > Scenarios > New Scenario.
  2. (Optional) At the top-left of the page, click the name of the scenario to rename it appropriately.
  3. Add a Now trigger and a Wait operator and connect them.
  4. Double-click the Wait operator and set Specific time period to 1 minutes.
  5. Add a Webhook action and connect it to the Wait operator.
  6. Double-click the Webhook action and configure the following parameters:
    1. In the Editor tab:
      1. Click the POST dropdown and change it to GET.

      2. Enter the following URL:

        https://integration.talon.one/customer_engagement/loyalty?loyaltyProgramId=YOUR_LOYALTY_PROGRAM_ID&profileIntegrationId=CUSTOMER_INTEGRATION_ID
        • YOUR_LOYALTY_PROGRAM_ID is the ID of your loyalty program in Talon.One.

          tip

          To see the loyalty program ID, open your Talon.One loyalty program and check the URL in your browser.
          For example, if the URL is https://mycompany.europe-west1.talon.one/loyalty_programs/402/dashboard, the program ID is 402.

        • CUSTOMER_INTEGRATION_ID is a unique identifier of your customers.
          Use Jinja expressions to reference customer attributes in Bloomreach. For example, to reference the customer's email address, use {{ customer.email }}.

          Loyalty ledger information will be fetched for the customer with this integration ID in Talon.One. A customer profile with this ID must already exist in Talon.One.

      3. Click the Do not process response dropdown and change it to Process response as JSON.

    2. In the Settings tab:
      1. Enable Authentication and select the webhook authentication you created.
      2. In Other, select the required consent category for your customers.
    3. Click Done.
  7. Add an Email action and connect it to the Webhook action.
  8. Double-click the Email action, click HTML builder, and configure the following parameters:
    1. In the Editor tab:

      1. In Subject line, enter the title of the email.

      2. Add the following HTML code:

        <html>
        <head><meta charset="utf-8" /></head>
        <body>
        <p>In the loyalty program "{{ webhook.title }}", you have acquired {{ webhook.ledger.currentBalance }} points.</p>
        <p>Congratulations!</p>
        </body>
        </html>
    2. In the Settings tab:

      1. In Recipients, choose Customers matching campaign if you already set up a campaign, or Set recipient manually to test the scenario with a single recipient.
      2. In Consent category, select the required consent category for your customers.
    3. Click Done.

  9. Click Save.

The scenario should now look like this:

Screenshot of the scenario in the editor

tip

You can also create a webhook preset, which is a reusable webhook template that you can use in your Bloomreach Engagement scenarios.

Running the scenario

Before you run the scenario you created, you can test and preview the complete workflow in the Test tab.

To run the scenario, click Start. You will see a confirmation window indicating how many customers will be affected by the scenario run.

After one minute, an email will be sent to the configured recipients, containing the text In your loyalty program ..., followed by the loyalty information fetched from Talon.One.