Skip to main content

Set up approval notifications

To keep the right people informed about approval requests, set up notifications. Nullplatform supports Slack and HTTP notifications for approvals.

Configure a Slack channel

To receive notifications on Slack, follow these steps:

  1. Install nullplatform's Slack application.

    Go to https://<your-org-slug>.app.nullplatform.io/integration and click Connect Slack to authorize the application.

  2. Go to Slack and add the nullplatform application to the channels. You can use the /invite @nullplatform command.

  3. Send a POST request to create your notification channel.

tip

Set up a notification channel for the entire organization to ensure that notifications always reach a channel.

Example request:

curl -L 'https://api.nullplatform.com/notification/channel' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"nrn": "organization=1",
"source": ["approval"],
"type": "slack",
"configuration": {
"channels": ["my-organization-private-channel"]
},
"filters": {
"action": "deployment:create"
},
}

To notify specific teams, configure channels for namespaces, accounts, or other resources:

curl -L 'https://api.nullplatform.com/notification/channel' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"nrn": "organization=1:account=2:namespace=3",
"source": ["approval"],
"type": "slack",
"configuration": {
"channels": ["my-namespace-private-channel"]
},
"filters": {
"action": "deployment:create"
},
}
Request details
  • nrn: The NRN identifies the organization for which the notification channel is being created.
  • source: This specifies the source of the notifications. Here, the source is approval, meaning the channel will receive notifications related to approval requests.
  • type: This defines the type of notification channel. It can be either slack or http for approvals.
  • configuration: This field contains configuration details specific to the notification channel type.
  • filters: An optional field that allows notifications to be filtered based on custom criteria.

Once configured, you’ll receive Slack messages to approve or deny requests.

Here's an example:

Slack notification

Configure an HTTP notification channel

HTTP notifications allow systems to programmatically respond to approval requests. To set this up, send a POST request with the endpoint details.

Example request

curl -L 'https://api.nullplatform.com/notification/channel' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"nrn": "organization=1",
"source": ["approval"],
"type": "http",
"configuration": {
"url": "https://yourdomain.com/url-you-configured",
"headers": {
"Authorization": "Bearer the-token"
},
"filters": {
"action": "deployment:create"
},
}

After setting up your custom notification channel, you'll 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": "alex.doe.developer@yourdomain.com",
"first_name": "alex",
"last_name": "doe",
"avatar": null
},
"action": "deployment:create",
"details": {...}
}
}

Responding to HTTP notification

After evaluating an approval request, respond by approving or denying it based on the policy conditions. Use the provided approve_url or deny_url and include relevant details in your response.

Here’s an example of how to deny an approval due to policy violations:

curl -L 'https://api.nullplatform.com/approval/:id/deny' \
-H 'Content-Type: application/json' \
--data-raw '{
"reviewer": {
"name": "Deployments Review Team",
"email": "reviewer@yourdomain.com",
"nullplatform_user_id": null
},
"message": "Approval denied due to policy conditions not being met.",
"details": {
"restriction_reason": "Security policy violation: The number of security issues exceeds the allowed threshold.",
"expected_max_security_issues": 4,
"actual_security_issues": 6,
"policy_name": "Enforce coverage, security, and scaling for deployments"
}
}'
Request details
  • reviewer: Information about the decision maker (name, email, and optional user ID).
  • message: A short explanation for the decision.
  • details: Additional context for the decision.

All fields are optional, but including them can help provide clarity to the requester in the platform.

info

For more details on notifications, refer to the Notifications docs.

What's next

Now that you've set up your notification channel, you can proceed to create a policy to define the rules for when the approval action should be triggered. Alternatively, if you haven't done so yet, you can create your approval actions.