Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 11 Next »

Contents

Overview

This guide will show you how you can create a Webhook campaign in Braze to assign offers to only specific users. This means only these particular users will show In order to do this you will need to create a config Offer in Sanity and then create a Braze webhook campaign to assign this offer to users that meet a specific criteria set in Braze (e.g. assign Veggie Whopper Offer to guests that replied to a survey that they are vegetarian).

Sanity Setup

1. Create a personalized (or config) Offer

Follow this guide to create the offer: Offers - Configuration Guide

Note: You will need a different Config Offer created for each offer you would like to assign using Braze.

2. Save the Loyalty Engine ID of the config offer to input into Braze after

3. Add the config (personalized) offer to Live Config Offers

  • To access Live Config Offers navigate to Order-Level Content > Loyalty > Live Offers Configuration > Live Offers > Live Config Offers in Sanity.

The offer will only show in the app if it is assigned to the user and added in this section in Sanity.

Screenshot 2024-05-24 at 14.07.28.png

Note: If the same offer is assigned multiple times, the user will see the same offer added multiple times to their offer list. This means that the user will see multiple instances of the same offer in their offer list - as many as offer assignments done for that offer. Each offer will maintain their own configuration settings

Braze Webhook Campaign Setup

1. Login to Braze

Login to your braze account

image-20240807-104356.png

2. Navigate to Campaigns

In the homepage, click on “Campaigns”

3. Create a new Webhook Campaign

Click on “Create Campaign”. Then click on “Webhook”.

4. Configure the Campaign Details

  • Add the name of the campaign in the “Campaign Name” field

  • Click on “Blank Template”

5. Compose the Webhook

Webhook URL

the Hot path should be used for any user triggered campaigns that should happen in realtime

  • ie: T-Mobile Tuesdays, sign up bonuses

the Cold path should be used for any marketer triggered campaigns that can be processed over time

  • ie: mass offers assignments, mass points updates

Example of Hot Webhook URL in Production:

https://euc1-prod-bk-loyalty-middleware.rbictg.com/bulk-action/hot/create-offer

Example of the Cold Webhook URL in Production:

https://euc1-prod-bk-loyalty-middleware.rbictg.com/bulk-action/cold/create-offer

If you would like to test in Staging the Offer assignment first, just replace prod with staging in the Webhook URL.

Markets in EU Timezone and APAC Timezone should add euc1- and apse1- prefixes to the URL respectively (e.g., https://euc1-prod-bk-loyalty-middleware.rbictg.com/bulk-action/cold/create-offer)

Input the URL in the “Webhook URL” field

HTTP method

Keep this field set to “POST”. No changes needed here.

Request Body

Inside “Request Body” choose “Raw Text”

Then copy the format below and paste it inside the Raw Text field.

{
  "email": "{{${email_address}}}",
  "source": "braze-test",
  "rank": 123456, (optional)
  "configId": "Loyalty engine id of config offer",
  "ruleParams": {
    "startDate": "yyyy-mm-dd",
    "endDate": "yyyy-mm-dd"
  }
}
  • Replace configId with the Loyalty Engine ID of the offer you want to assign using Braze

  • source should be braze in Production; braze-test in lower environments (Dev, Staging)

  • email -> leave as is

Note that in the past we relied on "userId": "{{${user_id}}}" , but after the EUC1 user data migration all campaigns should use "email": "{{${email_address}}}"

  • startDate and endDate-> the endDate must be set after the startDate - this represents the duration of time the offer will be available for the guest in the app

  • rank field (optional) determines the sequence priority of the assigned personalized offer. The lower the number, the higher the priority (i.e. 1 would rank at the top)

By default, the assigned offers will have the same rules as the ones configured in Sanity. If you want to override some of these with custom rules, for example, a custom End Date & Start Date, you can pass the following arguments:

"ruleParams": {
    "startDate": "{{ "now" | date:"%F" }}",
    "endDate": "{{ "now" | date:'%s' | plus:604800| date:"%F" }}"
  }

In the above example, we set the Start Date to be the time when the Offer was assigned, and we set the End Date to be 7 days after the offer was assigned (now + 604800 seconds).

startDate and endDate always counts from 00:00 to 23:59 from their respective dates.

Request headers

Content-type
Content-Type: application/json
X-Region
x-region: gb

x-region is the 2-character ISO country code string of that market (e.g. gb = United Kingdom, ch = Switzerland)

X-Api-Key
x-api-key: string

Please reach out to your market setup representative to get you access to the API Key in Production or Staging for your brand

6. Test the offer is getting assigned to your user

It is extremely important to test your offer webhook, before launching the campaign. Once an offer is assigned to a user its configuration and rules CANNOT be changed using Sanity.

In the “Compose” section in Sanity click on “Test”. Then choose “Select existing user” from the dropdown “Preview message as user”. After this input the email address of your test user in the app. Last but not least, click on “Send Test”. Now the offer should show on the top of your offer list.

Note: The rest of the Braze campaign needs to be configured like any other Braze campaign (e.g. email, IAM, or push campaign). You will need to input specific information on the Schedule Delivery of the campaign, the Target users the campaign will apply to and when the campaign should be delivered to these target users. For more information refer to: https://www.braze.com/docs/user_guide/engagement_tools/campaigns

  • No labels