Daily additional points for the fastest buyers
Synerise offers endless possibilities for creating business loyalty scenarios. One of them may be a campaign that ends after a specific number of redemptions and revokes every day. It can increase the traffic in your mobile app. Combining this with additional loyalty points may bring you new customers.
In this use case, you will create a scenario that awards customers with additional 1500 loyalty points for the purchase of a soda. The promotion works every day for the first 1000 buyers. The mechanism controls the number of purchases and informs the mobile app user if they can still get the additional points, or if they are late and need to try again on another day.

Prerequisites
- Create a workspace API key with permissions allowing to calculate metrics and update the catalog.
- Create a schema type.
- Implement transaction events using SDK or API.
- Integrate Synerise mobile SDK in your mobile application.
- Integrate mechanism for awarding loyalty points.
Note: Find more in the Loyalty programs basics use case.
Security configuration
Before you start working with this module, if you are a Synerise customer or partner, consider reading the section about denylisting events. This natively accessible configuration will allow you to manage the restrictions in points management that may help you prevent fraud.Β
Process
In this use case, you will go through the following procedures:
- Create a metric that calculates the number of purchases of soda on the current day.
- Create a catalog which stores the current information for the customers: whether they can get additional points or not.
- Create an automation updating the catalog content and awarding points.
- Create an automation updating the catalog content to the default value. Thanks to this, the mechanism will reset the information about promotion availability every day.
- Create a document with a catalog content which sends the content of the catalog with information for the customer to the mobile app.
Create a metric
In this part of the process, you will create a metric which counts how many times the product on promotion was bought on the current day.
- Go to
Analytics > Metrics > New metric.
- Enter the name of the metric.
- As the metric type, select Simple metric.
- Leave the Aggregator at default (Count).
- As the occurrence type, set All.
- From the Choose event dropdown list, select the product.buy event.
- Click the
button.
- From the Choose parameter dropdown list, select $sku.
- From the Choose operator dropdown list, select Equal.
- As the value of the operator, add the SKU of the product for which you award the additional points.
- Open the time range settings by clicking the calendar icon.
- In the Relative date range section, choose Today.
- Click Apply.
- Click Save.

Create a catalog
In this part of the process, you need to create a catalog, which will store the current information about promotion availability. At later stages of the process, this catalog will be updated on the basis of how many soda transactions have been made on a given day. Also, it will be separately updated at midnight every day when resetting the daily redemption counter.
- Prepare a CSV file of your promotion content, according to requriements.
Below is the sample file used in this article. It consists of two columns, where the first is a message that will be shown to customers and the second is the key of the promotion.
copy;key Buy a soda and get extra loyalty points!;copyKey
Note: You can use this file in your implementation, after changing the message to your business needs. - Go to
Data Management > Catalogs > New Catalog.
- Enter the name of the catalog.
- Click Apply to confirm. The catalog will appear on the list.
- Click on the created catalog.
- In the upper right corner, click Import. Result: A pop-up appears.
- As the import method, select Import a local file.
- Click Next.
- Upload the CSV file you prepare by using the + Upload file or drop one here field.
- Optionally, you can customize the file metacharacters by clicking the arrow down icon.
- From the Delimiter dropdown, select the character that marks the end of a column.
- From the Quotation mark dropdown list, select the characters that contain the text or data type.
- From the Escape character dropdown lists, select the character which changes the default interpretation of a character or a string followed by the escape character.
- To proceed to the next step, click the Next button.
- Select the name of the column which is treated as the primary key.
In our example, itβs
key
. - Click Next.
- Click Run import.

