Skip to main content

Fetching coupons in Emarsys

In this tutorial, let's set up Emarsys to retrieve existing coupons from Talon.One and use them in an Emarsys campaign.

To do so, we rely on the Emarsys-specific Get coupon endpoint.

Talon.One requirements

important

The Emarsys-specific endpoint supports only personal codes at the moment.

You can edit the default format of the coupon codes in the campaign's Settings section.

Emarsys requirements

  • You have set up your Emarsys account.
  • You have an active Emarsys campaign for which you want to use coupon codes.

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:

  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 Emarsys.
  5. Select an expiration date, and click Create API Key.
  6. Copy the key for later use.

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

Creating a connection in Emarsys

To retrieve a coupon code from Talon.One, we call the following endpoint:

POST coupon
https://integration.talon.one/emarsys/customer_profiles/coupons

See API Docs

To access this endpoint, create an External Content connection in Emarsys:

  1. Sign in to your Emarsys account.
  2. Open Content > External Content.
  3. Click Create Connection.
  4. In Connection, enter the following details:
    • Name: A descriptive name for the connection.
    • API URL: https://integration.talon.one/emarsys/customer_profiles/coupons?deployment=YOUR_DEPLOYMENT_URL, where YOUR_DEPLOYMENT_URL is the base URL of your Talon.One deployment.
  5. In Authentication, enter the following details:
    1. Method: HTTP basic authentication
    2. User name: ApiKey-v1
    3. Password: The Emarsys-specific API key you created.
  6. In Fields, enter the following details:
    • Reference Fields:

      Field nameField value
      integrationIdA valid Talon.One customer integration ID. Example: URNGV8294NV.
      campaignIdThe ID of the Talon.One campaign containing the coupons. Example: 34.
    • Response Fields: The Talon.One coupon attributes to retrieve.
      For example, add a value response field to retrieve the coupon code. You can also use custom attributes.

    note

    For a list of supported attributes, see the coupons array of the List customer data response.

  7. To test the connection with the values provided, click Test.
  8. If the test is successful, click Save.

Using custom coupon attributes

You can use custom attributes as response fields. Ensure that the custom attribute has its Associated Entity set to Coupon.

For example, you can create a custom attribute named percentage_discount, use it for your coupons, and include the attribute in the response from Talon.One.

Creating tokens in Emarsys

To use a coupon attribute in your Emarsys campaign, create a Personalization token:

  1. In Emarsys, open Content > Personalization.
  2. Click Create Token and choose External Content.
  3. 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 coupon attribute to use in your Emarsys campaign. For example, to use the coupon code in your campaign, select value.
  4. Click Save.

Repeat the above steps for every coupon attribute you want to use in your Emarsys campaign.

Creating an External Content preset

To manage recurring coupon requests to Talon.One, create an External Content preset and assign it to your Personalization token. See the Emarsys docs.

example

Assume you want to retrieve coupons of a specific campaign in Talon.One. The ID of this campaign is 34. Also, you want to use the customer's email address as the unique identifier to retrieve coupon codes from Talon.One.

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:

    NameTypeValue
    integrationIdContact FieldEmail
    campaignIdConstant34

Using coupons in an Emarsys campaign

Now that we've established a connection and created a token, we can use the token in a campaign:

  1. Open your Emarsys campaign for editing.
    In this tutorial, we'll use a block-based email campaign.
  2. Go to the Content Creation step of the campaign creation wizard.
  3. In the editor sidebar, open Personalization and find your created tokens in the Custom Tokens section.
  4. Drag the desired tokens into the content editor window.
  5. To test your coupon attributes, use the Testmail feature.
  6. Click Finish Editing.
note

When using the Inbox Preview feature, placeholders are displayed instead of the actual token values.