Skip to main content

Creating coupons via Braze

In this tutorial, let's set up Braze to automatically generate coupons inside Talon.One and deliver the coupon codes to specific customer segments.

To do so, we will rely on a Talon.One Braze-specific endpoint that will generate coupons, and we'll send requests to it from Braze through the Connected Content feature.

Talon.One requirements

Ensure you already have an Application set up and that it contains a running campaign with the Coupons feature enabled.

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

Braze requirements

We assume that you have set up your Braze account and that you have an active Braze campaign or canvas for which you want to generate coupon codes.

Creating an API key in Talon.One

In the Campaign Manager, create a Braze-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 Braze.
  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.

We will use the API key in the Braze campaign template.

Creating the coupon code

To generate a coupon from Braze, we call the following endpoint:

POST coupon

See API Docs

To trigger the endpoint, we must use Braze's Connected Content feature and Braze's Liquid tags.


We assume that your customer profile in Braze contains a unique identifier that is equal to the customer integration ID in Talon.One. In this tutorial, we use ${user_id}. Ensure the user ID matches the integration ID in Talon.One.

  1. Open your Braze campaign/canvas for editing.

  2. According to the Braze docs, add the following Connected Content call to the body of your message, where:

    • YOUR_DEPLOYMENT_URL is the base URL of your Talon.One deployment.
    • YOUR_APPLICATION_ID is the ID of your Application in Talon.One.
    • YOUR_CAMPAIGN_ID is the ID of your campaign in Talon.One.
    • YOUR_API_KEY is the API key you created.
    {% capture postbody %}
    {"deploymentUrl": "YOUR_DEPLOYMENT_URL", "applicationId":YOUR_APPLICATION_ID,
    "campaignId":YOUR_CAMPAIGN_ID, "identifier":"{{campaign.${dispatch_id}}}", "integrationId":"{{${user_id}}}"}
    {% endcapture %}

    {% connected_content
    :headers {
    "Authorization": "ApiKey-v1 YOUR_API_KEY"
    :method post
    :body {{postbody}}
    :content_type application/json
    :save result

    Your coupon code is: {{result.Value}}

    result.Value must be written with a capital V, according to the response of the Create coupon endpoint.

  3. To test your request:

    1. Click Preview in the template editor.
    2. In Preview as User, click Select existing user and search for an existing user in Braze.
      You should see a coupon code.

    A new coupon code is only generated when you use the preview function for the first time. This is because the dispatch_id isn't available at campaign creation. When your campaign is running, the call behaves as expected.

Your coupon codes are now generated automatically when your campaign is running.