Create a notification target
const url = 'https://example.com/api/v1/notification-targets';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"addresses":["example"],"channels":["example"],"enabled":true,"kind":"webhook","label":"example","name":"example","role":"example","secret":"example","url":"example","user":"example","user_group":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/notification-targets \ --header 'Content-Type: application/json' \ --data '{ "addresses": [ "example" ], "channels": [ "example" ], "enabled": true, "kind": "webhook", "label": "example", "name": "example", "role": "example", "secret": "example", "url": "example", "user": "example", "user_group": "example" }'Adds a destination a notification can be sent to: a webhook, its URL and, optionally, the platform secret it signs or authenticates with; or people, a user_group (every person in the group, read at each alarm transition), one user, or a role (every person holding it, directly or through a group grant, read at each alarm transition), on the channels named. A person is told only about an alarm on a component their own component read scope admits. Binding a group takes user_group:read:admin, binding a person user:read:admin, and binding a role role:read:admin and user:read:admin (a 403 without it), since the target reaches whoever they name. Binding a secret takes the right to bind it (secret:bind, and the admin tier for an admin-sensitive one), since every send hands it to the URL: a secret the caller cannot read is a 404, one it can read but not bind a 403. A URL the egress contract refuses under the allow list in force, an unknown kind, or a secret that is not a platform hmac-key or bearer-token is a 422; a taken name a 409. Audited, the URL masked. Gated by notification_target:create with an all-scope grant.
Request Bodyrequired
Section titled “ Request Bodyrequired ”object
A URL to the JSON Schema for this object.
An email target’s recipient addresses
A group, person or role target’s channels: inbox, email
Whether deliveries go to it (default true)
The target kind
A human label
The target’s name (lowercase kebab)
A role target’s role, by name or uuid; binding one takes role:read:admin and user:read:admin, since it reaches whoever holds the role
A platform secret, by name or uuid, of type hmac-key (signs each body) or bearer-token (sent as Authorization: Bearer)
A webhook’s destination URL: https, or plain http to a host or address the notification.egress_allow setting names. A private, loopback or link-local destination is refused at send unless that setting names it; a cloud metadata address always is
A user target’s person, by username or uuid; binding one takes user:read:admin
A user_group target’s group, by name or uuid; binding one takes user_group:read:admin
Responses
Section titled “ Responses ”Created
Where a notification goes, a webhook, a mailbox, a user group or a person.
object
A URL to the JSON Schema for this object.
An email target’s recipients: a shared mailbox, sent through the install’s mail relay
How a send proves itself: hmac signs each body with the bound hmac-key (X-Omniglass-Signature), bearer presents the bound bearer-token, none sends unsigned
The channels a group or person target delivers on: inbox (the console inbox) and email (each person’s directory email)
Whether deliveries go to it; a disabled target is skipped
The target’s uuid, the stable form of name
The target kind: webhook posts a signed JSON envelope to the URL; email sends to fixed addresses through the install’s mail relay; user_group reaches every person in a group, read at each alarm transition; user reaches one person; role reaches every person holding the role, directly or through a group grant, read at each alarm transition. A person is told only about alarms on components they can read
Shipped with Omniglass by the boot seed: only its label and enabled switch are the operator’s, and it cannot be deleted
The role a role target reaches the holders of, by name; shown to a caller who reads roles (role:read:admin, all-scope)
The role’s uuid
The platform secret the send signs (an hmac-key) or authenticates (a bearer-token) with, by name; absent sends unsigned
The bound secret’s uuid, the stable form of secret
A webhook’s destination, masked to its scheme and host (the path and query often carry a credential); :reveal returns it whole
The person a user target reaches, by username; shown to a caller who reads the user directory (user:read:admin, all-scope)
The group a user_group target reaches, by name; shown to a caller who reads the group directory (user_group:read:admin, all-scope)
The group’s uuid
The person’s uuid
Example
{ "$schema": "/api/v1/schemas/NotificationTargetBody.json", "auth": "none", "kind": "webhook"}default
Section titled “ default ”Error
object
A URL to the JSON Schema for this object.
A human-readable explanation specific to this occurrence of the problem.
Optional list of individual error details
object
Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’
Error message text
The value at the given location
A URI reference that identifies the specific occurrence of the problem.
HTTP status code
A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
A URI reference to human-readable documentation for the error.
Example
{ "$schema": "/api/v1/schemas/ErrorModel.json", "detail": "Property foo is required but is missing.", "instance": "https://example.com/error-log/abc123", "status": 400, "title": "Bad Request", "type": "about:blank"}