Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
57 lines (37 sloc) 5.8 KB
converter: markdown
title: Notifications
description: 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.
slug: tutorials/notifications/notifications
searchable: true
**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
* API call
## Notifications directory
All notifications are defined in the `notifications` directory.
Depending on what type of notification you would like to define, you should have three subdirectories:
* `email_notifications`: contains all Email Notifications
* `sms_notifications`: contains all SMS Notifications
* `api_call_notifications`: 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: <ul><li>an email address of the recipient (or comma-delimited list of emails)</li><li>mobile number of the recipient</li><li>endpoint for the API call</li></ul> Accepts liquid. | n/a | `` |
| 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 Auckland time: {% raw %}`{{ 'tomorrow 10am' \| to_time: 'Pacific/Auckland' \| time_diff }}`{% endraw %} | 0 | 2
| enabled | Boolean which defines whether alert should be invoked or not. If false, it will be simply 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 | {% raw %}`{% if should_send == 'some_value'%}true{% endif %}`{% endraw %} - this code will trigger the notification only if value of `should_send` is equal to 'some_value'. |
{% include 'alert/important', content: '`to` property is required in SMS and API Call Notifications.' %}
## 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 {% log form %} 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 ``.
## Related topics
* [Creating an Email Notification](/tutorials/notifications/creating-email-notification)
* [Creating an SMS Notification](/tutorials/notifications/creating-sms-notification)
* [Creating an API Call Notification](/tutorials/notifications/creating-api-call-notification)
You can’t perform that action at this time.