Simple Slack bot powered by OpenAI Chat API.
You can talk to the chat bot using OpenAI Chat API via Slack.
You have to mention the bot to talk to it.
You can talk to the bot without mentioning it.
Create an Slack app
Socket Mode
Bot Token Scopes
App Token Scopes
Event Subscriptions (Subscribe to bot events)
Messages Tab
Allow users to send Slash commands and messages from the messages tab
Poetry
Poetry is used to manage the dependencies.
Install the required packages
poetry install --no-root
Create the .env
file
cp .env.sample .env
Set the necessary environment variables in the .env
file
SLACK_BOT_TOKEN=xoxb-xxx
SLACK_APP_TOKEN=xapp-xxx
OPENAI_API_KEY=sk-xxx
OPENAI_ORGANIZATION=org-xxx # this parameter is optional
MODEL_NAME=gpt-3.5-turbo
For model name, see https://platform.openai.com/docs/models/overview
Run the application
poetry run python app.py
docker build -t simple-ai-slack-bot .
docker run -it simple-ai-slack-bot
docker-compose up