Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/flows-network/slack-chatgpt

A general ChatGPT bot for your slack channel
https://github.com/flows-network/slack-chatgpt

chatgpt chatgpt-api rust slack

Last synced: about 1 month ago
JSON representation

A general ChatGPT bot for your slack channel

Awesome Lists containing this project

README

        

# A General ChatGPT Bot for Your Slack Channel(s)

[Deploy this function on flows.network](#deploy-chatgpt-slack-bot-on-your-slack-channel), and you will get a Slack bot that uses ChatGPT to respond to every question in your Slack workspace automatically. Below is an example:

image

## Deploy your own Slack ChatGPT bot in 3 simple steps

1. Create a bot from a template
2. Authenticate your Slack
3. Add your OpenAI API key

### 0 Prerequisites

1. You will need to bring your own [OpenAI API key](https://openai.com/blog/openai-api). If you do not already have one, [sign up here](https://platform.openai.com/signup).

2. You will also need to sign up for [flows.network](https://flows.network/) with your GitHub account. It is free.

### 1 Create a bot from a template

[**Just click here**](https://flows.network/flow/createByTemplate/Slack-Chatgpt)

You can customize the repo name. You will fork this template repo to your GitHub.

Click on the **Create and Build** button.

image

### 2 Authenticate the bot to access Slack

Click the "+ Authenticate" button to authorize your Slack account.
image

You'll enter which Slack channel you want your bot to be deployed in.

* `slack_channel`: Slack channel where you want to deploy the bot. Case sensitive.
* `slack_workspace`: Slack organization of the Slack channel where you want to deploy the bot. Case sensitive.

Enter your Slack workspace and channel respectively in the red boxes below.
![image](https://github.com/flows-network/github-star-slack-messenger/assets/45785633/0d9ac244-f327-4366-972c-47ef05472057)

Next, let's grant flows.network to access the Slack channel you just entered. The Slack channel must be public.

Click the "Connect/+ Add new authentication" button to authenticate your Slack account. You'll be redirected to a new page where you must grant [flows.network](https://flows.network/) permission to install the `flows-network` bot on your workspace. This workspace is the one you entered into the `slack_workspace` above.

### 3 Add your OpenAI API key

Click the "Connect" button to authenticate your OpenAI account. You'll be redirected to a new page where you can copy and paste your OpenAI API key.

[image](https://user-images.githubusercontent.com/45785633/222973214-ecd052dc-72c2-4711-90ec-db1ec9d5f24e.png)

Close the tab and go back to the flow.network page once you are done. Click **Deploy**.

image

## Ready to go

As soon as the flow function's status becomes `running`, the ChatGPT Slack bot goes live. Go ahead and chat with ChatGPT by sending a message in the channel!
image

## FAQ

### Customize the bot

The bot's source code is available in the GitHub repo you cloned from the template. Feel free to make changes to the source code (e.g., model, context length, API key and prompts) to fit your own needs. If you need help, [ask in Discord](https://discord.gg/ccZn9ZMfFf)!

### Use GPT4

By default, the bot uses GPT3.5. If your OpenAI API key has access to GPT4, you can open the `src/lib.rs` file
in your cloned source code repo, and change `GPT35Turbo` to `GPT4` in the source code. Commit and push the change back to GitHub.
The flows.network platform will automatically detect and rebuild the bot from your updated source code.

### Deploy the bot on different Slack channels

You can [manually create a new flow](https://flows.network/flow/new) and import the source code repo for the bot (i.e., the repo you cloned from the template).

image
Choose a template repo and enter the `slack_channel` and `slack_workspace` to point to the target slack channel you need to deploy the bot in.
image

Click **Build**.

image

You have already authorized the access to your Slack. Click **Continue**.
image

You have already entered your OpenAI key before. click **Deploy**.

You can repeat this for all target slack channels you would like to deploy this bot in.

> You can have a single flow function repo deployed as the source code for multiple bots. When you update the source code in the repo, and push it to GitHub, it will change the behavior of all the bots.

> [flows.network](https://flows.network/) is still in its early stages. We would love to hear your feedback!