Push notification with price drop alert

Published March 15, 2024
Modules
Difficulty
Selected Clients
empik logoaza logosharafdg logomediaexpert logoneonet logo

Capturing customer attention and encouraging them to complete a purchase has become crucial for business success. Personalized push notifications about price drops are one of the most effective ways to achieve this goal. Price is often the decisive factor influencing customer purchase decisions, especially for those who are more sensitive to pricing. They might delay or even abandon a purchase if the price offer does not meet their expectations. In this context, it is crucial to inform customers about price reductions, especially those who have shown interest in a product by adding it to their favorites or cart without completing the purchase. This can be very useful in boosting sales.

Campaign registration

The following use case provides an example of a price drop alert campaign that you can implement in your business. The scenario described involves sending mobile push notifications to customers regarding products whose price has been reduced. These products were previously added to their favorites or cart but were not purchased.

Prerequisites


Process


  1. Create a product.priceDrop event
  2. Create an aggregate that returns a list of SKUs of recently purchased products
  3. Create an aggregate that returns a list of SKUs of items added to favorites by a customer
  4. Create an aggregate that returns the latest prices of products added to favorites
  5. Create an aggregate that collects the last sku’s of products received by users with a discounted price
  6. Create a mobile push template
  7. Create a workflow

Create a product.priceDrop event


In this part of the process, create the product.priceDrop event, which will later be used in aggregates and a workflow.

  1. Go to Data Management icon Data Management > Events > Add event.
  2. Define the name of the event. In our case, it’s product.priceDrop
    In the API and SDK, this parameter is usually called “action” or “action name”.
  3. Optionally, define a human-friendly display name that will be shown in the Data Management and Analytics modules.
  4. Optionally, describe the event.
  5. Enable the Make this event available to anonymous profiles without JWT toggle.
  6. Confirm the settings by clicking Apply.
  7. In the list of events, find the event you just created.
  8. On the right side of the screen, click Add property.
  9. In the Source parameter field, enter the name of the parameter - sku.
  10. In the Property name field, enter a human-readable label for display in the Synerise platform.
  11. Optionally, in the Description field, you can add an explanation about the purpose of this parameter.
  12. To complete the process, click Save.

Create an aggregate that collects sku of recently purchased products


This aggregate will be used in the next part of the process to exclude products that the customer has already bought.

  1. Go to Analytics icon Analytics > Aggregates > Create aggregate.
  2. As the aggregate type, select Profile.
  3. Enter the name of the aggregate.
  4. Click Analyze profiles by and select Last multi and in the Size field, enter 100.
  5. Select the Consider only distinct occurrences of the event parameter option.
  6. From the Choose event dropdown list, select the product.buy event.
  7. As the event parameter, select sku.
  8. As the analyzed period, set Last 30 days.
  9. Save the aggregate.
Configuration of the aggregate
Configuration of the aggregate

Create an aggregate that returns SKU of discounted products added to favorites


This aggregate will be used in the further part of the process. The result of this aggregate will be filtered to prevent sending notifications about discounts on the same favorite items.

  1. Go to Analytics icon Analytics > Aggregates > Create aggregate.
  2. As the aggregate type, select Profile.
  3. Enter the name of the aggregate.
  4. Click Analyze profiles by and select Last multi and in the Size field, enter 100.
  5. From the Choose event dropdown list, select the product.addToFavorites event.
  6. As the event parameter, select sku.
  7. Click + where button.
  8. From the Choose parameter dropdown list, select the sku parameter.
  9. From the Choose operator dropdown list, select Not in Array.
  10. From the Choose value dropdown list, select the aggregate you created in the previous step.
  11. Click + where button.
  12. From the Choose parameter dropdown list, select the sku parameter.
  13. From the Choose operator dropdown list, select Boolean Is true.
  14. As the analyzed period, set Last 30 days.
  15. Save the aggregate.
Configuration of the aggregate
Configuration of the aggregate

Create an aggregate that collects the latest prices of products added by users to their favorites


This aggregate will return the prices of products from the previous aggregate.