Create an automation updating the catalog content and awarding points
In this part, you will create a workflow which triggers when the product for which you assign additional points is bought. If the result of the metric created earlier is greater than 1000, it will update the catalog with the message that the promotion is over today. If the metric’s result is smaller than 1000, it will grant extra points to the customer.
- Go to
Automation > Workflows > New workflow.
- Enter the name of the workflow.
Define the trigger node
At this stage, you will configure the conditions that trigger the workflow.
- Add the first node - Profile Event. In the node configuration:
- From the Choose event dropdown list, choose the product.buy event.
- Click
button.
- From the Choose parameter dropdown list, select $sku.
- From the Choose operator dropdown list, select Equal.
- As the value of the operator, add the SKU of the product for which you want to award additional points.
- Click Apply.

Define the Outgoing Integration node
In the Outgoing Integration node, you will create a webhook calculating the metric from the previous step. The continuation of the workflow will depend on the result of the metric.
- After the trigger node, add Outgoing Integration.
- Select Synerise API key as your method of authorization.
- From the dropdown list below, select your API key.
- In the Webhook name, field enter a name for the webhook. In this case,
Metric recalculation
. - Optionally, in the Webhook event name field, choose an action name for the event that will be generated when Synerise receives a response from your selected endpoint.
- In the URL section, select the POST method.
- In the URL of the endpoint, enter
https://api.synerise.com/analytics/analytics/v3/metrics/ID/recalculate
, where the ID is the ID of your metric created earlier.
- In the URL of the endpoint, enter
- Optionally, add key-value pairs for headers and the body of the request in the Body section.
- Confirm the settings by clicking Apply.

Define two Event Filter nodes on the metric result
In this step, you will split the automation path, so different actions can happen according to the metric result created earlier. If the result is greater than 1000, it will update the catalog with copy that today the promotion is over. If the metrics result is smaller than 1000, it will grant extra points to the customer.
- Click THEN on the Outgoing Integration node, and add Split Path.
- Add two Event Filter nodes.
- Configure the first Event Filter node:
- Enter the meaningful name of the node, ex.
when promotion is over on the current day
. - From the Choose event dropdown list, choose the webhook.response event.
- Click
button.
- From the Choose parameter dropdown list, select name.
- From the Choose operator dropdown list, select Equal.
- As the value of the operator, add the name of the webhook created earlier.
In this case, it’sMetric recalculation
. - Click the
button.
- From the Choose parameter dropdown list, choose body.result.
- From the Choose operator dropdown list, select More than (Number).
- As the value of the operator, type
1000
. - Click Apply.
Configuration of the first Event Filter node - Enter the meaningful name of the node, ex.
- Configure the second Event Filter node:
- Enter the meaningful name of the node, ex.
when promotion still lasts on the current day
. - From the Choose event dropdown list, choose the webhook.response event.
- Click
button.
- From the Choose parameter dropdown list, select name.
- From the Choose operator dropdown list, select Equal.
- As the value of the operator, add the name of the webhook created earlier.
In this case, it’sMetric recalculation
. - Click
button.
- From the Choose parameter dropdown list, choose body.result.
- From the Choose operator dropdown list, select Less or equal to (Number).
- As the value of the operator, type
1000
. - Click Apply.
Configuration of the second Event Filter node - Enter the meaningful name of the node, ex.
Define the Outgoing Integration node changing the catalog copy
This Outgoing Integration node will be connected to the first Event Filter node (where the condition is that the metric result is above 1000). When the number of sold sodas exceeds 1000, the automation will update the text in the catalog to inform that the offer is no longer available for the current day and the customer will receive such information in the mobile app.
-
To the first Event Filter, add the Outgoing Integration node.
-
As your method of authorization, select Synerise API key.
- From the dropdown list below, select your API key.
-
In the Webhook name, field enter name for the webhook. In this case, it’s
change.documentCopy
. -
Optionally, in the Webhook event name field, choose an action name for the event that will be generated when Synerise receives a response from your selected endpoint.
-
In the URL section, select the POST method.
- In the URL of the endpoint, enter
https://api.synerise.com/catalogs/bags/ID/items
, where the ID is the ID of your catalog created earlier.
- In the URL of the endpoint, enter
-
Enter the request body. For the form used in this case, the body is as follows:
{ "value": { "key": "copyKey", "copy": "Today, the use limit on this offer has already been reached π Come back tomorrow!" }, "itemKey": "copyKey" }
Note: You can use this JSON code in your implementation, but change the names of the columns within the catalog andcopy
content according to your business needs. -
Click Apply.
-
Add the End node.
Define Generate Event node
This Generate event node will be connected to the second Event Filter node. When the number of sold sodas is below 1000, the automation will generate an event granting extra loyalty points to the customers.
-
To the second Event Filter, add the Generate Event node.
-
In the Define event section:
-
As the Event name choose
points.upcharge
. -
In the Label field, type
extra points for buying a soda
. -
Enter the request body. For the form used in this case, the body is as follows:
{ "name": "Extra points for buying a soda", "points": "1500" }
-
-
Click Apply.
Configuration of the Generate Event node -
Add the End node.
Result:

