
Slack Bolt with Next.js Template
This is a generic Bolt for JavaScript (TypeScript) template app used to build Slack apps with Next.js
Before getting started, make sure you have a development workspace where you have permissions to install apps. You can use a developer sandbox or create a workspace
Installation
Clone and install dependencies
git clone https://github.com/vercel-partner-solutions/slack-bolt-with-next.git && cd slack-bolt-with-next && pnpm install
Create a Slack App
- Open https://api.slack.com/apps/new and choose "From an app manifest"
- Choose the workspace you want to use
- Copy the contents of
manifest.jsoninto the text box that says "Paste your manifest code here" (JSON tab) and click Next - Review the configuration and click Create
- On the Install App tab, click Install to <Workspace_Name>.
- You will be redirected to the App Configuration dashboard
- Copy the Bot User OAuth Token into your environment as
SLACK_BOT_TOKEN - On the Basic Information tab, copy your Signing Secret into your environment as
SLACK_SIGNING_SECRET
Prepare for Local Development
- Add your
NGROK_AUTH_TOKENto your.envfile- You can get a free token here
- In the terminal run
slack app link - If prompted
update the manifest source to remoteselectyes - Copy your App ID from the app you just created
- Select
Localwhen prompted - Open
.slack/config.jsonand update your manifest source tolocal
{"manifest": {"source": "local"},"project_id": "<project-id-added-by-slack-cli>"}
- Start your local server using
slack run. If prompted, select the workspace you'd like to grant access to
- Select
yesif asked "Update app settings with changes to the local manifest?"
- Open your Slack workspace, add your Slackbot to a channel, and send
hello. Your app should reply withworld!
Deploy to Vercel
- Create a new Slack app for production following the steps from above
- Create a new Vercel project here and select this repo
- Copy the Bot User OAuth Token into your Vercel environment variables as
SLACK_BOT_TOKEN - On the Basic Information tab, copy your Signing Secret into your Vercel environment variables as
SLACK_SIGNING_SECRET - When your deployment has finished, open your App Manifest from the Slack App Dashboard
- Update the manifest so all the
request_urlandurlfields usehttps://<your-app-domain>/api/slack/events - Click save and you will be prompted to verify the URL
- Open your Slack workspace and add your app to any channel
- Note: Make sure you add the production app, not the local app we setup earlier
- Send
helloand your app will respond withworld! - Your app will now automatically build and deploy whenever you commit to your repo. More information here
Project Structure
manifest.json
manifest.json defines your Slack app's configuration. With a manifest, you can create or update an app with a pre-defined configuration
src/bolt/app.ts
This is the Bolt app entry. It initializes @vercel/slack-bolt's VercelReceiver and registers listeners
src/bolt/listeners
Every incoming request is routed to a "listener". Inside this directory, we group each listener by Slack Platform feature, e.g. messages for message events
Route Handler: src/app/api/slack/events/route.ts
This file defines your Next.js Route Handler that receives Slack events. Its pathname matches the URLs defined in your manifest.json. Next.js uses file-based routing for API handlers. Learn more in the Next.js docs: https://nextjs.org/docs/app/building-your-application/routing/route-handlers
Custom Scripts
pnpm dev:tunnel: A helper script to automatically start your Slack app with ngrok tunneling
Notes
- If you see a warning about
expressbeing externalized:@slack/boltships an Express receiver. Turbopack may analyze its static import even if you don't use it. Keepingexpressas a dependency or aliasing it to a stub resolves this during development.
Related Templates
Slack Agent Template

Slack Bolt with Nitro

Slack Bolt with Hono
