Skip to main content

Creating a birthday promotion with Braze

Birthdays are a great opportunity to give presents to someone so treating your customers with a discount on their birthday is a great way to increase brand loyalty. In this tutorial, let's see how to build a birthday promotion using Braze and Talon.One.

Understanding the scenario

Let's imagine that we want to send an email to a customer on their birthday via Braze. This email contains the coupon code.

When we request the email to be sent:

  1. Create a coupon code in the Campaign Manager.
  2. Set the coupon start date to the time the email request happened.
  3. Set the coupon expiry date to start date + 7 days.
  4. Create the body text containing the coupon code.
  5. Have Braze use this information to create and send the email.

When the customer redeems the coupon, they get 10% off on their whole order.

Before you start, see Creating coupons via Braze.

Creating a campaign in Talon.One

Let's create a campaign in Talon.One. This campaign will contain all coupons generated in Braze and the rules that allow the user to redeem the coupon.

  1. Create a campaign and select the Coupon feature.
  2. Create a new Rule with the following criteria:
    • Condition: the Coupon Code is Valid.
    • Effect: Discount Session Total.

The campaign is ready, we can use it from our Braze setup.

Creating a campaign in Braze

Let's create a campaign in Braze that sends an email to our customer on their birthday. See Creating an email campaign for more information.

Editing the email body

To include the Connected Content in the email body:

  1. In Braze, click Edit Email Body.

  2. Include your campaign parameters in the Connected Content.

  3. Add the Connected Content to the email body. The generic content looks like:

    {% assign today = 'now' | date: "%Y-%m-%dT%H:%M:%SZ" %}
    {% assign todayinseconds = 'now' | date: "%s" %}
    {% assign seven_days = {{todayinseconds}} | plus: 604800 | date: "%Y-%m-%dT%H:%M:%SZ" %}

    {% capture postbody %}
    {"deploymentURL": "", "applicationID":270, "campaignID":882, "identifier":"{{campaign.${dispatch_id}}", "integrationID":"{{${user_id}}}", "startDate":"{{today}}", "expiryDate":"{{seven_days}}"}
    {% endcapture %}

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

    <p>Your coupon code is: {{result.Value}}</p>

    where you replace the values set for the following properties on the highlighted line:

    • deploymentURL
    • applicationID
    • campaignID

    To see the Application and campaign ID of your campaign:

    1. Open the campaign you created in the previous step in Talon.One.

    2. Check the URL in your browser, it should look similar to:

      In this example the Application ID is 198 and the campaign ID is 373.

The Connected Content automatically creates a coupon code in Talon.One every time Braze sends an email to our customer. The coupon start date is set as the time Braze sent the email. The coupon end date is the time Braze sent the email + 7 days.

Testing the workflow

Let's test our Braze campaign to ensure the Connect Content works.

  1. Preview the email, a randomly-generated coupon code should appear on the email body.
  2. Click Test Send to send an email to yourself and create a coupon in Talon.One.
  3. In the Campaign Manager, open the Coupons page and notice the coupon created by Braze.