Slack Integration
Send webhook events to Slack channels
Nahook can deliver events directly to Slack channels using Slack's Incoming Webhooks. This is useful for alerting, notifications, and monitoring.
Setup
1. Create a Slack Incoming Webhook
- Go to api.slack.com/apps and click Create New App
- Choose From scratch, name your app, and select your workspace
- Under Features, click Incoming Webhooks and toggle it on
- Click Add New Webhook to Workspace
- Select the channel where you want to receive events
- Click Allow and copy the webhook URL
The URL looks like: https://hooks.slack.com/services/T.../B.../xxx
2. Create a Slack Endpoint in Nahook
In the dashboard, go to Endpoints → Create Endpoint, select the target environment, and choose Slack as the type. Paste your Slack webhook URL.
Or use the API:
curl -X POST https://api.nahook.com/api/workspaces/ws_YOUR_ID/endpoints \
-H "Authorization: Bearer YOUR_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "slack",
"config": {
"webhookUrl": "https://hooks.slack.com/services/T.../B.../xxx"
},
"description": "#alerts channel"
}'const response = await fetch(
"https://api.nahook.com/api/workspaces/ws_YOUR_ID/endpoints",
{
method: "POST",
headers: {
Authorization: "Bearer YOUR_SESSION_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
type: "slack",
config: {
webhookUrl: "https://hooks.slack.com/services/T.../B.../xxx",
},
description: "#alerts channel",
}),
},
);3. Send a Test Event
Click Test on the endpoint detail page, or use the API:
curl -X POST https://api.nahook.com/api/workspaces/ws_YOUR_ID/endpoints/ep_YOUR_ID/test \
-H "Authorization: Bearer YOUR_SESSION_TOKEN"You should see a message in your Slack channel: "Nahook test — your Slack integration is working!"
How Slack Delivery Works
Slack endpoints behave differently from standard webhooks:
| Feature | Webhook | Slack |
|---|---|---|
| Signing | HMAC-SHA256 headers | None (Slack handles auth) |
| Success criteria | HTTP 200-299 | HTTP 200 only |
| Payload format | Your JSON payload | Slack message format |
| Auth | Optional HTTP Basic Auth | Webhook URL is the secret |
Message Format
When you send events to a Slack endpoint, the payload is POSTed directly to Slack. To display formatted messages, use Slack's message format:
{
"payload": {
"text": "New order received: $99.99 from [email protected]"
}
}For rich formatting with blocks:
{
"payload": {
"blocks": [
{
"type": "header",
"text": { "type": "plain_text", "text": "New Order Received" }
},
{
"type": "section",
"fields": [
{ "type": "mrkdwn", "text": "*Amount:*\n$99.99" },
{ "type": "mrkdwn", "text": "*Customer:*\n[email protected]" }
]
}
]
}
}The text field is recommended even when using blocks — it serves as a fallback for notifications and accessibility.
Security
The Slack webhook URL contains an authentication token. Treat it as a secret:
- Don't commit it to version control
- Nahook stores it securely in the endpoint configuration
- Rotate it by creating a new Incoming Webhook in Slack and updating the endpoint