Note: It is important to make sure that the conditions defined in both aggregates are the same in order to get the desired results when combining these aggregates.
  1. Go to Analytics icon Analytics > Aggregates > Create aggregate.
  2. As the aggregate type, select Profile.
  3. Enter the name of the aggregate.
  4. Click Analyze profiles by and select Last multi and in the Size field, enter 100.
  5. From the Choose event dropdown list, select the product.addToFavorites event.
  6. As the event parameter, select price.
  7. Click + where button.
  8. From the Choose parameter dropdown list, select the price parameter.
  9. From the Choose operator dropdown list, select Boolean Is true.
  10. Click + where button.
  11. From the Choose parameter dropdown list, select the sku parameter.
  12. From the Choose operator dropdown list, select Not in Array.
  13. From the Choose value dropdown list, select the aggregate you created earlier.
  14. As the analyzed period, set Last 30 days.
  15. Save the aggregate.
Configuration of the aggregate
Configuration of the aggregate

Create an aggregate that collects the last sku’s of products received by users with a discounted price


This aggregate later in the process will be used to exclude discounted products already sent to users when the next message is executed.

  1. Go to Analytics icon Analytics > Aggregates > Create aggregate.
  2. As the aggregate type, select Profile.
  3. Enter the name of the aggregate.
  4. Click Analyze profiles by and select Last multi and in the Size field, enter 100.
  5. From the Choose event dropdown list, select the product.priceDrop event.
  6. As the event parameter, select sku.
  7. As the analyzed period, set Last 30 days.
  8. Save the aggregate.
Configuration of the aggregate
Configuration of the aggregate

Create a mobile push with template


In this part of the process, create a mobile push template that will be used later in a workflow. It should inform a mobile app user about price drop.

  1. Go to Communication > Mobile Push > Templates.
  2. You can use the template from the folder or create your own one using the mobile push code editor. Click New Template > Simple Push.
  3. Create your mobile push in the code editor.
  4. You can use Jinja that lets you refer to event context from the Event Filter that will be configured in the next part of the process. This node will be waiting for occurrence of the product.priceDrop. This event will contain the object with the list of products’ SKU that will be retrieved to the notification template. You can learn more about the logic of inserting dynamic values in such a way in Reusing event context from preceding nodes. The following code is an example of how to do it:
      The product price you were interested in is dropped. New price: ${%set eventParams = event.params%}{%set sku = eventParams.sku|split(',')|last%}{%catalogitemv2.store-1(sku)%}{%set itemObject=catalog_result%}{{itemObject.price}}{%endcatalogitemv2%}
      
  5. In the URL box, add the following code, which will redirect the customer to the page of the specific product after clicking the notification:
      {%set eventParams = event.params%}{%set sku = eventParams.sku|split(',')|last%}{%catalogitemv2.store-1(sku)%}{%set itemObject=catalog_result%}{{itemObject.productUrl}}{%endcatalogitemv2%}
      
  6. In an additional settings, in the image URL field enter the code below. It will let you display the image of the discounted product.
      {%set eventParams = event.params%}{%set sku = eventParams.sku|split(',')|last%}{%catalogitemv2.store-1(sku)%}{%set itemObject=catalog_result%}{{itemObject.image}}{%endcatalogitemv2%}
      
  7. Personalize other settings in the template according to your business needs.
  8. Save the template.
Example of mobile push notification
Example of mobile push notification

Create a workflow


Create a workflow that will be launched for customers that have all necessary consents to receive mobile push notifications and who added any product to favorites. If there is a price drop of products they added to favorites, they will recevie a push notification about discounts on products they liked.

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

Configure the trigger


In this part of the process, define the conditions for the audience for whom you will run this campaign. In our case, these are customers who have added products to favorites and who have necessary consents in the mobile push channel.

  1. As the trigger node, select the Audience node. In the configuration of the node:
    1. Set the Run trigger option to repeatable.
    2. Set the interval at which you want to run the automation.
    3. Select the time zone.
    4. Select the New audience tab.
    5. Click Define conditions.
    6. From the choose filter dropdown list select the product.addToFavorite event.
    7. Define the time period for the last 30 days.
    8. From the Choose filter dropdown list, select the profile.receive_push_messages. This attribute contains the marketing consent status for push notifications.
    9. From the Choose parameter dropdown list, select the Equal operator and specify the condition as true.
    10. Click Choose filter and from the dropdown list, select the snrs_has_mobile_push_devices. It includes information on whether the customer has an active FCM token or not. For more information, please visit this Conditions for sending and displaying mobile notifications.
    11. From the Choose parameter dropdown list, select the Equal operator and set the condition to true.
    12. Confirm by clicking Apply.
