# alert.triggered

Source: https://developer.nylas.com/docs/reference/notifications/send-alerts/alert-triggered/

Sent when a sending domain's bounce, complaint, or delivery rate crosses the threshold of one of your alert rules.

> Nylas sends one alert per sending domain and rule. While the domain stays past the threshold, Nylas sends a reminder every 24 hours with the same `id` and an incremented `notification_seq`. After the rate has been back within the threshold for an hour, the alert ends; if the domain crosses the threshold again, you get a new alert with a new `id`. Updating the rule also starts a new alert.

## data.object fields

- `object` (string) **(required)** - Always `alert`.
- `id` (string) **(required)** - The ID of the alert. It stays the same for every notification about the same alert, so use it with `notification_seq` to deduplicate.
- `grant_id` (string) - Always empty. Alerts belong to your application, not to a grant.
- `status` (string) **(required)** - Always `firing`.
- `notification_seq` (integer) **(required)** - The notification number for this alert: `1` for the first notification, then incremented by 1 for each reminder.
- `started_at` (integer) **(required)** - Unix timestamp when the domain first crossed the threshold.
- `triggered_at` (integer) **(required)** - Unix timestamp of the check that sent this notification.
- `sending_domain` (string) **(required)** - The sending domain that crossed the threshold.
- `rule` (object) **(required)** - The alert rule that fired. See [Return an alert rule](/docs/reference/api/send-alerts/get-send-alert-rule/).
  - `id` (string) - The ID of the alert rule.
  - `application_id` (string) - The ID of your Nylas application.
  - `metric` (string) - The rate the rule watches: `bounce_rate`, `complaint_rate`, or `delivery_rate`.
  - `direction` (string) - `above` for `bounce_rate` and `complaint_rate`, `below` for `delivery_rate`.
  - `threshold` (number) - The threshold, as a percentage.
  - `window_hours` (integer) - How many hours of sending the rate covers.
  - `min_volume` (integer) - The minimum number of messages a domain must send in the window before the rule can fire.
  - `created_at` (integer) - Unix timestamp when the rule was created.
  - `updated_at` (integer) - Unix timestamp when the rule was last updated.
- `observed` (object) **(required)** - What Nylas measured.
  - `value` (number) - The domain's rate in the window, as a percentage.
  - `window` (object) - The time window the rate covers.
    - `start` (integer) - Unix timestamp of the start of the window.
    - `end` (integer) - Unix timestamp of the end of the window.
  - `totals` (object) - The domain's message counts in the window.
    - `sent` (integer) - Messages Nylas accepted for delivery.
    - `delivered` (integer) - Messages the recipient's mail server accepted.
    - `bounced_hard` (integer) - Permanent bounces.
    - `bounced_soft` (integer) - Temporary bounces.
    - `bounced_undetermined` (integer) - Bounces the recipient's server didn't classify.
    - `rejected` (integer) - Messages Nylas didn't send because of bad content.
    - `complaints` (integer) - Recipients who marked the message as spam.

## Example payload

```json
{
  "specversion": "1.0",
  "type": "alert.triggered",
  "source": "/nylas/send",
  "id": "<WEBHOOK_ID>",
  "time": 1793290500,
  "webhook_delivery_attempt": 1,
  "data": {
    "application_id": "<NYLAS_APPLICATION_ID>",
    "object": {
      "object": "alert",
      "id": "4f9c2a7e1b3d5f6a8c0e2b4d6f8a1c3e",
      "grant_id": "",
      "status": "firing",
      "notification_seq": 1,
      "started_at": 1793290500,
      "triggered_at": 1793290500,
      "sending_domain": "mail.example.com",
      "rule": {
        "id": "8069c06e-a4c0-4bfa-9535-0f286575cc0e",
        "application_id": "<NYLAS_APPLICATION_ID>",
        "metric": "bounce_rate",
        "direction": "above",
        "threshold": 5,
        "window_hours": 1,
        "min_volume": 50,
        "created_at": 1792785235,
        "updated_at": 1792785235
      },
      "observed": {
        "value": 8.33,
        "window": {
          "start": 1793286600,
          "end": 1793290200
        },
        "totals": {
          "sent": 120,
          "delivered": 109,
          "bounced_hard": 10,
          "bounced_soft": 1,
          "bounced_undetermined": 0,
          "rejected": 0,
          "complaints": 0
        }
      }
    }
  }
}
```
