Voucher-based referral program

Published April 16, 2024
Modules
Difficulty

Creating a solid loyalty program is key to building lasting relationships with customers. Among the countless strategies to achieve this, the use of discount codes stands out as a powerful tool. Implementing a referral program based on discount codes opens up many opportunities to attract new users, while encouraging current users to engage more deeply. These codes not only encourage customers to make additional purchases, but also serve as a channel to expand our customer base through word-of-mouth referrals.

What’s more, this referral system isn’t just advantageous for the invitee; it’s a win-win scenario that rewards both the inviter and the invitee when the shopping voucher is utilized.

In this use case, the loyalty program works by giving customers a discount code that they can share with their friends after they’ve made a purchase. If a friend then uses this code to buy something, the original customer gets a reward, usually in the form of another discount. These discount codes are shared through email. This approach keeps customers engaged and encourages them to spread the word, benefiting both the business and its customers.

Prerequisites


  • Create an email account which you will use to send emails.
  • Implement transaction events using SDK or API. Additionally, implement a custom parameter for the transaction.charge event, which will contain the coupon code that was used in the transaction. In our case, we will use the discountCode parameter.
  • Create two different voucher pools:
    • One pool is for voucher codes that customers can share with their friends.
    • The second pool contains rewards for customers after someone they shared a voucher code with makes a purchase using the code from the first pool.
      Tip: To easily identify discount codes in the next process steps, you can start each voucher with the same set of letters. For example, use prefixes like SPR_F45670, SPR_J20948.
  • Meet all requirements necessary to redeem a voucher
  • Make two types of email templates:
    • One for customers who have made a purchase and will get a voucher code to share with friends.
    • Another for customers whose shared voucher code was used by a friend, so they get a new voucher code for themselves.
      Note:

      We recommend using Jinjava in templates to retrieve the voucher code for the customer. To get the same voucher code, use this Jinjava code:

      {% voucher assign=false %} pool-uuid {% endvoucher %}

Process


  1. Create a workflow that sends a discount code to customers who have made a transaction to share the code with another person.
  2. Create a workflow that checks the use of the code by the recipient of the code.
  3. Create a workflow that will reward a customer from the first workflow who gifted someone with the code.

Create first workflow


This workflow is used to send a discount code to customers who have made a transaction to share the code with another person.

  1. Go to Automation > Workflows > New workflow.
  2. Enter the name of the workflow.

Define the Profile Event trigger node


  1. As the first node of the workflow, add Profile Event. In the node settings:
    1. Click Choose event and from the dropdown list, select the transaction.charge event.
    2. Confirm by clicking Apply.
    Profile Event trigger configuration
    Profile Event trigger configuration

Configure the Send email node


In this part of the process, send email communication to customers who have made a transaction. Following the allocation of a voucher to a customer, a voucherCode.assigned event will be recorded in their customer profile.

  1. Add the Send Email node and open its settings.
  2. In the Sender details section, choose the email account from which the email is sent.
  3. In the Content section, select the template that you prepared as a part of the prerequisites.
  4. Optional: In the UTM & URL parameters section, define the UTM parameters added to the links included in the email.
  5. Optional: In the Additional parameters section, assign additional parameters to the events generated by interactions with the message.
  6. Confirm by clicking Apply.

Configure the Event filter node


In this step, we verify if the voucherCode.assigned event has been generated for a customer.

  1. Add the Event Filter node. In the configuration of the node:
    1. Enter the title of the node, (for example, we use voucherCheck).
    2. Check event for period of time.
    3. Define the time range to 5 Minute.
    4. From the Choose event dropdown list, select the voucherCode.assigned event.
    5. As the event parameter, select poolName.
    6. From the Choose operator dropdown list, select Equal.
    7. As the value, enter the name of the voucher pool you are referring to.
    8. Confirm by clicking Apply.
    Event filter node configuration
    Event filter node configuration
  2. For the not matched path, select the End node.
  3. For the matched path, select the Update profile node.

Add the Update Profile node


In this step, assign an attribute to customer’s profile with the value of the voucher code. In our case, we use my_refferal_code attribute.

  1. For the Matched path, add the Update Profile node.
  2. Click dropdown list and create my_refferal_code attribute.
  3. From the next dropdown list, choose Change operator.
  4. In the Value section, insert the following jinjava which will display as the voucherCode:
    `{{ automationPathSteps['voucherCheck'].event.params.voucherCode }}`
    Note that voucherCheck is the name of the Event Filter trigger added manually.
    Update Profile node configuration
    Update Profile node configuration
  5. To save the changes, click Apply.
  6. Add the End node.
    Final view of the workflow configuration
    Final view of the workflow configuration

Create second workflow


This workflow will be used to redeem discount code.

  1. Go to Automation > Workflows > New workflow.
  2. Enter the name of the workflow.

