Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Benjamin Reynolds (Deactivated) recording → Targeted Coupons Through Braze-20220322_123641-Meeting Recording.mp4

Sanity config

Use Required assignment ruleset

On the offer in sanity, set the ‘requires assignment' rule

Example: https://prod-bk-menu.co.uk.rbi.tools/desk/orderLevelContent;menu;legacyOffers;offer;0cb01728-8081-4081-846b-0bdd81ede247

Find here documentation on Sanity rulesets

...

Table of Contents
minLevel1
maxLevel7

Assign Offers to Users Using Braze Webhook

Sanity Setup

  • Create a Config Offer (e.g. config offer for for BK UK)

    • you will need a different Config Offer created for each offer you would like to assign using Braze

    • save the Loyalty Engine ID of the template offer to input into Braze after

      Image Added
    • within this config offer, in the Mechanics dropdown under Benefits you will need to link the offer benefits (e.g. Picker or Offer Combo)

      Image Added
    • Make sure to add the config offer to the list of Live Config Offers in the Live Offers in Sanity, so the offer shows in the app to the user after it is assigned

      Screenshot 2024-05-24 at 14.07.28.pngImage Added
Info

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 Configuration

Body request

Code Block
languagejson
{
  "couponIdemail": "0526d543-3871-4e9c-bec5-327ebcd3f1db{{${email_address}}}",
  "tokenIdsource": "braze-test",
  "testerrank": 123456, (optional)
  "userIdconfigId": "{{${user_id}}}",Loyalty engine id of config offer",
  "ruleParams": {
    "expiresOnstartDate": "2020yyyy-08-11T08:59:59.000Z"
}

...

mm-dd",
    "endDate": "yyyy-mm-dd"
  }
}

...

  • Replace configId with the Loyalty Engine ID of the offer you want to assign using Braze

  • tokenId should be a unique identifier for each campaign

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

  • email -> leave as is

  • expiresOn -> this field determines when the offer assignment will expire, so i.e. the end of the offer life

Request headers

Webhook URL

Note

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-> required fields; the endDate must be set after the startDate - this represents the duration of time the offer assignment will be available for

  • 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)

Request headers

Webhook URL
Info

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:

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

Example of the Cold Webhook URL in Production:

Code Block
https://prod-bk-loyalty-middleware.rbictg.com/api/v2/braze/webhooks/assign-coupon-token
Info

Make sure you use v2 - in the past the URL used to be v1

Authorization

Code Block
Authorization: Basic SCYkKk1tTnVQIiVtJCJLcUVpOWRpfmBEK3pJYkwlN24yLFhGbnpRfDpNWi4hcVgvRWI5dkZxTy45bXleNVFTTXkwZFo6WkdOJFwualRDeWFs/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)

Content-type
Code Block
languagejson
Content-Type: application/json
X-Region
Code Block
x-region: gb
Info

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

X-Api-Key
Code Block
x-api-key: string
Note

Please reach out to Lopes da Costa, Valentina or another PM to get you access to the API Key in Production or Staging for your brand

...

Info

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:

Code Block
"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).

Note

startDate and endDate are part of the Date Band rule, which always counts from 00:00 to 23:59 from their respective dates.

Note

Be extremely careful and test your webhooks, once an offer is assigned to a user its rules CANNOT be changed from Sanity.

Other resources

Assign Loyalty Points to Users Using Braze Webhook

Tip

This can be used for all Markets with Loyalty

Body request

Code Block
languagejson
{
"pointsEarned": 500,
"source": "braze",
"email": "{{${email_address}}}"
}
  • Replace pointsEarned with the amount of points you would like users that receive this Braze web hook to receive

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

  • email -> leave as is

Note

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}}}"

Request headers

Webhook URL
Info

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:

Code Block
https://prod-bk-loyalty-middleware.rbictg.com/bulk-action/hot/assign-points

Example of the Cold Webhook URL in Production:

Code Block
https://prod-bk-loyalty-middleware.rbictg.com/bulk-action/cold/assign-points

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/assign-points)

Content-type
Code Block
languagejson
Content-Type: application/json

...

X-Region
Code Block
x-region: gb
Info

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

X-Api-Key
Code Block
x-api-key: string
Note

Please reach out to Lopes da Costa, Valentina or another PM to get you access to the API Key in Production or Staging for your brand

...