Slack
Integrate Slack with Enbbox for chat notifications. Send rich notifications to Slack channels and direct messages with Block Kit formatting.
Overview
Slack is a team messaging platform. Enbbox can send notifications to Slack channels, groups, or direct messages using Incoming Webhooks.
Step 1: Create an Incoming Webhook
- Go to api.slack.com/apps and click Create New App
- Choose From scratch, enter an app name, and select your workspace
- In the app settings, navigate to Incoming Webhooks
- Toggle Activate Incoming Webhooks to On
- Click Add New Webhook to Workspace
- Select the channel where notifications should be posted
- Copy the Webhook URL (e.g.,
https://hooks.slack.com/services/T00/B00/xxx)
Step 2: Connect to Enbbox
- Navigate to Integrations in the Enbbox dashboard
- Click Add Provider → select Chat → Slack
- No global credentials are needed — Slack uses per-subscriber webhook URLs
- Activate the integration
Step 3: Configure Subscriber Credentials
Store each subscriber's Slack webhook URL:
import { SubscriberCredentialsApi, Configuration } from "@enbbox/api";
const config = new Configuration({ accessToken: "your-api-key" });
const credentialsApi = new SubscriberCredentialsApi(config);
await credentialsApi.setCredentials("subscriber-123", "slack", {
credentials: { webhook_url: "https://hooks.slack.com/services/T00/B00/xxx" },
});Step 4: Send a Test Notification
import { EventsApi, Configuration } from "@enbbox/api";
const config = new Configuration({ accessToken: "your-api-key" });
const eventsApi = new EventsApi(config);
await eventsApi.triggerEvent({
name: "deployment-alert",
to: { subscriberId: "subscriber-123" },
payload: { message: "🚀 Deployment to production completed successfully!" },
});Advanced: Bot Token (for richer messages)
For richer features (ephemeral messages, Block Kit, user DMs), use a Bot Token:
- In your Slack app settings → OAuth & Permissions
- Add bot scopes:
chat:write,chat:write.public - Install the app to your workspace
- Copy the Bot User OAuth Token (
xoxb-...)
Troubleshooting
| Issue | Solution |
|---|---|
channel_not_found | The webhook URL may have been revoked — regenerate it |
invalid_payload | Ensure message content is valid UTF-8 |
| Rate limited | Slack allows ~1 message/sec per webhook |