{"library":"slack-edge","title":"Slack Edge Framework","description":"This library, currently at version 1.3.16, provides a framework for building Slack applications optimized for edge runtimes like Cloudflare Workers, Vercel Edge Functions, and Supabase Edge Functions. It also supports Deno, Bun, and Node.js. `slack-edge` emphasizes TypeScript support, offering enhanced type safety for Slack events and API interactions. It differentiates itself from Slack's Bolt framework by being specifically designed for edge environments, including out-of-the-box support for \"lazy listeners\" for asynchronous processing, similar to Bolt-Python. The project maintains a frequent release cadence, primarily focusing on bug fixes, dependency upgrades, and support for new Slack API event types. A key aspect is its minimal dependency footprint, relying primarily on `slack-web-api-client` for Slack API interactions. This design choice contributes to faster cold starts and lower resource consumption, making it ideal for serverless and edge computing architectures.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install slack-edge"],"cli":null},"imports":["import { SlackApp } from 'slack-edge';","import type { SlackEnv } from 'slack-edge';","import type { LazyListener } from 'slack-edge';","import type { CodedError } from 'slack-edge';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { SlackApp } from \"slack-edge\";\nimport { SlackEdgeAppEnv } from \"slack-cloudflare-workers\";\n\nexport default {\n  async fetch(\n    request: Request,\n    env: SlackEdgeAppEnv,\n    ctx: ExecutionContext\n  ): Promise<Response> {\n    // Initialize the SlackApp with environment variables provided by the adapter\n    const app = new SlackApp({ env })\n      .command(\"/hello-cf-workers\",\n        async (req) => {\n          // Synchronous handler, responsible for acknowledging the request within 3 seconds\n          return \":wave: This app runs on Cloudflare Workers!\";\n          // If no immediate response is needed, simply `async () => {}` works\n        },\n        async ({ context: { respond } }) => {\n          // Lazy listener, executed asynchronously for longer-running tasks\n          // This can take more than 3 seconds without timing out the initial request\n          await respond({ text: \"This is an async reply. How are you doing?\" });\n        }\n      );\n    // Run the app using the Cloudflare Workers adapter's `run` method\n    return await app.run(request, ctx);\n  }\n};\n\n// --- Local Development Environment Variables (e.g., in .dev.vars) ---\n// SLACK_SIGNING_SECRET=...\n// SLACK_BOT_TOKEN=xoxb-...\n// SLACK_LOGGING_LEVEL=DEBUG","lang":"typescript","description":"Demonstrates a basic Slack app on Cloudflare Workers, handling a slash command. It uses `slack-edge`'s core `SlackApp` and integrates with `slack-cloudflare-workers` to manage the edge function request/response lifecycle, showcasing both synchronous acknowledgment and asynchronous lazy listeners.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}