Use case
The client wants to send birthday emails to users a few days before their birthday.
Requirement:
he customer profile should include an attribute to store the birthday timestamp in UNIX format. In our example, it is called "birth_date".
Guide
- We must set up a daily trigger scenario utilizing a "Repeat daily" trigger. Please look at our documentation for the necessary steps to create the scenario.
- The most important aspect is to filter users with a specific number of days from their birthday and email them. It can be achieved by using an expression such as the one provided below:
The example above demonstrates how to send a birthday email 7 days before the customer's birthday. To achieve this, we subtract seven from the birthday attribute and then multiply it by 86400 to get the result per day.
In this context, 86400 represents a day: One minute contains 60 seconds, one hour includes 60 minutes, and one day comprises 24 hours. Therefore, 60 x 60 x 24 = 86,400 seconds in a day. - Once you have saved this expression, you can use it in a condition node as shown below:
The expression here shows the result from 7 days before the birth date. The mentioned condition will be compared with the expression result for the current day and month. If a customer profile expression matches today's date, those customers will proceed further in the flow and receive an email.
Limitation
Storing the birthday as a string will cause the above expression to fail. Therefore, the value must be stored in the correct format.