An AI-powered chatbot for Slack powered by the AI SDK by Vercel.
npm install# orpnpm install
Add the following Bot Token Scopes:
app_mentions:read
assistant:write
chat:write
im:history
im:read
im:write
Install the app to your workspace and note down the "Bot User OAuth Token"
Create a .env
file in the root of your project with the following:
# Slack CredentialsSLACK_BOT_TOKEN=xoxb-your-bot-tokenSLACK_SIGNING_SECRET=your-signing-secret# OpenAI CredentialsOPENAI_API_KEY=your-openai-api-key# Exa API Key (for web search functionality)EXA_API_KEY=your-exa-api-key
Replace the placeholder values with your actual tokens.
Go to your Slack App settings
https://your-app.vercel.app/api/events
)app_mention
assistant_thread_started
message:im
Remember to include
/api/events
in the Request URL.
Use the Vercel CLI and untun to test out this project locally:
pnpm i -g vercelpnpm vercel dev --listen 3000 --yes
npx untun@latest tunnel http://localhost:3000
Make sure to modify the subscription URL to the untun
URL.
Note: you may encounter issues locally with
waitUntil
. This is being investigated.
Push your code to a GitHub repository
Deploy to Vercel:
Add your environment variables in the Vercel project settings:
SLACK_BOT_TOKEN
SLACK_SIGNING_SECRET
OPENAI_API_KEY
EXA_API_KEY
After deployment, Vercel will provide you with a production URL
Update your Slack App configuration:
https://your-app.vercel.app/api/events
app_mention
assistant_thread_started
message:im
The bot will respond to:
@YourBotName
The bot maintains context within both threads and direct messages, so it can follow along with the conversation.
Weather Tool: The bot can fetch real-time weather information for any location.
Web Search: The bot can search the web for up-to-date information using Exa.
The chatbot is built with an extensible architecture using the AI SDK's tool system. You can easily add new tools such as:
To add a new tool, extend the tools object in the lib/ai.ts
file following the existing pattern.
You can also disable any of the existing tools by removing the tool in the lib/ai.ts
file.
MIT
An AI-powered chatbot for Slack powered by the AI SDK by Vercel.
npm install# orpnpm install
Add the following Bot Token Scopes:
app_mentions:read
assistant:write
chat:write
im:history
im:read
im:write
Install the app to your workspace and note down the "Bot User OAuth Token"
Create a .env
file in the root of your project with the following:
# Slack CredentialsSLACK_BOT_TOKEN=xoxb-your-bot-tokenSLACK_SIGNING_SECRET=your-signing-secret# OpenAI CredentialsOPENAI_API_KEY=your-openai-api-key# Exa API Key (for web search functionality)EXA_API_KEY=your-exa-api-key
Replace the placeholder values with your actual tokens.
Go to your Slack App settings
https://your-app.vercel.app/api/events
)app_mention
assistant_thread_started
message:im
Remember to include
/api/events
in the Request URL.
Use the Vercel CLI and untun to test out this project locally:
pnpm i -g vercelpnpm vercel dev --listen 3000 --yes
npx untun@latest tunnel http://localhost:3000
Make sure to modify the subscription URL to the untun
URL.
Note: you may encounter issues locally with
waitUntil
. This is being investigated.
Push your code to a GitHub repository
Deploy to Vercel:
Add your environment variables in the Vercel project settings:
SLACK_BOT_TOKEN
SLACK_SIGNING_SECRET
OPENAI_API_KEY
EXA_API_KEY
After deployment, Vercel will provide you with a production URL
Update your Slack App configuration:
https://your-app.vercel.app/api/events
app_mention
assistant_thread_started
message:im
The bot will respond to:
@YourBotName
The bot maintains context within both threads and direct messages, so it can follow along with the conversation.
Weather Tool: The bot can fetch real-time weather information for any location.
Web Search: The bot can search the web for up-to-date information using Exa.
The chatbot is built with an extensible architecture using the AI SDK's tool system. You can easily add new tools such as:
To add a new tool, extend the tools object in the lib/ai.ts
file following the existing pattern.
You can also disable any of the existing tools by removing the tool in the lib/ai.ts
file.
MIT