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 through 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" %}{% connected_content https://<YOUR_DEPLOYMENT>.talon.one/v2/integration/braze/createcoupon:headers {  "Authorization": "ApiKey-v1 <YOUR_API_KEY>"  }:method post:body applicationID=<YOUR_APPLICATIONID>&campaignID=<YOUR_CAMPAIGNID>&identifier={{campaign.$ {message_api_id}}}&integrationID={{${user_id}}}&startDate={{today}}&expiryDate={{seven_days}}:content_type application/json:save result%}{{result.value}}

    where you replace:

    • <YOUR_DEPLOYMENT> by your own Talon.One URL, for example https://mycompany.europe-west1.talon.one/v2/integration/braze/createcoupon.
    • <YOUR_API_KEY> by your Talon.One API key for the Application used for this scenario.
    • <YOUR_APPLICATIONID> by the Talon.One Application ID.
    • <YOUR_CAMPAIGNID> by the Talon.One campaign ID.
    note

    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:

      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 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.