Define the Profile Event trigger node


  1. As the first node of the workflow, add Profile Event. In the node settings:
    1. Create name for this node, as it will be used later in the workflow.
    2. Click Choose event and from the dropdown list, select the transaction.charge event.
    3. Click +where and from the dropdown list, select discountCode parameter.
    4. From the Choose operator dropdown list, select Starts with (String).
    5. In the Value section insert the prefix that is used in all codes from the first voucher pool you created as a part of prerequisites. In our case it’s SPR prefix.
    6. Confirm by clicking Apply.
    Profile Event trigger configuration
    Profile Event trigger configuration

Configure the Profile filter node


This Profile filter creates a security measure so that this code cannot be used by people who received it through the first workflow.

  1. Add the Profile Filter node. In the configuration of the node:
  2. From the Choose filter dropdown list, select the my_refferal_code attribute.
  3. From the Choose operator dropdown list select Starts with (String).
  4. In the Value section, insert the prefix that is used in all codes from the first voucher pool you created as a part of prerequisites. In our case it’s SPR prefix.
  5. Modify the Profile matching attribute to Profile not matching.
  6. From the Choose filter dropdown list, select the voucherCode.assigned event.
  7. Click +where and from the dropdown list, select poolName parameter.
  8. From the Choose operator dropdown list, select Equal (String)).
  9. In the Value section insert the prefix that is used in all codes from the first voucher pool you created as a part of prerequisites. In our case it’s SPR prefix.
  10. Modify the Profile matching attribute to Profile not matching.
  11. Define the time period for which the event will be calculated.
  12. Use the AND logical operator to connect set rules.
  13. Confirm by clicking Apply.
    Event filter node configuration
    Event filter node configuration
  14. For the not matched path, select the End node.
  15. For the matched path, select the Outgoing integration node.

Configure the Outgoing Integration node


In this step, we will redeem the used coupon during the transaction using Synerise API reference.

  1. Add Outgoing Integration node.
  2. In Definition section, choose the Custom tab.
  3. Choose Webhook connection type.
  4. Select a connection.
    If you haven’t created any connection yet, see instructions in “Set up a connection” section.
  5. In the Webhook name, enter your preferred name. The value of this field will be stored as a Name parameter in the response event. It makes it easier to identify the event and is useful for creating analysis. In our use case, we will use the following name voucherRedeemed.
  6. Define the Webhook event name. In our use case, we use the voucherCode.redeemed event.
    Note: This is the event key. While naming it, follow the pattern used for the default events in the application such as page.visit, product.buy and so on.
  7. In the URL section, choose the POST method.
  8. Enter the following URL: https://api.synerise.com/v4/vouchers/item/redeem
  9. In the Key field, enter Accept and in the Value field, enter application/json
  10. Click Add header.
  11. Add Accept with application/json
  12. In the Key field, enter Api-Version and in the Value field, enter 4.4
  13. In the Body section, enter the following Jinjava:
        {"code":"{{ automationPathSteps['transactionCode'].event.params.discountCode }}"}
        

    Note that transactionCode is the name of the Profile Event trigger added manually.
    In this Jinjava we reference to code that has been used. Because this code was assigned in the first workflow to the user who shares it, the voucherCode.redeemed event (which is the result of using this API request) is assigned to the profile of the person who shares the code. Such configuration is crucial for the third workflow which sends out reward discount code which is based on the voucherCode.redeemed event.
  14. Confirm by clicking Apply.
    Outgoing integration node configuration
    Outgoing integration node configuration
  15. Add the finishing End node.
    Final view of the workflow configuration
    Final view of the workflow configuration

Create third workflow


This workflow will send a reward to a customer from the first workflow after the code they shared with someone has been used.

Define the Profile Event trigger node


The worflow is triggered by the voucherCode.redeemed event which was generated in the previous workflow.

  1. As the first node of the workflow, add Profile Event. In the node settings:
    1. Click Choose event and from the dropdown list, select the voucherCode.redeemed event.
    2. Click + where and from the dropdown list, select poolName.
    3. From the Choose operator dropdown list select Equal (String).
    4. As the value, enter the name of the voucher pool you are referring to.
    5. Confirm by clicking Apply.
    Profile Event trigger configuration
    Profile Event trigger configuration

Configure the Send email node


In this part of the process, send email communication to customers who previously shared the code. They’ll receive a reward in the form of a voucher code for their own use.

  1. Add the Send Email node and open its settings.
  2. In the Sender details section, choose the email account from which the email is sent.
  3. In the Content section, select the template that you prepared as a part of the prerequisites.
  4. Optional: In the UTM & URL parameters section, define the UTM parameters added to the links included in the email.
  5. Optional: In the Additional parameters section, assign additional parameters to the events generated by interactions with the message.
  6. Confirm by clicking Apply.
  7. Add the End node.
    Final view of the workflow configuration
    Final view of the workflow configuration

Check the use case set up on the Synerise Demo workspace


Check all items (metrics and dynamic content) created in this use case in our Synerise Demo workspace:

Read more


😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker