Skip to main content

Creating coupons through Braze

This is a guide on integrating Braze with Talon.One. This guide will walk you through the Braze endpoint used to create coupons, it will also discuss the syntax required for supporting custom attributes on coupons.

Rate limiting recommendations#

When you create a Braze campaign that generates coupons in Talon.One, set the Delivery Speed Rate-Limiting in your Braze settings to a maximum of 500. If the rate limit is increased, further coupons may not be created or may not appear in the message sent through Braze.

Further information can be found here: Braze: Delivery Speed Rate-Limiting

Coupon settings#

You can modify the form of coupon codes for any campaign by going to the Coupon Code Generator for that campaign (campaign -> settings -> coupon code generator)



In order to authenticate with the endpoint, a dedicated API key is needed. Follow these steps to create a Braze API key:

  1. Navigate to the developer settings of your application.
  2. Click create a new API key.
  3. The Do you want to use this API Key with a 3rd party service? popup appears. Select Yes.
  4. Select Braze from the dropdown.
  5. Generate your key.

Endpoint usage#

Because Braze-connected content only supports date type of string, a custom endpoint has to be used that will convert to the correct data types.

This endpoint contains the following built-in properties:

(*) Required

  • applicationID (*)
  • campaignID (*)
  • identifier (*)
  • integrationID
  • startDate
  • expiryDate
  • usageLimit (is 1 by default)

The identifier is used to add flexibility in the handling of duplicate requests from Braze, the recommended options are as follows;

  • message_api_id/variant_api_id - This will return unique identifiers for every testing variant within a Campaign or Canvas (lifecycle journey). By using this, Talon.One will return a new coupon per customer for every single variant within a Braze campaign, ensuring no duplicate coupons are created. Note that you should use message_api_id for Campaigns while variant_api_id should be used for Canvases. For information on creating these types of AB and multivariate tests find Braze's documentation here.

  • campaign_id/canvas_id - This will return the unique identifier of the Campaign or Canvas itself. For Campaigns (one-off engagements) campaign_id should be used, while for Canvas (lifecycle journey) canvas_id should be used.

Example with only required properties

curl \ -X POST \ -H 'Authorization: ApiKey-v1 [YOUR_API_KEY]' \ -d '{        "applicationID": "1",        "campaignID: "1",        "identifier": "an-example-identifier"}'

Example with all built-in properties

curl \ -X POST \ -H 'Authorization: ApiKey-v1 [YOUR_API_KEY]' \ -d '{        "applicationID": "1",        "campaignID": "1",        "identifier": "an-example-identifier",        "integrationID": "an-example-integrationID",        "startDate": "2019-06-12T09:00:00Z",        "expiryDate": "2019-06-13T09:00:00Z"}'

Custom attributes can also be passed directly. These attributes are notated with a dot prefix and must be wrapped in a string.

Example with string attribute

curl \ -X POST \ -H 'Authorization: ApiKey-v1 [YOUR_API_KEY]' \ -d '{        "applicationID": "1",        "campaignID": "1",        "identifier": "an-example-identifier"        ".stringAtrrName": "examplestring",    }'

Example with list of numbers attribute

curl \ -X POST \ -H 'Authorization: ApiKey-v1 [YOUR_API_KEY]' \ -d '{        "applicationID": "1",        "campaignID": "1",        "identifier": "an-example-identifier"        ".listOfNumbers": "[1,2,3,4,5,6,7,8,9,10]",    }'

Configuring Connected Content#

To trigger the Talon.One coupon creation you have to use Braze's Connected Content Feature. You can use it in every campaign message body or any canvas message body.

  1. Add the connected content tag to the body of your message. You can access Braze attributes by using liquid tags (for example {{${user_id}}} to pass the user id)


  2. Add the URL to the createCoupon endpoint of your Talon.One deployment


  3. Add the authorization header and the method (post) of the request. Follow the instruction on this page to generate a session token. Additionally, you can get the token once you have admin permission in Talon by following [this instructions](.


  4. Add the body of the request containing the coupon code specs mentioned above (The parameters are separated by an &)

    ℹ️ the identifier attribute is necessary to prevent the creation of multiple coupons for one message


  5. Add the save parameter at the end to store the Talon.One response as a Braze variable (in the below case, result).


  6. Use a liquid tag to show the value of the generated code in the message. The whole response from Talon.One will look like this: {"id"=>1548040, "value"=>"44D4-U4PL", "__http_status_code__"=>200}


  7. Testing the campaign/canvas will give you the following result:

    Coupon value only {{result.value}}:


    Whole response {{result}}:


Code snippet:

{% connected_content https://[YOUR_SUBDOMAIN]
:headers {   "Authorization": "ApiKey-v1 [YOUR_API_KEY]" }:method post:body applicationID=1&campaignID=1488&identifier={{campaign.${message_api_id}}}&integrationID={{${user_id}}}:content_type application/json:save result%}