Test Slack webhooks
Get a Request URL for the Events API, slash commands or interactivity, see each payload as it arrives, check X-Slack-Signature with your signing secret, and forward requests to your local server. Free, no signup.
Get a webhook URLAdd the URL in Slack
- Open webhookcat.com, copy your URL and add
/slackto the end. Sub-paths are kept when requests are forwarded, so this one reaches the route in the code below. - Open your app at
api.slack.com/apps. - For events, open Event Subscriptions, turn on Enable Events and paste your WebhookCat URL as the Request URL. Slack sends a url_verification challenge, WebhookCat answers it, and Slack marks the URL as verified.
- For slash commands, open Slash Commands, click Create New Command and use the URL as its Request URL. Buttons and modals use the Request URL under Interactivity & Shortcuts.
What Slack sends
- X-Slack-Signature
v0=followed by the hex HMAC-SHA256 ofv0:, the timestamp, a colon and the body.- X-Slack-Request-Timestamp
- When Slack signed the request, in Unix seconds.
- X-Slack-Retry-Num
- Present when Slack retries an event, starting at 1.
- X-Slack-Retry-Reason
- Why it retried, such as
http_timeout.
Check the signature
Open a request in WebhookCat and paste the secret into the Signature box under it. You'll see right away whether it matches. The check runs in your browser, and the secret is never sent or saved.
Copy the Signing Secret from your app's Basic Information page.
The same check in your own Node.js server:
import crypto from "node:crypto";
import express from "express";
const app = express();
const secret = process.env.SLACK_SIGNING_SECRET;
// Events are JSON and slash commands are form-encoded: read both raw.
const raw = express.raw({ type: "*/*" });
// Constant-time comparison; timingSafeEqual needs equal lengths.
const matches = (a, b) => {
const x = Buffer.from(a);
const y = Buffer.from(b);
return x.length === y.length && crypto.timingSafeEqual(x, y);
};
app.post("/slack", raw, (req, res) => {
const ts = req.get("x-slack-request-timestamp");
if (!ts || Math.abs(Date.now() / 1000 - Number(ts)) > 300) {
return res.status(400).send("Stale request");
}
const hmac = crypto.createHmac("sha256", secret).update(`v0:${ts}:${req.body}`);
if (!matches("v0=" + hmac.digest("hex"), req.get("x-slack-signature") ?? "")) {
return res.status(401).send("Bad signature");
}
res.sendStatus(200);
});Forward to your local server
In the inbox you pasted into Slack, open Share and run the command shown there. It forwards each request to localhost:3000/slack with the same headers and body, so the signature check in your code passes too. Needs Node.js 22 or later.
$ npx webhookcat listen 3000 --inbox "https://webhookcat.com/#<id>/<key>"Starting from the terminal instead? npx webhookcat listen 3000 creates a new URL and prints it. Paste that URL plus /slack into Slack. More in the docs.
Good to know
- Slack expects a response within 3 seconds. For events it then retries up to three times, adding X-Slack-Retry-Num.
- The url_verification challenge is answered whatever response you set in WebhookCat. Every other request gets your response.
- Slash command payloads are form-encoded, and WebhookCat lists their fields under Form fields. Slack shows the response body to the person who ran the command, so set a custom text or JSON response to see how it looks.