This API enables you to fire a notification event, which sends out notifications to your users.
Before firing your first notification event, you must perform the following actions in your Fyno account:
- Create a Template
- Create a Notification Event
- Create an API Key
- And obtain your workspace ID from the API Keys page.
Request
Your event payload must specify at least `distinct_id` or `to` while firing a notification event. Choose one of the three options below.
**Option 1: `to` only**
Required: `event`, `to`
The notification event uses all destination values from the `to` object, as they are.
```json
{
"event": "event_name",
"to": {
"email": "abcde@fghi.com",
"sms": "+49XXXXXXXXX"
},
"data": {
"placeholder_key_1": "placeholder_value_1"
}
}
```
**Option 2: `distinct_id` only**
Required: `event`, `distinct_id`
The notification event uses all destination values (such as SMS, WhatsApp, Email, Push, and Voice) from the user's profile and sends the notification.
```json
{
"event": "event_name",
"distinct_id": "XXXXXXXX",
"data": {
"placeholder_key_1": "placeholder_value_1"
}
}
```
**Option 3: both `distinct_id` and `to`**
Required: `event`, `distinct_id`, `to`
The `to` and `distinct_id` channel data merges, with the `to` object taking precedence, and the notification is sent. The sent notification is tagged to the ID specified, which you can then use to search the logs by `distinct_id`.
```json
{
"event": "event_name",
"distinct_id": "XXXXXXXX",
"to": {
"email": "abcde@fghi.com"
},
"data": {
"placeholder_key_1": "placeholder_value_1"
}
}
```
`data` and `callback` are optional in all three options.
Option 1: to onlyobjectRequired
Option 2: distinct_id onlyobjectRequired
Option 3: distinct_id and toobjectRequired
Response
Request accepted successfully and it will be processed asynchronously.