Voucher pool alert

Published April 05, 2023
Modules
Difficulty

A voucher pool is a form of digital currency that allows businesses to provide rewards and incentives to their customers for engaging with their products or services. The pool of voucher codes can be redeemed for a variety of items, such as discounts, coupons, or special offers. While setting up a voucher pool, you typically add a certain number of codes to the pool, so it’s a good practice to implement a kind of monitoring system that alarms you when codes in the voucher pool are slowly running out.

In this use case, you will learn how to build a monitoring system for all voucher pools you have in your workspace. The system will alert you when the number of codes in a voucher pool drops below a predetermined threshold (500 codes in a pool). This alert serves as a reminder for the business to replenish the pool with more codes, as well as an alert to customer service teams to communicate with customers to ensure they are aware of the updated balance.

There are even more benefits:

  • the monitoring system helps businesses avoid running out of vouchers, which can lead to customer dissatisfaction and loss of revenue.
  • it helps businesses ensure they have enough vouchers available to meet customer needs and maximize sales.
  • it allows businesses to plan ahead and easily adjust their voucher pool when needed.
  • this system allows businesses to quickly and efficiently track their voucher pools, making it easier to identify any discrepancies or irregularities.

In this use case, we present a method in which we create a profile in the Profiles module for each voucher pool we want to monitor (1 voucher pool = 1 profile). This will enable us to set up a workflow which will monitor the number of active vouchers and send an alert when the number of codes in a pool drops below 500.

Prerequisites


  • Implement a tracking code.
  • Configure an email account.
  • Depending on your needs, you can send to a customer a general code with promotion, eg. SHOPPING20%, or coupon code individually for each customer. If you decide on this second option, you will have to import coupons to Synerise prepared in your ecommerce platform which will apply the appropriate discount in the shopping cart. In this article, you will find the rules and procedures needed to create and use voucher pool in Synerise.
  • You must have an API key of the Workspace type and in the permission matrix: VOUCHERS_ITEM_LIST_BY_POOL_READ permission must be checked, otherwise the webhook response will return the 403 error code.

Process


In this use case, you will go through the following steps:

  1. Add voucher pools to Profiles.
  2. Prepare an email template.
  3. Create a workflow which sends the email alert if the number of unassigned codes in a pool will be lower than 500.

Add voucher pools to Profiles


In this part of the process, you will create Synerise profiles for each voucher pool you want to monitor, where 1 voucher pool = 1 profile in the Profiles module. You can add them manually or using API. In this case, we present how to add them manually, API method is described below in the advanced section.

  1. Go to Profiles.
  2. Click Add new > Profile.
  3. In the firstname box, add Voucher Pool 1.
  4. In the email box, add any fake email, for example fakevoucher1@pool.com.
  5. In the properties section, select the voucherpool_id attribute, and as the value, add the ID of the voucher pool which you can find in the URL of a specific pool.
    Tip: If your workspace lacks the voucherpool_id attribute, you can add it in Data Management > Params Manager.
  6. Click Create.
    Result: The separated profile for the voucher pool will be generated in the Profiles module in Synerise.
    Advanced version of adding pools using API

    Below you will find cURL with a ready request, which you can use in the Postman tool, where:

    • token - authorization token
    • firstName - voucher pool name
    • voucherpool_id - voucher pool ID for a specific pool (in Data Management > Voucher Pools, enter the details of the voucher to retrieve its ID from the URL)
    • customId - voucher pool ID for a specific voucher (in Data Management > Voucher Pools, enter the details of the voucher to retrieve its ID from the URL)
    • optionally, tag in this case is voucher_campaign
    curl --location --request POST 'https://api.synerise.com/v4/clients/batch' \
    --header 'Accept: application/json' \
    --header 'Api-Version: 4.4' \
    --header 'Authorization: Bearer xxx' \
    --header 'content-type: application/json' \
    --data-raw '[
        {
           
            "customId": "Insert a voucher pool ID here",
            "firstName": "Insert a voucher pool name",
            
            "agreements": {
                
            },
            "attributes": {
              
                "voucherpool_id": "Insert a voucher pool ID here"
            },
            "tags": [
                "voucher_campaign"
            ]
        }
    ]'
    Note: In this code we used the specific method from our API. Read also about the authorization process.

    Send this request as many times as you need, just changing the voucherpool_id, firstName, and customId parameters. The voucher pools created in the Profiles module will be available on the list of unrecognized profiles.

Prepare an email template


In this part of the process, prepare an email alert template that includes the information about the number of unassigned codes remaining in a voucher pool.

  1. Go to Image presents the Communication icon Communication > Email.
  2. On the left side of the screen, click Templates.
  3. Select the wizard.
  4. In the content of the message, add this insert:
       {%set link = "https://app.synerise.com/assets/vouchers/pools/*/coupons"%}
       <p>{{customer.firstname}},</p>
       <h1> Alert for Voucher pool: {{customer.firstname}} </h1>
       <p> Remaining: {{ event.params['voucherCount'] }} vouchers </p>
       <a href='{{link|replace("*",customer.voucherpool_id)}}'>
       <p> Link to voucher pool {{customer.firstname}} </p></a>
       
  5. Adjust the design of the template according to your needs.
  6. Save the template.

