Skip to content

Lightweight Go Slack Bot with OpenAI Assistants API

Notifications You must be signed in to change notification settings

dominikwinter/slackgpt

Repository files navigation

Go Slack-Bot with OpenAI Assistants API

This is a Slack Bot written in Go. It integrates OpenAI’s latest Assistants API into Slack to respond to messages. The app acts as a web server that listens for incoming messages from Slack, sends these messages to OpenAI’s API, and subsequently sends the AI-generated responses back to Slack.

It uses the new Assistants API from OpenAI with the ability to upload files like PDFs, allowing you to ask questions about the content of the file.

Purposefully, OpenAI and Slack libs were foregone to create a more lightweight application.

Please note that you need to have a Slack account and a workspace to use this app. You also need to have an OpenAI account and an API key. Please edit the .env file with your Slack and OpenAI credentials.

How to Start the Service

To start the SlackGPT service, follow these steps:

Prerequisites

Ensure that you have the following installed on your local machine:

Building the Service

  1. Clone the Repository:

    git clone https://github.com/yourusername/slackgpt.git
    cd slackgpt
  2. Build the Project: Use the Makefile to build the project.

    make
  3. Release Build: Create a release build for the service.

    make release

Deploying the Service

  1. Copy Files to Server: Manually copy the following files to your server using scp or any other file transfer method:

    • slackgpt-linux-amd64
    • docker-compose.yml
    • .env

    Example using scp:

    scp slackgpt-linux-amd64 docker-compose.yml .env youruser@yourserver:/path/to/destination/
  2. SSH into Your Server:

    ssh youruser@yourserver
  3. Start the Service: Navigate to the directory where you copied the files and run the following command to start the service using Docker Compose:

    docker compose up -d