Skip to main content

Creating referrals via Braze

In this tutorial, let's set up Braze to automatically generate referrals inside Talon.One and deliver the referral codes to specific customer segments.

To do so, we will rely on a Talon.One Braze-specific endpoint that will generate referrals and we'll send requests to it from Braze.

Setting up your Braze account

We assume that you have setup your Braze account and that you have an active Braze campaign or canvas for which you want to generate referral codes.

Set Delivery Speed Rate-Limiting in your Braze settings to a maximum of 5000. Using a higher rate limit can create issues during referrals creation or can prevent referrals from appearing in the message sent via Braze.

See more about rate limiting in Braze: Delivery Speed Rate-Limiting.

note

If you're not using Braze, see the generic customer engagement platform endpoints.

Setting up your Talon.One campaign

Ensure you already have an Application set up and that it contains a running campaign with the Referral feature enabled.

Referral settings

We can edit the format of the referral codes for any campaign by going to the referral code generator for that campaign:

  1. Open the campaign.
  2. Click Settings > Referral Codes.
  3. Edit the format as needed.

Authenticating

Let's create a Braze-specific API key in Talon.One:

  1. Open your Talon.One Application in the Campaign Manager and click Settings > Developer settings.
  2. Click Create API Key.
  3. For Do you want to use this API Key with a 3rd party service?, select Yes.
  4. Select Braze from the dropdown.
  5. Select and expiry date and click Create API Key.
  6. Copy it for later use.

The Braze-integration referral endpoint

To generate a referral from Braze, we call the following endpoint:

POST Create referral
https://integration.talon.one/braze/referral
See API Docs

Displaying the referral code in Braze

To trigger the Talon.One referral creation endpoint, we must use Braze's connected content feature and Braze's liquid tags.

You can use it in every campaign message body or any canvas message body.

  1. Open your Braze campaign/canvas for editing.

  2. Insert the following connected content that include authentication and the method (post) of the request that uses the Braze-specific token you generated earlier.

    We define all the body properties in the capture statement first.

    {% capture postbody %}
    {"deploymentURL": "mycompany.europe-west1.talon.one","ApplicationID":398,"campaignID": 5672,"advocateProfileIntegrationId": "2"}
    {% endcapture %}

    {% connected_content https://integration.talon.one/braze/referral
    :headers {
    "Authorization": "ApiKey-v1 ..."
    }
    :method post
    :body {{postbody}}
    :content_type application/json
    %}
  3. Add the save parameter at the end to store the Talon.One response as a Braze variable called result and display its code property.

    {% capture postbody %}
    {"deploymentURL": "mycompany.europe-west1.talon.one","applicationID":398,"campaignID": 5672,"advocateProfileIntegrationId": "2"}
    {% endcapture %}

    {{postbody}}
    {% connected_content https://integration.talon.one/braze/referral
    :headers {
    "Authorization": "ApiKey-v1 ..."
    }
    :method post
    :body {{postbody}}
    :content_type application/json
    :save result
    %}

    Your referral code is: {{result.code}}
  4. Test your connected content by clicking Preview. You should see a referral code.

Your referral codes are now generated automatically when your campaign is running.