Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Build an AI-powered Slackbot with Node.js and Vercel Functions, enabling users to ask questions and receive answers from OpenAI's GPT model directly w...
This template provides an AI-powered Slackbot that leverages OpenAI's GPT model to answer questions directly within your Slack workspace. Built with Node.js and deployed using Vercel Functions, this bot offers a seamless way to integrate advanced conversational AI into your team's communication.
app_mention) and monitoring channel creation (channel_created).To get started, you'll need to configure several environment variables:
OPENAI_API_KEY: Obtain this from your OpenAI API Keys page.SLACK_BOT_TOKEN: Acquired from the Slack API Apps Page after creating an app, installing it to your workspace, and copying the Bot User OAuth Token from the OAuth & Permissions section.SLACK_SIGNING_SECRET: Found under Basic Information -> App Credentials on your Slack API Apps Page.SLACK_ADMIN_MEMBER_ID: Your Slack member ID, which can be copied from your Slack profile.These variables should be added to your Vercel project settings for deployment and to a local .env file for local testing.
After deploying your application to Vercel, you must configure Slack to send events to your bot:
https://<your-vercel-app>.vercel.app/api/events. Ensure this URL is verified by Slack.app_mention and channel_created bot events.For local testing, you can use the Vercel CLI and localtunnel:
pnpm i -g vercel
pnpm vercel dev --listen 3000 --yesIn a separate terminal:
npx localtunnel --port 3000Remember to update the Slack Event Subscription URL to your localtunnel URL during local development.