Hey there! 👋 Looking for a Slack bot that works with OpenAI but doesn't cost a fortune? You're in the right place! This is the only OpenAI-powered Slack bot that runs on both free Slack workspaces and AWS Lambda. This package provides a streamlined framework for handling Slack events with OpenAI integration, conversation history, and thread support - all without requiring a paid Slack subscription or dedicated server infrastructure.
All you need are these three keys to get started:
OPENAI_API_KEY=sk-xxx
SLACK_BOT_TOKEN=xoxb-xxx
SLACK_SIGNING_SECRET=xxxLet me tell you why this bot is different from others out there:
-
Works with Free Slack! 🎉
- Unlike other solutions that require Slack's paid plans, this bot works perfectly with free Slack workspaces
- Full functionality without any paid workspace requirements
- All core functionalities maintained on free tier
-
True Serverless Design ⚡
- The only Slack-OpenAI bot specifically engineered for AWS Lambda
- Eliminates the need for costly EC2 instances or self-hosting
- Addresses all Lambda-specific challenges out of the box
-
Using Latest OpenAI SDK
- Many existing solutions use outdated OpenAI versions
- We maintain compatibility with the latest OpenAI Python SDK (v1.59.5) as much as we can.
- Stays current with the latest LLM advancements
-
Simple Yet Powerful 💪
- While there are comprehensive solutions like @seratch's ChatGPT-in-Slack (created 2 years ago) or chatgpt-on-deno from same author, who is Slack employee Kazuhiro Sera
- They either lack updates or require Slack's framework that needs a paid plan
- We focus on simplicity and essential text-based chat functionality
-
Core Features Without Bloat 🛠️
- Handles the most critical issue: message deduplication
- Maintains automated testing
- Simple enough to fork and modify
- Available as a Python package for quick start
- Open source and free to use (no Slack paid version required)
-
Future-Proof & Extensible 🔮
- While keeping the core simple, the project is designed to be extensible
- Additional integrations through MCP-Bridge
- Supports hundreds of integrations using the same OpenAI format
Want to see it in action? Check out examples/slack_bot_bob in this repo! It's a production-ready example with:
✨ Full AWS SAM deployment setup 🔧 Detailed configuration guide 💬 Thread support & conversation history 🎯 Custom model configuration
Everything's included:
- Ready-to-use
template.yamlfor AWS SAM configuration - Step-by-step deployment instructions
- Environment variable setup
- Complete Slack app configuration walkthrough
Use any OpenAI-compatible API you prefer:
# Optional: Use any OpenAI-compatible API endpoint
OPENAI_BASE_URL=https://your-endpoint
# Optional: Use any model including your fine-tuned ones
OPENAI_MODEL=your-model-nameWorks seamlessly with:
- OpenAI API
- DeepSeek
- MCP-Bridge
- Ollama
- Your own fine-tuned models
- Any OpenAI-compatible API endpoint
Simple as pie:
pip install slack_bot_openaiHere's all you need to get started:
from slack_bot_openai.handler import SlackBotHandler
# Initialize the bot handler
bot_handler = SlackBotHandler(
system_message="Your system message here",
model="gpt-4o", # or your preferred model
include_chat_history=True
)
# Get the Lambda handler
lambda_handler = bot_handler.get_lambda_handler()- 💬 Slack event handling with OpenAI integration
- 🧠 Message history management
- 🔄 DynamoDB integration for message deduplication
- 📝 Thread message support
- ⚙️ Configurable system messages and models
- Python 3.11+
- openai==1.53.0
- slack-bolt>=1.18.0
- boto3==1.34.49
Required:
SLACK_BOT_TOKEN: Slack Bot User OAuth TokenSLACK_SIGNING_SECRET: Slack Signing SecretOPENAI_API_KEY: OpenAI API Key
Optional:
OPENAI_BASE_URL: Custom OpenAI API base URLOPENAI_MODEL: OpenAI model name (defaults to gpt-4o)INCLUDE_CHAT_HISTORY: Whether to include chat history (defaults to true)DYNAMODB_TABLE: DynamoDB table name for message deduplication
Love this bot? Want to make it better? We'd love your help! Feel free to:
- Open issues
- Submit PRs
- Suggest improvements
- Share your use cases
MIT License - Go wild! Use it, modify it, share it.