adamsxu / Slack-Chatgpt2

A Slack bot with a ChatGPT(or GPT4, bring your own API key) backend.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A General ChatGPT Bot for Your Slack Channel(s)

Deploy this function on flows.network, 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. If you do not already have one, sign up here.

  2. You will also need to sign up for flows.network with your GitHub account. It is free.

1 Create a bot from a template

Just click here

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

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 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

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!

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 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 is still in its early stages. We would love to hear your feedback!

About

A Slack bot with a ChatGPT(or GPT4, bring your own API key) backend.

License:Apache License 2.0


Languages

Language:Rust 100.0%