12th Apr 2021

Creating a referral program

About referral programs

A referral program is defined by an advocate, a referrer and a referral code.

  • The advocate is the person who invited their friend via referral program.
  • The friend is the person who receives the invite from an advocate
  • The referral code is a code which is generated similar to a coupon code the code can be redeemed by either one or multiple referrers.

If a referral code has been generated, it can be viewed in the referral tab of the respective campaign. As well as coupon codes, referral codes can be generated according to certain parameters:


Setting up a referral program

  1. Generate a referral code

    This can be done either by using the generateReferralCode endpoint in the integration API or by selecting Create referral code as an effect in a certain rule. If you want to set an expiry date, start date or if you want to link the referral coupon to a specific friend, generate the code through the integration API.

    1. Generating referral codes using the API

      curl https://example.talon.one/v1/referrals \
      -X POST \
      -d '{
          "advocateProfileIntegrationId": "88",
          "campaignId": 58,
          "expiryDate": "2018-05-28T15:22:48.351041+02:00",
          "friendProfileIntegrationId": "36",
          "startDate": "2018-02-12T15:22:48.351041+01:00"

      More detailed information about the parameters can be found here: createReferral

    2. Generating referral codes using an effect

      If there is more than one referral campaign in your application, you can choose in which campaign the referral code can be redeemed (second campaign in this case):


      The integration API will return a referralCreated effect:

      "referralCreated",       // effect type
      "REFERRALCODE",            // referral code
      "friendProfileIntegrationId"  // Customer profile ID for the customer that can redeem this referral code
  2. Handling referral codes

    Referral codes can be sent within the session like a coupon code:

    curl https://example.talon.one/v1/customer_sessions/C156902 \
      -X PUT \
      -d '{
       "profileId": "35",
       "referral": "kg5yldcv1i"

    Afterwards you will receiver either: acceptReferral or rejectReferral:

     "acceptReferral", // effect type
     "MYREFCODE"       // referral code


     "rejectReferral", // effect type
     "MYREFCODE"       // referral code
Still need help? Get in touch!
Last updated on 12th Apr 2021

Was this article helpful?

Thank you! You have already voted

If you’d like a member of our support team to respond to you, please send a note to support@talon.one