Using universal coupons and reservations with Braze
In this tutorial, we set up Braze to use universal coupons with reservations. This allows us to use the same coupon code for a particular group of customers.
Let's imagine you want to email a WELCOME10
coupon to customers, but only new customers should be able to redeem it.
The coupon should give them 10% off their first purchase.
To do so, we'll rely on the Braze-specific Create coupon reservation endpoint, and we'll send requests to it from Braze through the Connected Content feature.
Talon.One requirements
- You are an Admin user.
- You have set up an Application.
- Your Application contains a running campaign with the Coupons feature enabled.
Braze requirements
- You have created a campaign or canvas in Braze.
- You have a way to identify a given customer across Talon.One and Braze.
In this tutorial, we assume a customer's Talon.One
integrationId
is always equal to Braze'suser_id
. You can also create a new property on your Braze customer profiles to store Talon.One's integration ID.
Creating an API key in Talon.One
In the Campaign Manager, create a Braze-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 Braze.
-
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.
We will use the API key in the Braze campaign template.
Creating a universal coupon code
Let's create a universal coupon code in Talon.One with the following settings:
Setting | Value | Description |
---|---|---|
Coupon code | WELCOME10 | – |
Coupon redemption limit | Allow unlimited redemptions | Coupon can be redeemed an unlimited number of times. |
Per-customer redemption limit | 1 | Coupon can be redeemed once per customer. |
Coupon reservation limit | Allow unlimited reservations | Coupon can be reserved an unlimited number of times. |
Reservation mandatory | Coupon can be redeemed only by the customers it was reserved for. |
Reserving the coupon code
Let's reserve the coupon we created for a customer. This makes the coupon redeemable by that customer.
To do so, we call the following endpoint:
https:/braze/coupon_reservation
See API Docs
To trigger the endpoint, we must use Braze's Connected Content feature.
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.
-
Open your Braze campaign or canvas for editing.
-
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, for example,mycompany.europe-west1.talon.one
.YOUR_COUPON_CODE
is the universal coupon code you created, for example,WELCOME10
.YOUR_API_KEY
is the API key you created.
{% capture postbody %}
{"deploymentUrl": "YOUR_DEPLOYMENT_URL", "couponValue": "YOUR_COUPON_CODE", "integrationId":"{{${user_id}}}"}
{% endcapture %}
{% connected_content https://integration.talon.one/braze/coupon_reservation
:headers {
"Authorization": "ApiKey-v1 YOUR_API_KEY"
}
:method post
:body {{postbody}}
:content_type application/json
:save result
:retry
%}
Your coupon code is: {{result.value}} -
To test your request:
- In the sidebar, click Preview & Test.
- In Preview message as user, select Search User and search for an existing user in Braze.
You should see the coupon code.
Checking the reservation
Let's check whether our coupon code has been successfully reserved.
To do so, we use the List customers that have this coupon reserved endpoint of the Integration API:
-
Use curl or a similar tool to send the following request, where:
YOUR_DEPLOYMENT_URL
is the base URL of your Talon.One deployment, for example,mycompany.europe-west1.talon.one
.YOUR_COUPON_CODE
is the universal coupon code you created, for example,WELCOME10
.YOUR_API_KEY
is the API key you created.
curl 'https://YOUR_DEPLOYMENT_URL/v1/coupon_reservations/customerprofiles/YOUR_COUPON_CODE' --header 'Authorization: ApiKey-v1 YOUR_API_KEY'
-
Check the
integrationId
field of the response. It should contain the identifier you provided in the Braze call.