Notifiers#

Notifiers service sends notifications when platform messages are received. The service consumes messages from the broker and dispatches them to the configured delivery backends. Two backends are supported:

  • SMTP — sends email notifications to one or more addresses.
  • SMPP — sends SMS notifications to one or more phone numbers via an SMPP gateway.

Notifiers are group-scoped records that carry a list of contact addresses (emails or phone numbers). When a message arrives for a group whose profile has a notifier configured, the service dispatches the notification to all addresses in that notifier's list.

Enabling notifications#

Notifications are enabled by attaching a notifier ID to the smtp_id field in the Profile Config. When a message is published to that profile, the service will dispatch an email to all addresses registered in the notifier.

{
  "config": {
    "content_type": "application/senml+json",
    "write": true,
    "webhook": false,
    "smtp_id": "a9bf9e57-1685-4c89-bafb-ff5af830be8b"
  }
}

If write is set to false, the notification is sent but the message is not stored in the database.

Managing notifiers#

Notifiers are group-scoped. Each notifier carries a name and a list of contact addresses. A single notifier can target multiple recipients simultaneously — all addresses in the list receive the notification when a matching message arrives.

# Create a notifier for a group
curl -s -S -i -X POST \
  -H "Authorization: Bearer <user_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Ops team alerts",
    "contacts": ["ops@example.com", "oncall@example.com"]
  }' \
  https://localhost/notifiers/groups/<group_id>/notifiers
{
  "id": "a9bf9e57-1685-4c89-bafb-ff5af830be8b",
  "name": "Ops team alerts",
  "contacts": ["ops@example.com", "oncall@example.com"],
  "group_id": "211e4567-e89b-12d3-a456-426614174000"
}
# List notifiers for a group
curl -s -S -i \
  -H "Authorization: Bearer <user_token>" \
  https://localhost/notifiers/groups/<group_id>/notifiers
{
  "total": 1,
  "notifiers": [
    {
      "id": "a9bf9e57-1685-4c89-bafb-ff5af830be8b",
      "name": "Ops team alerts",
      "contacts": ["ops@example.com", "oncall@example.com"],
      "group_id": "211e4567-e89b-12d3-a456-426614174000"
    }
  ]
}
# View a specific notifier
curl -s -S -i \
  -H "Authorization: Bearer <user_token>" \
  https://localhost/notifiers/notifiers/<notifier_id>

# Update a notifier
curl -s -S -i -X PUT \
  -H "Authorization: Bearer <user_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Ops team alerts",
    "contacts": ["ops@example.com", "oncall@example.com", "manager@example.com"]
  }' \
  https://localhost/notifiers/notifiers/<notifier_id>

# Delete a notifier
curl -s -S -i -X DELETE \
  -H "Authorization: Bearer <user_token>" \
  https://localhost/notifiers/notifiers/<notifier_id>

For the full API reference, see the API documentation.