Create an automation updating the catalog content to the default value
In this part of the process, you will create a workflow which triggers at midnight every day and changes the message in the catalog to its default value: information that you can buy a soda and get extra loyalty points.
- Go to
Automation > Workflows > New workflow.
- Enter the name of the workflow.
- As the trigger node, add Scheduled Run.
- In the configuration of the node:
- Leave the Run trigger setting at default (all time).
- In the Repeat runs section, set your Timezone, then choose Everyday and set the time to
0:00
. - Click Apply.
- Add the Outgoing Integration node.
- In the configuration of the node:
-
As your method of authorization, select Synerise API key.
- From the dropdown list below, select your API key.
-
In the Webhook name, field enter name for the webhook. In this case, it’s
change.documentCopy
. -
Optionally, in the Webhook event name field, choose an action name for the event that will be generated when Synerise receives a response from your selected endpoint.
-
In the URL section, select the POST method.
- In the URL of the endpoint, enter
https://api.synerise.com/catalogs/bags/ID/items
, where the ID is the ID of your catalog created earlier.
- In the URL of the endpoint, enter
-
Enter the request body. For the form used in this case, the body is as follows:
{ "value": { "key": "copyKey", "copy": "Buy a soda and get extra 1500 loyalty points! Take advantage of this offer while you still can!" }, "itemKey": "copyKey" }
Note: You can use this JSON code in your implementation, but change the names of the columns within the catalog andcopy
content according to your business needs. -
Click Apply.
-
- Add the End node.
Result:

Create a document with a catalog
In the final step of this process, you will create a document with the catalog created earlier in order to be able to return the catalog content to the mobile application. This will let you display information for the customer whether they can still use the promotion or not.
-
Go to
Data Management > Documents > Add document.
-
Enter the name for your document. A slug (the ID of the document) is filled in automatically.
-
To select the type of schema, in the Type section, open the dropdown list. A schema defines the method of validating the data included in the document.
-
Optionally, in the Description field, you can add a description of the document.
-
In the Content (JSON) section, paste the JSON code:
{ "copy": "{% set key = 'copyKey' %}{% catalog.UC-limited-promotion(key).copy %}" }
Note: The above code contains the JSON object that will be returned to your mobile app. It contains one field (copy
) with the value of message that should be displayed to the customer. This value is retreived using the Jinjava insert that enables to extract values form catalogs. You can use the code in your implementation but change the name of the catalog to the one you have created, as well as the names of the columns within it. -
Click Apply to save the document.

What’s next
For this business scenario and automation to work, creating a document with a catalog is crucial. The mobile application will be able to retrieve the document with the current copy content, with the download document method (Android, iOS, React Native). Then, a JSON file with the raw content will be returned, which the app must properly display to the customer.
Check the use case set up on the Synerise Demo workspace
You can check the:
- catalog
- metric
- automation updating the catalog copy or awarding points
- automation updating the catalog to the default value
- document configurations directly in the 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.