โ๏ธ Mintlify Slack Assistant
Slack bot that integrates with Mintlify’s documentation assistant API to provide intelligent answers to your team’s and customers’ questions. Built with Cloudflare Workers, Hono, and TypeScript.
โจ Features
- ๐ Smart Documentation Search: Leverages Mintlify’s API to search through your documentation
- ๐งต Thread Context Awareness: Maintains conversation context within Slack threads
- ๐ฌ Natural Conversations: Reply in threads without mentioning the bot after initial interaction
- ๐ Source Citations: Provides numbered source links for every answer
- ๐ Visual Feedback: Shows “eyes” emoji while processing requests
- ๐ Debug Mode: Add
[DEBUG]
to messages for detailed execution information - โก Fast Response: Built on Cloudflare Workers for edge performance
๐ Setup Instructions
๐ Prerequisites
- Cloudflare account with Workers enabled
- Slack workspace with admin access
- Mintlify API key
- Node.js 18+ and npm/yarn
Clone and install
git clone https://github.com/AnandChowdhary/mintlify-slack-assistant
npm install
Configure Slack app
Go to api.slack.com/apps and create a new app
Choose “From scratch” and select your workspace
Navigate to OAuth & Permissions and add these scopes:
app_mentions:read
- Read messages that mention your appchat:write
- Send messages as the botreactions:write
- Add emoji reactionsreactions:read
- View emoji reactionschannels:history
- View messages in public channelsgroups:history
- View messages in private channelsim:history
- View messages in DMsmpim:history
- View messages in group DMs
Install the app to your workspace and copy the Bot User OAuth Token
Configure event subscriptions
- In your Slack app settings, go to Event Subscriptions
- Enable Events and add your Worker URL:
https://your-worker.workers.dev/slack/events
- Subscribe to these bot events:
app_mention
- When someone mentions your botmessage.channels
- Messages in public channelsmessage.groups
- Messages in private channelsmessage.im
- Direct messagesmessage.mpim
- Group direct messages
Set environment variables
Create a .dev.vars
file for local development:
SLACK_BOT_USER_OAUTH_TOKEN=xoxb-your-token
MINTLIFY_PUBLIC_ASSISTANT_API_KEY=mint_dsc_your_key
Configure Cloudflare KV
- Create a KV namespace:
wrangler kv:namespace create "KV"
- Update
wrangler.jsonc
with the namespace ID:
{
"kv_namespaces": [
{
"binding": "KV",
"id": "your-namespace-id"
}
]
}
6๏ธโฃ Deploy to Cloudflare
# Deploy to production
wrangler publish
# Or deploy to a specific environment
wrangler publish --env production
Configuration
Environment variables
Variable | Description | Required |
---|---|---|
SLACK_BOT_USER_OAUTH_TOKEN |
Slack bot OAuth token | โ |
MINTLIFY_PUBLIC_ASSISTANT_API_KEY |
Mintlify API key | โ |
KV storage
The bot uses Cloudflare KV to store thread-to-topic mappings with a 7-day TTL. This enables conversation continuity within threads.
Debugging
Enable debug mode
Add [DEBUG]
to any message to see:
- Channel and thread information
- KV storage operations
- API request/response details
- Message processing steps
Common issues
- Bot not responding: Check OAuth scopes and event subscriptions
- No thread context: Verify KV namespace is properly configured
- API errors: Confirm Mintlify API key is valid
๐ License
MIT (c) Anand Chowdhary