Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/slack_bolt/src/receivers/verify-request.ts>verify

TypeScript framework to build Slack apps in a flash with the latest platform features. Deno port of @slack/bolt
Latest
function verify
import { verify } from "https://deno.land/x/slack_bolt@1.0.0/src/receivers/verify-request.ts";

Verify the authenticity of an incoming HTTP request from Slack and buffer the HTTP body.

When verification succeeds, the returned promise is resolved. When verification fails, the returned promise is rejected with an error describing the reason. IMPORTANT: The error messages may contain sensitive information about failures, do not return the error message text to users in a production environment. It's recommended to catch all errors and return an opaque failure (HTTP status code 401, no body).

Verification requires consuming req as a Readable stream. If the req was consumed before this function is called, then this function expects it to be stored as a Buffer at req.rawBody. This is a convention used by infrastructure platforms such as Google Cloud Platform. When the function returns, the buffered body is stored at the req.rawBody property for further handling.

The function is designed to be curry-able for use as a standard http RequestListener, and therefore keeps req and res are the last arguments. However, the function is also async, which means when it is curried for use as a RequestListener, the caller should also capture and use the return value.

Parameters

options: VerifyOptions
req: ServerRequest

Returns

Promise<Uint8Array>