Verify Slack request signatures: v0:timestamp:body
Slack signs the string v0:<timestamp>:<body> with HMAC-SHA256 and sends the hex digest as v0= in X-Slack-Signature.
The signed string
Slack does not sign the body alone. The version prefix, the timestamp and the body are joined with colons, and that string is the HMAC message.
base = "v0:" + X-Slack-Request-Timestamp + ":" + raw body signature = "v0=" + HMAC-SHA256(Signing Secret, base).hex
The timestamp arrives in its own header, so copying only the body can never match. This is why the timestamp field in the tool must be filled in.
Verification code
const ts = req.get("X-Slack-Request-Timestamp") || "";
const header = req.get("X-Slack-Signature") || "";
const base = Buffer.concat([Buffer.from(`v0:${ts}:`), req.body]);
const expected = "v0=" + crypto
.createHmac("sha256", process.env.SLACK_SIGNING_SECRET)
.update(base).digest("hex");
const ok = header.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(header), Buffer.from(expected));
const fresh = Math.abs(Date.now() / 1000 - Number(ts)) <= 300;
if (!ok || !fresh) return res.status(401).send("invalid");The five-minute window and replays
Slack recommends rejecting requests older than five minutes (300 seconds). That check is what stops a replayed event, because the signature itself is static for a given body.
Handle url_verification first
When you configure the app, Slack first sends a url_verification request with a challenge. That request is signed too, so verify before returning the challenge. Returning it unverified lets anyone probe your endpoint.
if (body.type === "url_verification") {
// signature already verified above
return res.json({ challenge: body.challenge });
}Common mistakes
- Converting the timestamp to a number and losing characters.
- Verifying a body that gained a trailing newline.
- Using the Bot Token or Verification Token instead of the Signing Secret.
- Dropping the v0 prefix before comparing.
Enter the timestamp and compute the v0 signature directly.
Open the signature verifierFrequently asked questions
Where is the Signing Secret?
In your Slack app settings: Basic Information → App Credentials → Signing Secret. It differs from the Verification Token.
How do I stop duplicate events?
Check the five-minute window and deduplicate by event_id so the same event is processed once.
Does Slack retry?
Yes, when there is no response or a 5xx. Respond 200 within three seconds and move the work to an async queue.
This guide follows the signing schemes published by GitHub, Stripe, Slack, Shopify and Toss Payments.
← Guides