Create a workflow


In this step create a workflow which sends the email alert if the number of codes in a voucher pool is lower than 500.

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

Configure the Audience node


In this part of the process, select the audience for which you will run this campaign - all vouchers added as profiles. In our case, we start the workflow everyday at 7 A.M., for profiles (voucher pools) who has the voucherpool_id parameter defined.

Note: In this case, we use the voucherpool_id parameter, but you can use any other parameter or tag which is assigned to your profiles (voucher pools). In our case based on the contents of cURL presented in previous steps, it might be for example a tag: voucher_campaign.
  1. Click Add trigger.
  2. From the dropdown list, select the Audience node.
  3. Leave the Run trigger option as default (repeatable).
  4. Define the values for the Interval (frequency), Begin at, and Timezone fields according to your business requirements. In our case, it will be every day at 7 A.M.
  5. In the Define audience section, click New audience.
  6. Click Define conditions.
  7. From the Choose filter dropdown list, select the voucherpool_id.
  8. From the Choose operator dropdown list, select String and Is not empty.
  9. Confirm by clicking Apply.
Configuration of the Audience node
Configuration of the Audience node

Add the Outgoing Integration node


This node will be used to send a request to get the number of codes available in the voucher pools. You will use the following method: https://api.synerise.com/v4/vouchers/item/count/{{client.voucherpool_id}}.

  1. Click THEN.
  2. From the dropdown list, select Outgoing Integration.
  3. Select the Custom webhook tab, and API Key authorization.
  4. From the dropdown list, select the Workspace API key that has enabled this permission: VOUCHERS_ITEM_LIST_BY_POOL_READ.
  5. In the Action name field, enter Check Voucher Pool (you can use different name, it’s just an example).
  6. Select the POST method.
  7. In the Endpoint field, enter https://api.synerise.com/v4/vouchers/item/count/{{client.voucherpool_id}} where {{client.voucherpool_id}} will be dynamically replaced with the ID of the monitored voucher pool.
  8. Leave content-type at default: application / json.
  9. Click Add header.
  10. Add Api-Version with the value set to 4.4
  11. Click Add header.
  12. Add Accept with the value set to application/json.
  13. Leave the request body at default (with {}).
  14. Confirm the settings by clicking Apply.
The configuration of the Outgoing Integration node
The configuration of the Outgoing Integration node

Configure the Event Filter node


This node will be used to wait for the webhook response. Set the waiting time to 5 minutes, this period is recommended as it eliminates the possibility of the workflow completion due to lags in response.

  1. As the next node, add Event Filter. In the configuration of the node:
    1. In the Check field, from the dropdown menu choose for period of time.
    2. Set the time range. In our case, it is 5 minutes.
    3. In the Define conditions section, from the Choose event dropdown list, choose webhook.response event.
  2. Confirm by clicking Apply.
  3. For the Not matched path, add the End node.
  4. For the Matched path, add the Generate Event node.
The configuration of the Event Filter node
The Event Filter node

Define the Generate Event node


At this stage, we are checking the difference between the number of assigned and used codes. The parameter for the custom.event can be named in different way, in our case it will be voucher.check. It will be responsible for showing the difference between the vouchers. This event will be generated only for those persons/vouchers that are in this group.

  1. To the Matched path, add Generate Event.

  2. In the Event name, enter the name of the event that will be generated on the customer’s profile. In this case, it is custom.event.

  3. In the Label add the text which will be visible in the raw data of the event, in our case it will be voucher.check.

  4. In the Body section, use the code below, and click Apply.

    {
      "voucherCount": "{{event.params['body.data.activeCount'] - event.params['body.data.assignedCount']}}"
    }
        
The configuration of the Generate Event node
The Generate Event node

Configure the Event Filter node

This node will check if the amount of codes dropped below a certain level. For us, it is 500. We will check it based on the event generated in the previous step.

  1. As the next node, add Event Filter. In the configuration of the node:
    1. In the Check field, from the dropdown menu choose for period of time.
    2. Set the time range. In our case, it is 10 minutes.
    3. In the Define conditions field, from the Choose event dropdown menu, choose custom.event.
    4. Click + where.
    5. As the parameter, choose voucherCount
    6. Choose Less than (Number).
    7. Set the value to 500.
  2. Confirm by clicking Apply.
The configuration of the Event Filter node
The Event Filter node

Configure the Email Alert node


In this step, if the number of vouchers has decreased below 500, an email alert will be sent to email addresses selected in the configuration of the node. After sending the email alert, the workflow ends.

  1. Add Email Alert. Configure according to your business needs.
  2. Define Content:
    1. In the Template for content field, select an alert email template prepared earlier.
    2. In the Subject field, enter your message subject.
  3. In the Recipent section, create a list of recipients of the alert email.
  4. Confirm by clicking Apply.
  5. Add the End node.
  6. Click Save & Run.
The configuration of the Automation
The Automation configuration

Check the use case set up on the Synerise Demo workspace


You can check the workflow configuration directly in Synerise Demo workspace.

If you don’t have access to the Synerise Demo workspace, please leave your contact details in this form, and our representative will contact you shortly.

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