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 set up your Braze account and that you have an active Braze campaign or canvas for which you want to generate referral codes.

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. In your Talon.One Application, 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. From Platform, select Braze.
  5. Select an expiration date, and click Create API Key.
  6. Copy the key 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.