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 email a customer on their birthday via Braze. This email contains a coupon for the customer. The coupon's validity starts on the day the email is sent to the customer and ends 7 days after that date.

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

tip

Understanding the Braze-specific endpoint that is used to generate coupons can help you follow this tutorial better. 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 the coupons generated via Braze and the rules that allow the user to redeem a coupon.

  1. Create a campaign and select the Coupon feature.
  2. Create a 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": "mycompany.europe-west1.talon.one", "applicationID":270, "campaignID":882, "identifier":"{{campaign.${dispatch_id}}", "integrationID":"{{${user_id}}}", "startDate":"{{today}}", "expiryDate":"{{seven_days}}"}
    {% endcapture %}

    {% connected_content https://integration.talon.one/braze/coupon
    :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
    note

    To see the Application ID and campaign ID of your campaign:

    1. Open your Talon.One campaign.

    2. In your browser, check the URL. It should look similar to:

      https://mycompany.europe-west1.talon.one/applications/198/campaigns/373

      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 email yourself and create a coupon in Talon.One.
  3. In the Campaign Manager, open the Coupons page and notice the coupon created by Braze.