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'll send requests to a Talon.One Braze-specific endpoint that generates referrals.
Talon.One requirements
Ensure you already have an Application set up and that it contains a running campaign with the Referrals feature enabled.
You can edit the default format of the referral codes in the campaign's Settings > Referral Codes section.
Braze requirements
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.
Creating an API key in Talon.One
In the Campaign Manager, create a Braze-specific API key:
- In your Talon.One Application, click Settings > Developer settings.
- Click Create API Key.
- For Do you want to use this API Key with a 3rd party service?, select Yes.
- From Platform, select Braze.
- Select an expiration date, and click Create API Key.
- Copy the key for later use.
We will use the API key in the Braze campaign template.
Creating the referral code
To generate a referral code from Braze, we call the following endpoint:
https://integration.talon.one/braze/referral
See API Docs
To trigger the endpoint, we must use Braze's Connected Content feature and Braze's liquid tags.
We assume that your customer profile in Braze contains a unique identifier that is equal to the customer integration ID in Talon.One.
In this tutorial, we use ${user_id}
. Ensure the user ID matches the integration ID in Talon.One.
-
Open your Braze campaign/canvas for editing.
-
According to the Braze docs, add the following Connected Content call to the body of your message, where:
YOUR_DEPLOYMENT_URL
is the base URL of your Talon.One deployment.YOUR_CAMPAIGN_ID
is the ID of your campaign in Talon.One.YOUR_API_KEY
is the API key you created.
{% capture postbody %}
{"deploymentUrl": "YOUR_DEPLOYMENT_URL","campaignId": YOUR_CAMPAIGN_ID,"advocateProfileIntegrationId": "{{${user_id}}}"}
{% endcapture %}
{% connected_content https://integration.talon.one/braze/referral
:headers {"Authorization": "ApiKey-v1 YOUR_API_KEY"}
:method post
:body {{postbody}}
:content_type application/json
:save result
%}
Your referral code is: {{result.code}} -
To test your request:
- Click Preview in the template editor.
- In Preview as User, click Select existing user and search for an existing user in Braze.
You should see a referral code.
noteA new referral code is only generated once per user ID.
Your referral codes are now generated automatically when your campaign is running.