Notifications
Configure delivery channels for your alerts. When an alert fires, RelayX delivers notifications through the channels you've configured.
Access via app.notification.
Channel Types
| Type | Description |
|---|---|
| Webhook | Sends an HTTP POST request to your endpoint with the alert payload. Use this to integrate with Slack, PagerDuty, custom dashboards, or any service that accepts webhooks. |
Sends an email to one or more recipients with a customizable subject and body. Supports template variables like {{rule.name}} and {{device_id}}. |
Email limit
The number of email notifications you can send depends on your plan.
API
create()
Create a new notification channel.
- JavaScript
- Python
await app.notification.create(params)await app.notification.create(params)| Parameter | Type | Description |
|---|---|---|
name | string | Unique channel name |
type | string | "WEBHOOK" or "EMAIL" |
config | object | Channel-specific configuration (see below) |
Webhook
- JavaScript
- Python
const channel = await app.notification.create({
name: "ops_webhook",
type: "WEBHOOK",
config: {
endpoint: "https://hooks.example.com/alerts",
headers: { "Authorization": "Bearer <token>" },
retry_back_off: [100, 500, 1000],
},
});
channel = await app.notification.create({
"name": "ops_webhook",
"type": "WEBHOOK",
"config": {
"endpoint": "https://hooks.example.com/alerts",
"headers": {"Authorization": "Bearer <token>"},
"retry_back_off": [100, 500, 1000],
},
})
| Field | Type | Description |
|---|---|---|
endpoint | string | The URL to POST alert payloads to |
headers | object | HTTP headers to include with each request |
retry_back_off | number[] | (optional) Retry delays in milliseconds on failure |
Email
- JavaScript
- Python
const channel = await app.notification.create({
name: "ops_email",
type: "EMAIL",
config: {
recipients: ["ops@example.com", "alerts@example.com"],
subject: "Alert: {{rule.name}}",
template: "Device {{device_id}} triggered {{rule.name}}",
},
});
channel = await app.notification.create({
"name": "ops_email",
"type": "EMAIL",
"config": {
"recipients": ["ops@example.com", "alerts@example.com"],
"subject": "Alert: {{rule.name}}",
"template": "Device {{device_id}} triggered {{rule.name}}",
},
})
| Field | Type | Description |
|---|---|---|
recipients | string[] | Email addresses to send to |
subject | string | Email subject line (supports {{template}} variables) |
template | string | Email body (supports {{template}} variables) |
Example response:
{
"id": "69cb22a4ed4d9fe786145d01",
"name": "ops_webhook",
"type": "WEBHOOK"
}
update()
Update an existing notification channel's configuration.
- JavaScript
- Python
await app.notification.update(params)await app.notification.update(params)- JavaScript
- Python
const updated = await app.notification.update({
id: channelId,
config: { endpoint: "https://new-url.example.com/alerts" },
});
updated = await app.notification.update({
"id": channel_id,
"config": {"endpoint": "https://new-url.example.com/alerts"},
})
Example response:
{
"id": "69cb22a4ed4d9fe786145d01",
"name": "ops_webhook",
"config": {
"endpoint": "https://new-url.example.com/alerts",
"headers": { "Authorization": "Bearer <token>" }
},
"created_at": "2026-03-28T10:00:00.000Z",
"updated_at": "2026-03-29T14:30:00.000Z"
}
delete()
Permanently remove a notification channel.
- JavaScript
- Python
await app.notification.delete(channelId)await app.notification.delete(channel_id)- JavaScript
- Python
await app.notification.delete(channelId);
await app.notification.delete(channel_id)
list()
Retrieve all notification channels.
- JavaScript
- Python
await app.notification.list()await app.notification.list()- JavaScript
- Python
const channels = await app.notification.list();
channels = await app.notification.list()
Example response:
[
{
"id": "69cb22a4ed4d9fe786145d01",
"name": "ops_webhook",
"config": {
"endpoint": "https://hooks.example.com/alerts",
"headers": { "Authorization": "Bearer <token>" }
},
"created_at": "2026-03-28T10:00:00.000Z",
"updated_at": "2026-03-28T10:00:00.000Z"
},
{
"id": "69cb22b8ed4d9fe786145d02",
"name": "ops_email",
"config": {
"recipients": ["ops@example.com"],
"subject": "Alert: {{rule.name}}",
"template": "Device {{device_id}} triggered {{rule.name}}"
},
"created_at": "2026-03-28T10:05:00.000Z",
"updated_at": "2026-03-28T10:05:00.000Z"
}
]
get()
Retrieve a single notification channel by ID.
- JavaScript
- Python
await app.notification.get(channelId)await app.notification.get(channel_id)- JavaScript
- Python
const channel = await app.notification.get(channelId);
channel = await app.notification.get(channel_id)
Example response:
{
"id": "69cb22a4ed4d9fe786145d01",
"name": "ops_webhook",
"config": {
"endpoint": "https://hooks.example.com/alerts",
"headers": { "Authorization": "Bearer <token>" }
},
"created_at": "2026-03-28T10:00:00.000Z",
"updated_at": "2026-03-28T10:00:00.000Z"
}
Linking to Alerts
Pass notification channel IDs when creating alerts to enable delivery:
- JavaScript
- Python
await app.alert.create({
name: "high_temp",
type: "THRESHOLD",
metric: "temperature",
config: { /* ... */ },
notification_channel: [channelId],
});
await app.alert.create({
"name": "high_temp",
"type": "THRESHOLD",
"metric": "temperature",
"config": { ... },
"notification_channel": [channel_id],
})