Two kinds of Slack webhooks
"Slack webhook" can mean two different things:
- Incoming webhooks post messages into Slack. You get a URL from Slack and send JSON to it. This is what most people want for alerts and notifications.
- Requests Slack sends to you: the Events API, slash commands and interactive buttons call a URL you host. Those are signed, and you must verify them.
This guide covers both, starting with incoming webhooks.
How to get a Slack webhook URL
Incoming webhooks belong to a Slack app. Creating one takes two minutes:
- Go to api.slack.com/apps and choose Create New App → From scratch. Name it and pick your workspace.
- Under Features, open Incoming Webhooks and switch Activate Incoming Webhooks on.
- Choose Add New Webhook to Workspace, pick the channel, and allow it.
- Copy the new URL from the list.
It looks like this:
https://hooks.slack.com/services/<team-id>/<webhook-id>/<secret>Each URL posts to the one channel you chose. An app's incoming webhook can't change its channel, name or icon per message; add another webhook for another channel.
Post a message
curl -X POST -H "Content-Type: application/json" \
--data '{"text": "Deploy finished :white_check_mark:"}' \
"https://hooks.slack.com/services/<team-id>/<webhook-id>/<secret>"Slack answers 200 with the body ok.
For richer messages, use Block Kit. Keep text as well: it is the fallback shown in notifications.
{
"text": "Payment failed for cus_123",
"blocks": [
{ "type": "section", "text": { "type": "mrkdwn", "text": "*Payment failed*\nInvoice <https://dashboard.stripe.com/invoices/in_1Q…|in_1Q…> for €49.00" } },
{ "type": "context", "elements": [{ "type": "mrkdwn", "text": "Retrying automatically" }] }
]
}Slack's mrkdwn isn't standard Markdown: *bold*, _italic_, and links written as <url|label>.
Errors and rate limits
Slack returns a short error string in the body instead of ok:
| Status | Body | Meaning |
|---|---|---|
| 400 | invalid_payload | The JSON is malformed or has no text or blocks. |
| 403 | action_prohibited | A workspace admin has restricted posting. |
| 404 | no_service | The webhook was removed or its app uninstalled. |
| 410 | channel_is_archived | The channel it posts to was archived. |
Incoming webhooks are rate limited to about one message per second, with short bursts allowed. Over that, Slack answers 429 with a Retry-After header. Batch related alerts into one message instead of sending dozens.
Keep the URL secret
The URL is the only credential: anyone who has it can post to your channel. Store it in an environment variable or a secret manager, never in front-end code or a public repository. If it leaks, remove that webhook under Incoming Webhooks and add a new one. What a webhook URL is covers this in more depth.
Verify requests Slack sends you
When Slack calls your app (Events API, slash commands, interactivity), it signs each request:
X-Slack-Request-Timestamp: Unix seconds.X-Slack-Signature:v0=plus the hex HMAC-SHA256 ofv0:{timestamp}:{raw body}, keyed with your app's signing secret.
Recompute the signature over the raw body, compare in constant time, and reject timestamps more than five minutes old. The full technique, with code, is in webhook signature verification.
Two Slack specifics: the Events API first sends a url_verification request whose challenge value you must echo back, and Slack expects an answer within 3 seconds. If it doesn't get one, it retries (up to three times) and marks the retries with an X-Slack-Retry-Num header, so make your handler safe to run twice.
Sending other services' events to Slack
Like Discord, Slack only accepts its own format, so a Stripe or GitHub event can't be posted to an incoming webhook as it is. Use the service's own Slack app where one exists, or a small function or n8n or Zapier to turn the event into a message.
If those events matter (payments, orders), don't let the Slack step be the only place they go. Put HookStead in front: it verifies and stores each event, retries your endpoints, and lets you replay anything a downstream step missed.
Frequently asked questions
- How do I get a Slack webhook URL?
- Create an app at api.slack.com/apps, open Incoming Webhooks, switch it on, choose Add New Webhook to Workspace, pick a channel and copy the URL.
- Do Slack webhooks still work?
- Yes. Incoming webhooks created through a Slack app are the supported way. Only the old custom-integration webhooks are a legacy feature.
- Why does my Slack webhook return no_service?
- The webhook was removed, or the app it belongs to was uninstalled from the workspace. Create a new webhook.
- Can one Slack webhook post to several channels?
- No. Each incoming webhook posts to the channel chosen when it was created. Add one webhook per channel.