Referral Factory
Referral Factory is a referral marketing platform that helps brands build, launch, and track referral programs. The Referral Factory and Braze integration sends your referrers and referred friends to Braze with their own referral links and codes, logs referral activity as custom events that can trigger Canvases, and lets a Braze Canvas webhook tell Referral Factory when a referred friend becomes a customer so the referrer is rewarded automatically.
This integration is maintained by Referral Factory.
About the integration
Referral Factory runs your referral program: sign-up pages, referral links, tracking, and rewards. Braze runs your customer messaging. When you connect them, each referrer and each referred friend (called a lead in Referral Factory) gets a Braze user profile with their referral link and code, and each referral moment—such as a friend signing up or a reward being earned—is sent to Braze as a custom event.
Marketers can then use Braze to ask the right customers to share, thank referrers at the right moment, welcome referred friends, and tell people about their rewards across push, in-app messages, email, and SMS. When Braze is the first to know that a referred friend made a purchase, a Canvas webhook qualifies the referral in Referral Factory, and your campaign’s reward rules pay the referrer.
Use cases
- Ask customers to refer: When a customer joins your referral program, send them their personal referral link from a Canvas triggered by
RF - Joined program. - Thank referrers in real time: When a friend signs up with a referrer’s link, tell the referrer who joined with
RF - Friend signed up. - Welcome referred friends: Send each new referred friend a welcome offer with
RF - Signed up with referral link. - Celebrate rewards: Tell people what they earned, including a coupon code, with
RF - Reward earnedandRF - Reward paid out. - Re-engage referrers: Send a reminder to share to referrers whose
RF - Number of Referralsis0. - Reward referrals from Braze data: When a referred friend makes a purchase that Braze tracks, a Canvas webhook qualifies the referral in Referral Factory and the referrer gets their reward.
Prerequisites
Before you start, you need the following:
| Requirements | Description |
|---|---|
| A Referral Factory account | A Referral Factory account with at least one campaign is required to take advantage of this partnership. Only the account owner or an Account Admin can connect Braze. To let Braze qualify referrals, your Referral Factory plan must include API access. |
| A Braze REST API key | A Braze REST API key with users.track, users.export.ids, and custom_attributes.get permissions. Create this key in the Braze dashboard from Settings > APIs and Identifiers > API Keys. For more information, see Creating REST API keys. |
| A Braze REST endpoint | Your Braze REST endpoint URL. Your endpoint depends on the Braze URL for your instance. In Referral Factory, you choose it as your Braze server—for example, US-03 for dashboard-03.braze.com. For more information, see REST API endpoints. |
Integration
Step 1: Create a Braze REST API key
- In Braze, go to Settings > APIs and Identifiers > API Keys and select Create API Key.
- Enter a name for the key, for example “Referral Factory”.
- Under Permissions, select
custom_attributes.get,users.track, andusers.export.ids. Braze API keys can’t be edited later, so select all three before you create the key. - Select Create API Key, then copy the key.
Step 2: Connect Braze in Referral Factory
- In Referral Factory, select your campaign and go to Integrations and API > Messaging.
- On the Braze card, select Connect.
- Paste your REST API key and pick your Braze server. The server matches your Braze dashboard URL—for example, US-03 for
dashboard-03.braze.comor EU-01 fordashboard-01.braze.eu. - Select Connect. Referral Factory checks the key and its permissions. Nothing is written to Braze at this point.
The connection is saved for your whole Referral Factory account. Each campaign then has its own setup.
Step 3: Set up your campaign
After you connect, Referral Factory walks you through a short setup for the campaign. Nothing is sent to Braze until you select Finish setup.
- People: Choose who to send to Braze: leads (referred friends), referrers, or both. Then choose what happens when the person already exists in Braze: Do nothing (existing users only get events) or Update if exists (existing users also get their profile fields updated).
- Profile fields: Use your own Braze custom attributes, or let Referral Factory create new custom attributes whose names start with
RF -. - Map fields: Choose which Braze attribute receives each Referral Factory value. Email and first name are always sent. To match users by
external_idinstead of email, map the Referral Factory field that holds your user ID to External ID. - Events: Turn on the referral events you want to send to Braze.
- Qualification: If you send leads, choose whether Braze tells Referral Factory when a lead becomes a customer. See Qualify referrals with a Canvas webhook.
- Select Finish setup.
Right after you finish, Referral Factory adds the new custom attributes and events to Braze so you can use them in segments and Canvases the same day. To do this, it creates one test user with the external ID referral-factory-test, and its events have the property test set to true. You can delete this user later.
From then on, Referral Factory sends user data and events to Braze in real time with the /users/track endpoint whenever someone joins, signs up with a referral link, shares, or earns a reward.
Customize Referral Factory
Step 1: Choose the custom attributes
If you let Referral Factory create new attributes, you can choose from the following. You can also map any other Referral Factory field to your own Braze attributes.
| Custom attribute | Saved on | Description |
|---|---|---|
RF - Referral Link |
Leads and referrers | The person’s own referral link. |
RF - Referral Code |
Leads and referrers | The person’s own referral code. |
RF - Campaign |
Leads and referrers | The Referral Factory campaign name. |
RF - Campaign ID |
Leads | The Referral Factory campaign ID. Always added for leads, because qualification from Braze uses it. |
RF - Referred By |
Leads | The email of the referrer. |
RF - Referral Status |
Leads | The referral status, for example pending or qualified. |
RF - Number of Referrals |
Referrers | How many friends signed up with the referrer’s link. |
RF - Customers Referred |
Referrers | How many of those friends became customers. |
Step 2: Choose the custom events
Every event has the property campaign with the Referral Factory campaign name. Some events have more properties.
| Custom event | When it is sent | Other properties |
|---|---|---|
RF - Joined program |
A referrer joins the referral program. | referral_link, referral_code |
RF - Signed up with referral link |
A lead signs up with a referral link. | referrer_name, referral_code |
RF - Friend signed up |
A friend signs up with the referrer’s link. Saved on the referrer. | friend_name |
RF - Became customer |
A lead becomes a customer. | referrer_name |
RF - Friend became customer |
A referred friend becomes a customer. Saved on the referrer. | friend_name |
RF - Shared link |
A person shares their referral link. | channel, for example WhatsApp |
RF - Reward earned |
A person earns a reward. | reward, reward_name, coupon_code |
RF - Reward paid out |
A person’s reward is paid out. | reward, reward_name, coupon_code |
RF - Reward cancelled |
A person’s reward is cancelled. | reward, reward_name, coupon_code |
RF - Reward failed |
A person’s reward could not be paid out. | reward, reward_name, coupon_code |
RF - Goal reached |
A person reaches a campaign goal. | goal_name |
The shared, reward, and goal events can be saved on both leads and referrers. To reach only one group in a Canvas, add an audience filter. For example, RF - Campaign ID is only saved on leads.
Use Referral Factory with Braze
Step 1: Trigger a Canvas from a referral event
- In Braze, go to Messaging > Canvas and select Create Canvas.
- In Entry Schedule, choose Action-Based. Select Perform Custom Event and pick a Referral Factory event, for example
RF - Reward earned. - Add a Message step with the channel you want: push, in-app message, email, or SMS.
- Personalize the message with Liquid. For example:
- Referral link:
{{custom_attribute.${RF - Referral Link}}} - Referral code:
{{custom_attribute.${RF - Referral Code}}} - Event property in a Canvas:
{{canvas_entry_properties.${reward}}} - Event property in a campaign:
{{event_properties.${reward}}}
- Referral link:
- If you mapped Referral Factory values to your own attributes, use your attribute names instead.
- Launch the Canvas.
Step 2: Qualify referrals with a Canvas webhook
Use this step when Braze knows first that a referred friend became a customer—for example, from a purchase in your app. It requires a Referral Factory plan with API access.
- In Referral Factory, in the Qualification step of the Braze setup, choose Yes, Braze tells us. Referral Factory shows the webhook details with your API key and a copy button for each value.
- In Braze, create a Canvas. In Entry Schedule, choose Action-Based and select the action that means the lead became a customer, for example Make Purchase or a custom event.
- In Target Audience, add the filter Custom Attributes >
RF - Campaign ID> more than >0, so only referred friends enter. - Add a Message step with the Webhook channel and fill out the following fields:
- Webhook URL:
https://api.referral-factory.com/api/v3/leads/qualification - HTTP Method:
PUT - Request Headers:
- Authorization:
BearerYOUR_REFERRAL_FACTORY_API_KEY - Content-Type:
application/json
- Authorization:
- Request Body: Raw Text
{ "campaign_id": "{{custom_attribute.${RF - Campaign ID}}}", "email": "{{${email_address}}}", "qualified": true }
- Webhook URL:
- Launch the Canvas.
When the Canvas runs, the lead is qualified in Referral Factory and your campaign’s reward rules decide the referrer’s reward. If your campaign has custom goals, you can mark them as reached the same way with the webhook URL https://api.referral-factory.com/api/v3/leads/goal and the request body that Referral Factory shows for each goal.
Considerations
- Referral Factory finds existing Braze users by email, or by
external_idif you map it. New leads and referrers are always created in Braze. - When you finish the setup, Referral Factory creates one test user in Braze with the external ID
referral-factory-test. Referral Factory uses this user to add the new custom attributes and events to Braze right away, so you can use them in segments and Canvases the same day. Its events have the propertytestset totrue. If you turn on new attributes or events later, this user is used again. You can delete this user at any time. - Data is sent only for activity that happens after you finish the setup. To send a person who joined earlier, use Sync with Braze in the actions menu on their row in Referral Factory.
- Each Referral Factory campaign has its own Braze setup, but the
RF -attributes have the same names in every campaign. If one person is in two campaigns, their attributes show the campaign that updated them last. - Custom attributes and custom events sent by Referral Factory may count toward your Braze data point usage. Only turn on the attributes and events you plan to use.
- Use the Sending to Braze switch in Referral Factory to pause sending for one campaign. If you disconnect Braze, sending stops, your setup is kept, and nothing is deleted from Braze.
Troubleshooting
| Issue | Fix |
|---|---|
| Braze won’t connect | Check that you copied the whole key and picked the server that matches your Braze dashboard URL. If the error names missing permissions, create a new key with users.track, users.export.ids, and custom_attributes.get, because Braze keys can’t be edited. |
| A user isn’t in Braze | Check that the person’s group (leads or referrers) is selected in the People step and that Sending to Braze is on. New users can take a minute to appear. |
| An event or attribute is missing from a Braze list | New custom events and attributes can take a few minutes to appear. In Referral Factory, select Reload Braze fields to refresh the attribute list. |
| Existing users aren’t updated | The campaign is set to Do nothing for users who already exist in Braze. Change the People step to Update if exists. |
| The Canvas webhook doesn’t qualify leads | Check the error in Settings > Message Activity Log. A 401 error means the Referral Factory API key is wrong, a 403 error means the plan has no API access, and a 404 error usually means the URL is wrong or the user isn’t a lead in that campaign. If you edited a live Canvas, select Update Canvas so your changes are used. |
For more help, see the Referral Factory Braze help guides or contact Referral Factory support.