An example repo on how to deploy your own fully customizable Slackbot that uses Inkeep.
Important: The Deploy button creates a standalone copy of this repository. If you want to receive future updates from the original repository, first fork this repository on GitHub, then deploy your fork to Vercel.
- Integrates with Slack's API for easy Slack communication
- Works both with app mentions and direct messages
- Maintains conversation context within both threads and direct messages
- Node.js 18+ installed
- Slack workspace with admin privileges
- Inkeep API key -- see section below for instructions.
- A server or hosting platform (e.g., Vercel) to deploy the bot
- Log into the Inkeep dashboard at https://portal.inkeep.com.
- Navigate to the Projects section and select your project
- Open the Integrations tab
- Click Create Integration and choose API from the options (do not select Slack)
- Enter a Name for your new API integration
- Click on Create
- A generated API key will appear
- Add the key to Vercel's environment variables as
INKEEP_API_KEY.
npm install
# or
pnpm install- Go to https://api.slack.com/apps and click "Create New App"
- Choose "From scratch" and give your app a name
- Select your workspace
- Under "App Credentials", note down your "Signing Secret"
- Under the Display Information section, you can edit the App name, Short description, App icon & Preview, Background color, and the Long description.
- Go to "App Home"
- Enable "Messages Tab"
- Check "Allow users to send Slash commands and messages from the messages tab"
- Save Changes
-
Add the following Bot Token Scopes:
app_mentions:readchannels:historychat:writegroups:historychat:write.customizeim:historyim:writeim:readusers.profile:read
-
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 Credentials
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your-signing-secret
SLACK_APP_ID=your-app-id
# Inkeep Credentials
INKEEP_API_KEY=your-inkeep-api-key
Replace the placeholder values with your actual tokens.
- Adjust the
slackConfig.jsonfile to fit your needs. Modify theenabledForChannelsarray to enable the bot in the channels you want. This file mirrors a few options from the Slack integration page in the Inkeep dashboard.
- If building locally, follow steps in the Local Development section to tunnel your local environment and then copy the tunnel URL.
- If deploying to Vercel, follow the instructions in the Production Deployment section and copy your deployment URL.
Go to your Slack App settings
- Select your app
- Go to "Event Subscriptions"
- Enable Events
- Set the Request URL to either your local URL or your deployment URL: (e.g.
https://your-app.vercel.app/api/events) - Save Changes
- Under "Subscribe to bot events", add:
app_mentionmessage.channelsmessage.groupsmessage.im
Remember to include
/api/eventsin the Request URL.
- Go to "Interactivity & Shortcuts"
- Enable Interactivity
- Set the Request URL to:
https://your-app.vercel.app/api/events - Save Changes
Use the Vercel CLI and untun to test out this project locally:
pnpm i -g vercel
pnpm vercel dev --listen 3000 --yesnpx untun@latest tunnel http://localhost:3000Make 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:
- Go to vercel.com
- Create New Project
- Import your GitHub repository
-
Add your environment variables in the Vercel project settings:
SLACK_BOT_TOKENSLACK_SIGNING_SECRETSLACK_APP_IDINKEEP_API_KEY
-
After deployment, Vercel will provide you with a production URL
-
Update your Slack App configuration:
- Go to your Slack App settings
- Select your app
- Go to "Event Subscriptions"
- Enable Events
- Set the Request URL to:
https://your-app.vercel.app/api/events - Save Changes
- Under "Subscribe to bot events", add:
app_mentionmessage.channelsmessage.groupsmessage.im
The bot will respond to:
- Direct messages - Send a DM to your bot
- Mentions - Mention your bot in a channel using
@YourBotName
The bot maintains context within both threads and direct messages, so it can follow along with the conversation.
MIT