Configuration of the Profile filter
Configuration of the Profile filter

Configure the Generate event node


  1. Add the Generate event node. In this step, check if the product added to favorites by the user has been discounted.
    In the configuration of the node:
    1. Enter the Event name and Label. In our case, we are using product.addToFavorite event.

      Note: Jinjava inserted in Generate event body must have all empty spaces deleted.

    2. In the Body section, use the following Jinjava and modify it to your needs:

      {
        "sku": "{%set last_sku=[]%}{%set last_price=[]%}{%set last_objects_array=[]%}{%set final_sku=[]%}{%set list=[]%}{%aggregate 9d8f2b6d-c9d8-39f5-90f2-c354fd387c28%}{%-for sku in aggregate_result|reverse-%}{%do last_sku.append(sku)%}{%-endfor-%}{%endaggregate%}{%aggregate 28e5708e-b957-3b7d-ae3c-09eae2a3e29b%}{%-for price in aggregate_result|reverse-%}{%do last_price.append(price)%}{%-endfor-%}{%endaggregate%}{%aggregate 8ba45452-30e2-3107-9548-a2841040a5fe%}{%-for listSku in aggregate_result-%}{%do list.append(listSku)%}{%-endfor-%}{%endaggregate%}{%-for sku in last_sku-%}{%set index=loop.index0%} {%do last_objects_array.append({sku: sku, price: last_price[index], index: index})%}{%-endfor-%}{%set last_objects_array_uniq=last_objects_array|unique(attr='sku')%}{%-for last in last_objects_array_uniq-%}{%set key_name=last.sku%}{%catalogvar.store-1(key_name).price%}{%set catalog_item=catalog_result|float%}{%-if last.price|float > catalog_item|float-%}{%-if last.sku in list|join(',')-%}{%-else-%}{%do final_sku.append(last.sku)%}{%-endif-%}{%-endif-%}{%endcatalogvar%}{%-endfor-%}{%-for sku in final_sku-%}{{sku}}{%-if loop.index != final_sku|length-%},{%-endif-%}{%-endfor-%}{%-if final_sku|length < 1-%}{{kill}}{%-endif-%}"
      }
              
Important: Remember to base your code preparation on your aggregate IDs and the directories that contain them. The example code uses the IDs used in the earlier steps.
Tip:

If you would like to make a change to the condition that must be met in order for the event to be generated, you can do so in this line:

 {% if last.price|float > catalog_item|float %} 
Currently, this condition checks if the price varies, regardless of how big the change in value will be.

The result of this node is an event, which contains the sku of the discounted products in the sku attribute, separated by commas. If the event is empty, it means that none of the products met the price drop condition.

An example of a generated event:

An example of a generated product.priceDrop event
An example of a generated product.priceDrop event

Configure the Event filter node


  1. Add the Event filter node. In the configuration of the node:
    1. Check event for period of time.
    2. Define the time range to 1 minute.
    3. From the Choose event dropdown list, select the product.priceDrop event.
    4. As the event parameter, select sku.
    5. From the Choose operator dropdown list, select Regular expression.
    6. As the value, enter .+
    7. Confirm by clicking Apply.
  2. For the not matched path, select the End node.
  3. For the matched path, select the Send mobile push node.

Configure the Send mobile push node


At this stage, a mobile push is sent to customers, which contains the products returned in the event from the previous step.

  1. In the node configuration, select the template type(in our example simple push) and push template from the list.
  2. Confirm by clicking Apply.

Add final setting to your workflow


  1. Add the End node.
  2. Launch the workflow by clicking Save&Run.
Configuration of the workflow
Configuration of the workflow

Check the use case set up on the Synerise Demo workspace


You can check the configuration of each step 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.

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