Skip to content

AI-Powered Slack Bot: A Python application integrating Slack with OpenAI's GPT-3 or GPT-4 model to create an interactive, AI-powered bot capable of understanding and responding to commands in natural language.

Notifications You must be signed in to change notification settings

alexbobes/chatgpt-slack-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Slack Bot using OpenAI's GPT-3 or GPT-4

This project includes a Slack bot that uses OpenAI's GPT-3 or GPT-4 model to respond to user messages. The bot listens for a /chatgpt command, sends the command's text to the GPT-3 API, and posts the model's response back to the Slack channel.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

You need to have Python 3.7+ installed on your system. You also need to install the necessary packages using pip:

pip install flask slack_sdk openai dotenv

Setup

Clone the repository to your local machine. Create a .env file in the root directory of the project and add the following environment variables:

OPENAI_API_KEY=<Your OpenAI API key>
SLACK_BOT_TOKEN=<Your Slack Bot User OAuth Token>
SLACK_APP_TOKEN=<Your Slack App-Level Token>

Run the Flask application

python app.py

The bot is now ready to receive /chatgpt commands in the Slack channel where you've invited the Bot.

How It Works

When a /chatgpt command is posted in the Slack channel, the bot extracts the text from the command and sends it to the OpenAI API. The API's response is then posted back to the Slack channel.

The bot's response includes the user's original message, the AI's response, and a dashed line for clarity.

About

AI-Powered Slack Bot: A Python application integrating Slack with OpenAI's GPT-3 or GPT-4 model to create an interactive, AI-powered bot capable of understanding and responding to commands in natural language.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages