Fetching loyalty points in Emarsys
Let's set up Emarsys to retrieve the loyalty balance of a customer from Talon.One.
To do so, we rely on the Emarsys-specific Get loyalty balance endpoint.
Talon.One requirements
- You are an Admin user.
- You have set up an Application that contains customer profiles.
- You have set up a profile-based loyalty program.
Emarsys requirements
- You have set up your Emarsys account.
- You have an active Emarsys campaign for which you want to send emails containing loyalty information.
In this tutorial, we'll use a block-based email campaign.
Creating an API key in Talon.One
In the Campaign Manager, create an Emarsys-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 Emarsys.
-
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 a connection in Emarsys
To retrieve loyalty ledger information from Talon.One, we call the following endpoint:
https://integration.talon.one/emarsys/loyalty_programs/profile/balance
See API Docs
To access this endpoint, create an External Content connection in Emarsys:
-
Sign in to your Emarsys account.
-
Open Content > External Content.
-
Click Create Connection.
-
In Connection, enter the following details:
- Name: A descriptive name for the connection.
- API URL:
https://integration.talon.one/emarsys/loyalty_programs/profile/balance?deployment=YOUR_DEPLOYMENT_URL
, whereYOUR_DEPLOYMENT_URL
is the base URL of your Talon.One deployment.
-
In Authentication, enter the following details:
- Method: HTTP basic authentication
- User name:
ApiKey-v1
- Password: The Emarsys-specific API key you created.
-
In Fields, enter the following details:
-
Reference Fields:
Field name Value for testing integrationId
A valid Talon.One customer integration ID. Example: URNGV8294NV
.loyaltyProgramId
The ID of your profile-based loyalty program in Talon.One. Example: 14
.subledgerId
(Optional) The ID of the subledger from which to retrieve the loyalty balance. If not provided, the loyalty balance is retrieved from the main ledger. Example: my-subledger
. -
Response Fields: The loyalty ledger attributes to retrieve.
For example, add anactiveBalance
response field to retrieve the current loyalty point balance of a customer.
-
-
To test the connection with the values provided, click Test.
-
If the test is successful, click Save.
Creating tokens in Emarsys
To use a loyalty attribute in your Emarsys campaign, create a Personalization token:
- In Emarsys, open Content > Personalization.
- Click Create Token and choose External Content.
- In Setup, enter the following details:
- Name: A descriptive name for the token.
- (Optional) Category: Create or assign a category. This helps you organize your tokens. The categories are shown in the Personalization sidebar when editing your campaign.
- External Content preset: Create or assign a preset.
- Field: The loyalty attribute to use in your Emarsys campaign. For example, to use the current loyalty point balance in your campaign, select
activeBalance
.
- Click Save.
Repeat the above steps for every attribute you want to use in your Emarsys campaign.
Creating an External Content preset
To manage recurring loyalty requests to Talon.One, create an External Content preset and assign it to your Personalization token. See the Emarsys docs.
Assume you want to retrieve information about a specific loyalty program in Talon.One. The ID of this program is 14
.
Also, you want to use the customer's email address as the unique identifier to retrieve loyalty information.
In this case, create the following preset and assign it to your token:
-
Name: A descriptive name for the preset.
-
Connection: The External Content connection you created.
-
Parameters:
Name Type Value integrationId
Contact Field Email
loyaltyProgramId
Constant 14
Using loyalty information in an Emarsys campaign
Now that we've established a connection and created a token, we can use the token in a campaign:
- Open your Emarsys campaign for editing.
In this tutorial, we'll use a block-based email campaign. - Go to the Content Creation step of the campaign creation wizard.
- In the editor sidebar, open Personalization and find your created tokens in the Custom Tokens section.
- Drag the desired tokens into the content editor window.
- To test your email, use the Testmail feature.
- Click Finish Editing.
When using the Inbox Preview feature, placeholders are displayed instead of the actual token values.