Homepage

Notifications

Last edit: Jul 14, 2023

Notifications are messages sent to platformOS users (including admins) when something happens. A message can be an email, SMS, or programmatic call to a 3rd party API.

Notifications can be delayed, and you can use Liquid, GraphQL, and trigger conditions to decide if a notification should be sent. They are a powerful mechanism used for example to welcome new users, follow up after they've added their first item, or reach out to them if they have been inactive for a while.

Supported notification types

Currently, we support three types of notifications:

  • Email
  • SMS
  • API call

Notifications directory

Depending on what type of notification you would like to define, you should have three subdirectories in your app/ directory:

  • emails: contains all Email Notifications
  • smses: contains all SMS Notifications
  • api_calls: contains all API Call Notifications

Configuration

Each configuration can accept different properties, but some of the main concepts are common:

Property Description Default Example
to Depending on the alert type, it is either:
  • an email address of the recipient (or comma-delimited list of emails)
  • mobile number of the recipient
  • endpoint for the API call
Accepts liquid.
n/a test@email.com
delay Number of minutes by which the notification should be delayed. You could use liquid to calculate the number. For example, one could easily schedule email to be sent the next day at 10 am time: {{ 'now' | time_diff: 'tomorrow 10am', 'minutes' | round }} 0 2
enabled Boolean which defines whether alert should be invoked or not. If false, it will be ignored. true false
locale Liquid code which evaluates to the desired language code, which should be used for translations and date format. en
trigger_condition Liquid condition to control whether notification should be sent or not. The only value that allows notification to be delivered is true. If you skip it, the notification will be sent (unless enabled is false). On a notification, the trigger_condition is checked after the delay has been executed. true {% if should_send == 'some_value'%}true{% endif %} - this code will trigger the notification only if value of should_send is equal to 'some_value'.

Accessing form data from the notification

Wherever you have access to Liquid inside the notification, you can access data submitted in the form which triggered the notification using the form variable. Its structure mirrors the fields property of the associated Form. When in doubt, you can always use to visualize the structure. If you would like to access properties, which are not included in the form variable, you should use a GraphQL query to fetch them. You can access the id of the resource associated with the submitted form via form.id.

Questions?

We are always happy to help with any questions you may have.

contact us