#241
Implement v2 receiver with fetch handler and Next.js example updates
This pull request introduces a major update to the @vercel/slack-bolt package and the Next.js example app, focusing on a complete rebuild of the VercelReceiver for Bolt v2, streamlined OAuth and event handling, improved token management, and updated documentation and configuration. The changes modernize the integration, simplify route handling, and enhance security and reliability for Slack app installations.
Key changes include:
1. Major VercelReceiver and OAuth Redesign
- Rebuilt
VercelReceiveron top of Bolt'sHTTPReceiver, removingcreateHandlerand legacy OAuth handlers. Now, routes exportGETandPOSTdirectly from the receiver, and OAuth is handled through a unified route. Several options and environment variable behaviors are changed or removed. Requires@slack/bolt4.7.3+ and Node.js 22.12+. (.changeset/vercel-receiver-v2.md) - Updated the Next.js example to use the new receiver API: routes now re-export
GETandPOSTfromsrc/bolt/app.ts, and legacy install/callback routes are removed. (src/app/api/slack/events/route.ts,src/app/api/slack/install/route.ts,src/app/api/slack/oauth-redirect/route.ts) [1] [2] [3] [4]
2. Improved Installation and Token Management
- Introduced an installation store using Upstash Redis, with tokens encrypted via
TOKEN_ENCRYPTION_SECRET. The store is automatically cleaned up when a workspace uninstalls the app or revokes tokens, ensuring no dead credentials are retained. (src/lib/installation-store.ts,src/bolt/listeners/events/app-uninstalled.ts,src/bolt/listeners/events/tokens-revoked.ts,src/bolt/listeners/events/index.ts) [1] [2] [3] [4] - Updated the Slack app manifest to enable token rotation and listen for
app_uninstalledandtokens_revokedevents. (manifest.json)
3. Documentation and Environment Variable Updates
- Updated
.env.exampleandREADME.mdto reflect new required environment variables for OAuth and token encryption, and to clarify setup steps for both development and production. (.env.example,README.md) [1] [2] [3] - Home page and install flow updated to use the new unified install endpoint. (
src/app/page.tsx)
4. CI and Build Process Updates
- Added a new GitHub Actions workflow (
ci-v2.yml) to test the receiver against multiple Node.js and Bolt versions, and removed the custom build script from the example app. (.github/workflows/ci-v2.yml,package.json) [1] [2]
5. Cleanup and Removal of Legacy Code
- Removed unused success and error pages in the example app, as OAuth success/failure is now handled through the main route. (
src/app/slack/success/page.tsx,src/app/slack/error/page.tsx) [1] [2]
These changes modernize the Slack Bolt integration, simplify deployment and maintenance, and improve security and reliability for users.
The latest updates on your projects. Learn more about Vercel for GitHub.