Notifications
Nullplatform allows you to receive notifications about CRUD operations on entities. These notifications allows you to create automations, approval flows, alerts, audit logs, and more.
This section will explain how you can be notified about these events through our built-in integrations (eg: Slack) and/or by webhooks.
Channels
This section explains how to set up a channel and start receiving notifications through Slack or HTTP (webhooks).
Slack
To receive notifications on Slack, you have to follow these steps:
-
Install nullplatform's slack application
Go tohttps://<your-org-slug>.app.nullplatform.com/integration
and click the "Connect Slack" button to authorize the application. -
[In Slack] Add the nullplatform application to the channels where you want to receive notifications
You can do this with the slash command/invite @nullplatform
. -
Set notification channels for your teams, applications, etc
Set up a notification channel for the whole organization to be sure that notifications always reach some channel.POST /notification/channel
{
"source": ["approval"],
"nrn": "organization=1",
"type": "slack",
"configuration": {
"channels": ["my-organization-private-channel"]
}
}Then you can set up specific channels for each of your teams based on namespaces (or account or any other nullplatform resource).
POST /notification/channel
{
"source": ["approval"],
"nrn": "organization=1:account=2:namespace=3",
"type": "slack",
"configuration": {
"channels": ["my-namespace-private-channel"]
}
}This endpoint will give you an ID that you can later use to reconfigure or delete the notification channel using
PUT
/PATCH
/DELETE
.
Once you configure Slack notifications you will start getting notifications messages like these:
If you have multiple teams that want to receive notifications (e.g. you have different approvers per team), you can set up a notification channel for each one by creating one channel for each NRN resource.
Programmatic / HTTP webhook
If you want to have programmatic control over your notifications, or you have a channel that is not currently available,
you can set up nullplatform to send POST
requests to your custom endpoint. By doing this you can make custom logic
such as "approve this deployment only if it's business hours and the card is marked as verified by QA".
To set up the channel in this fashion, you can set up the channel for the whole organization like this:
POST /notification/channel
{
"nrn": "organization=1",
"source": ["approval"],
"type": "http",
"configuration": {
"url": "https://yourdomain.com/url-you-configured",
"headers": {
"Authorization": "Bearer the-token"
}
},
}
Authorization. Please embed any token or secret in the URL or in the headers section. We currently do not support a refresh token scheme.
Once you have succesfully set up your custom notifications channel, you will start receiving requests like these:
POST https://yourdomain.com/url-you-configured
{
"id": 12,
"source": "approval",
"created_at": "2022-12-19T20:37:42.109Z",
"notification": {
"approval_id": 1234,
"approve_url": "https://api.nullplatform.com/approval/1234/approve?token=the-token",
"deny_url": "https://api.nullplatform.com/approval/1234/deny?token=the-token",
"requested_by": {
"user_id": 1,
"email": "mr.developer@yourdomain.com",
"first_name": "Mr",
"last_name": "Developer",
"avatar": null
},
"action": "deployment:create",
"details": {...}
}
}
Filters
You can create filters to receive notifications that match a custom criteria such as:
- "New deployments should be sent to slack channel #my-org-deployments"
- "Receive notifications for deleted or stopped scopes"
- and so on...
Here are some examples on how you can set up these criteria:
Example: receive deployment notifications in a specific channel
POST /notification/channel
{
"source": ["approval"],
"nrn": "organization=1:account=2:namespace=3",
"type": "slack",
"configuration": {
"channels": ["my-org-deployments"]
},
"filters": {
"action": "deployment:create"
}
}
Example: Receive notifications for deleted or stopped scopes
Example 2: Destructive actions in another channel
POST /notification/channel
{
"source": ["approval"],
"nrn": "organization=1:account=2:namespace=3",
"type": "slack",
"configuration": {
"channels": ["my-namespace-private-channel-for-scope-destruction"]
},
"filters": {
"$or": [{"action": "scope:stop"}, {"action": "scope:delete"}]
}
}
Example: Receive notifications to audit activity on applications
{
"nrn": "organization=1:account=2",
"source": ["audit"],
"type": "http",
"configuration": {
"url": "https://yourdomain.com/url-you-configured"
},
"filters": {
"entity": "application"
}
}
The filters
field supports the use of MongoDB query syntax, allowing you to create complex expressions and conditions.
Please refer to MongoDB operators for the full
reference.