{"id":13423943,"url":"https://github.com/pedrorito/ChatGPTSlackBot","last_synced_at":"2025-03-15T17:32:39.121Z","repository":{"id":64380845,"uuid":"574252086","full_name":"pedrorito/ChatGPTSlackBot","owner":"pedrorito","description":"🤖 A Slack bot that integrates with OpenAI's ChatGPT to provide answers, written in Python","archived":false,"fork":false,"pushed_at":"2023-05-10T11:54:18.000Z","size":34,"stargazers_count":379,"open_issues_count":3,"forks_count":68,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-05-22T11:32:15.051Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pedrorito.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-12-04T21:56:18.000Z","updated_at":"2024-05-10T10:48:04.000Z","dependencies_parsed_at":"2024-01-13T00:38:31.423Z","dependency_job_id":null,"html_url":"https://github.com/pedrorito/ChatGPTSlackBot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrorito%2FChatGPTSlackBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrorito%2FChatGPTSlackBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrorito%2FChatGPTSlackBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrorito%2FChatGPTSlackBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pedrorito","download_url":"https://codeload.github.com/pedrorito/ChatGPTSlackBot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243767578,"owners_count":20344944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T00:00:45.408Z","updated_at":"2025-03-15T17:32:38.762Z","avatar_url":"https://github.com/pedrorito.png","language":"Python","funding_links":[],"categories":["Uncategorized","Bots","Official Resources","Integrations","Chat bots","others","Slack","Thanks to all the contributors!","Languages","Using ChatGPT in other apps","Python","Addons, extensions, plug-ins for integrating LLM into third-party applications"],"sub_categories":["Uncategorized","Examples","Access ChatGPT from other platforms","Slack","Other","Python","Other user interfaces"],"readme":"# ChatGPT for Slack Bot\n[![playwright-version](https://img.shields.io/badge/revChatGPT-0.0.31.5-green.svg)](https://github.com/acheong08/ChatGPT)\n[![license](https://img.shields.io/badge/License-GPL%202.0-brightgreen.svg)](LICENSE)\n\nThis is a simple Slackbot that uses the [acheong08/ChatGPT](https://github.com/acheong08/ChatGPT) `revChatGPT` package to respond to messages in Slack. It is designed to be used with the Slack Events API, and it listens for `app_mention` events, which are triggered when a user mentions the bot in a Slack channel.\n\nWhen the bot receives a `app_mention` event, it extracts the user's message from the event payload, sends it to the `revChatGPT` package to generate a response, and then sends the response back to the user via Slack.\n\nThe `revChatGPT` package is used to handle authentication and communication with the GPT-3 API, and it is also used to refresh the session with the GPT-3 API on a regular basis. This is done in a separate thread to prevent the session from expiring while the bot is handling requests.\n\n## Usage\n\nTo use the bot, you will need to install the dependencies and set the `OPENAI_API_KEY` environment variable that you can get from https://platform.openai.com/account/api-keys. You also need to set `SLACK_SIGNING_SECRET` and `SLACK_BOT_TOKEN` environment variables after creating the Slack App. You can then run the `app.py` script to start the bot.\n\n```bash\npip install -r requirements.txt\nexport SLACK_SIGNING_SECRET=slack_signing_secret\nexport SLACK_BOT_TOKEN=slack_bot_token\nexport OPENAI_API_KEY=you_openai_api_key\npython app.py\n```\n\nAlternatively, you can use the containerized version by setting the environment variables in the `variables.env` file and then run\n\n```\ndocker-compose up -d\n```\n\nOnce the bot is running, you can mention it in a Slack channel to send it a message. For example, you can type `@my-bot hello` to send the message \"hello\" to the bot. The bot will respond with a generated message based on the GPT-3 model.\n\n## ChatGPT Configuration\n\nThe `ChatGPTConfig` dictionary at the top of the `app.py` script contains the configuration for the `revChatGPT` package. It specifies the API token for the OpenAI account that the bot will use to authenticate with the GPT-3 API. The value is read from the `OPENAI_API_KEY` environment variable.\n\nThe `conversation_id` parameter in the `Chatbot` constructor is used to specify the ID of the conversation that the bot should use. If this parameter is not provided, the `revChatGPT` package will generate a new conversation ID for each message that the bot receives.\n\n## Slack Configuration\n\nBy default, `app.py` is exposing port 4000 for Slack events. You may change the port number in the end of the script.\n\nTo configure the Slack App, follow [these](https://github.com/slackapi/python-slack-events-api/blob/main/example/README.rst) example instructions from the official SlackApi GitHub account.\n\nFor this bot, the required Scopes in `OAuth \u0026 Permissions` are:\n* app_mentions:read\n* chat:write\n* im:write\n\nFor direct message required \u0026 config :\n* `Enable bot direct messages` go to : Features -\u003e App Home -\u003e (Enable) Messages Tab\n* `OAuth \u0026 Permissions` im:history and message:im\n\nIn the `Event Subscriptions`, you need to subscribe to the `app_mention` event.\n\n## Limitations\n\nThe bot uses a pre-trained GPT-3 model, which means that its responses are limited to the information that is contained in the model. It may not be able to respond accurately to messages that are outside the scope of the pre-trained model.\n\n## Notes\n\nThe `tls-client` python library that is used by the `revChatGPT` package does not currently support ARM architectures. As a result, the bot may not be able to run on devices with ARM processors. This limitation will be addressed in a future update.\n\n## Disclaimer\nThis is a personal project and is not affiliated with OpenAI or Slack in any way.\n\n## License\nThis project is released under the terms of the GPL 2.0 license. For more information, see the [LICENSE](LICENSE) file included in the repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedrorito%2FChatGPTSlackBot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpedrorito%2FChatGPTSlackBot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedrorito%2FChatGPTSlackBot/lists"}