{"id":13641645,"url":"https://github.com/seratch/chatgpt-in-slack","last_synced_at":"2025-04-04T17:08:28.548Z","repository":{"id":106928001,"uuid":"608574029","full_name":"seratch/ChatGPT-in-Slack","owner":"seratch","description":"Swift demonstration of how to build a Slack app that enables end-users to interact with a ChatGPT bot","archived":false,"fork":false,"pushed_at":"2024-05-22T10:14:38.000Z","size":185,"stargazers_count":389,"open_issues_count":10,"forks_count":144,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-05-23T03:31:40.759Z","etag":null,"topics":["ai","aws","chatbot","chatbots","chatgpt","lambda-functions","openai","productivity","productivity-tools","python","python3","serverless","slack"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seratch.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-02T09:52:41.000Z","updated_at":"2024-05-27T12:42:56.373Z","dependencies_parsed_at":"2024-01-14T09:24:29.569Z","dependency_job_id":"4ec95467-e787-4c39-b6e3-5dbf1360f5fd","html_url":"https://github.com/seratch/ChatGPT-in-Slack","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/seratch%2FChatGPT-in-Slack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seratch%2FChatGPT-in-Slack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seratch%2FChatGPT-in-Slack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seratch%2FChatGPT-in-Slack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seratch","download_url":"https://codeload.github.com/seratch/ChatGPT-in-Slack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217184,"owners_count":20903009,"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":["ai","aws","chatbot","chatbots","chatgpt","lambda-functions","openai","productivity","productivity-tools","python","python3","serverless","slack"],"created_at":"2024-08-02T01:01:22.599Z","updated_at":"2025-04-04T17:08:28.529Z","avatar_url":"https://github.com/seratch.png","language":"Python","funding_links":[],"categories":["Chatbots"],"sub_categories":[],"readme":"# ChatGPT in Slack\n\nIntroducing a transformative app for Slack users, specifically designed to enhance your communication with [ChatGPT](https://openai.com/blog/chatgpt)!\nThis app enables seamless interaction with ChatGPT via Slack channels, optimizing your planning and writing processes by leveraging AI technology.\n\nDiscover the app's functionality by installing the live demo from https://bit.ly/chat-gpt-in-slack. \nKeep in mind that the live demo is personally hosted by [@seratch](https://github.com/seratch).\nFor corporate Slack workspaces, we strongly advise deploying the app on your own infrastructure using the guidelines provided below.\n\nIf you're looking for a sample app operating on [Slack's next-generation hosted platform](https://api.slack.com/future), check out https://github.com/seratch/chatgpt-on-deno 🙌\n\n## How It Works\n\nYou can interact with ChatGPT as you do on the website. \n\nWhile communicating in the same thread, the bot remembers what you have already said:\n\n\u003cimg width=\"700\" src=\"https://github.com/seratch/ChatGPT-in-Slack/assets/19658/501709b0-639d-4b35-98a9-3d5102c41685\" /\u003e\n\nConsider this realistic scenario: ask the bot to generate a business email for communicating with your manager:\n\n\u003cimg width=\"700\" src=\"https://user-images.githubusercontent.com/19658/222609940-eb581361-eeea-441a-a300-96ecdbc23d0b.png\"\u003e\n\nWith ChatGPT, you don't need to ask a perfectly formulated question at first. Adjusting the details after receiving the bot's initial response is a great approach:\n\n\u003cimg width=\"700\" src=\"https://user-images.githubusercontent.com/19658/222609947-b99ace0d-4c90-4265-940d-3fc373429b80.png\"\u003e\n\nDoesn't that sound cool? 😎\n\n## Three Supported Interfaces\n\nThere are three interfaces to use. When you want to share a conversation with others in the Slack workspace, always using channel threads is the best option. If you wish to use ChatGPT privately, the other interfaces are more convenient for that purpose.\n\n1. Talk to the bot in a channel thread\n2. Talk to the bot in a 1:1 DM\n3. Send prompts on your Home tab\n\n### Talk to the bot in a channel thread\n\nThis is the most common way to use this app. You can start a conversation with ChatGPT Bot at any time just by mentioning the bot in a thread's initial message. Within the thread, you don't need to mention the bot anymore:\n\n\u003cimg width=\"700\" src=\"https://github.com/seratch/ChatGPT-in-Slack/assets/19658/8b3199a9-b413-4002-a702-b0b92e866658\"\u003e\n\n### Talk to the bot in a 1:1 DM\n\nYou can privately ask for help using a 1:1 DM with the bot. No need to mention the bot. Just send a message in the DM:\n\n\u003cimg width=\"700\" src=\"https://github.com/seratch/ChatGPT-in-Slack/assets/19658/eadb7930-4e43-4a95-80ff-7263d02313b1\"\u003e\n\n### Send prompts on your Home tab\n\nOn the Home tab, in addition to the OpenAI API key and model configuration, you can use the quick proofreader and free prompt sender dialogs. These are so handy that you can quickly send inquiries to OpenAI, even from a mobile device.\n\n\u003cimg width=\"700\" src=\"https://github.com/seratch/ChatGPT-in-Slack/assets/19658/13a06d0a-225f-4ff4-9e16-a5a95cc2d36b\"\u003e\n\n\nHere is an example of proofreading on Home tab:\n\n\u003cimg width=\"400\" src=\"https://github.com/seratch/ChatGPT-in-Slack/assets/19658/6dcc8a3d-27bc-4719-b495-e3a5e39d1cc7\"\u003e\n\u003cimg width=\"400\" src=\"https://github.com/seratch/ChatGPT-in-Slack/assets/19658/ca4a8f18-9cbf-4e8d-b656-904596e5895f\"\u003e\n\n\nYou can generate an image just by giving a prompt to the DALL-E 3 model too:\n\n\u003cimg width=\"500\" src=\"https://github.com/seratch/ChatGPT-in-Slack/assets/19658/3b6942d2-a370-4c5b-ae11-ea18922c3729\"\u003e\n\n\nTo ask any other questions, you can use the from-scratch modal instead:\n\n\u003cimg width=\"400\" src=\"https://github.com/seratch/ChatGPT-in-Slack/assets/19658/72c663a4-b0d2-4ac5-9f75-25e776f500df\"\u003e\n\n## Running the App on Your Local Machine\n\nTo run this app on your local machine, you only need to follow these simple steps:\n\n* Create a new Slack app using the manifest-dev.yml file\n* Install the app into your Slack workspace\n* Retrieve your OpenAI API key at https://platform.openai.com/account/api-keys\n* Start the app\n\n```bash\n# Create an app-level token with connections:write scope\nexport SLACK_APP_TOKEN=xapp-1-...\n# Install the app into your workspace to grab this token\nexport SLACK_BOT_TOKEN=xoxb-...\n# Visit https://platform.openai.com/account/api-keys for this token\nexport OPENAI_API_KEY=sk-...\n\n# Optional: gpt-3.5-turbo and newer ones are currently supported (default: gpt-3.5-turbo)\nexport OPENAI_MODEL=gpt-4o\n# Optional: Model temperature between 0 and 2 (default: 1.0)\nexport OPENAI_TEMPERATURE=1\n# Optional: You can adjust the timeout seconds for OpenAI calls (default: 30)\nexport OPENAI_TIMEOUT_SECONDS=60\n# Optional: You can include priming instructions for ChatGPT to fine tune the bot purpose\nexport OPENAI_SYSTEM_TEXT=\"You proofread text. When you receive a message, you will check\nfor mistakes and make suggestion to improve the language of the given text\"\n# Optional: When the string is \"true\", this app translates ChatGPT prompts into a user's preferred language (default: true)\nexport USE_SLACK_LANGUAGE=true\n# Optional: Adjust the app's logging level (default: DEBUG)\nexport SLACK_APP_LOG_LEVEL=INFO\n# Optional: When the string is \"true\", translate between OpenAI markdown and Slack mrkdwn format (default: false)\nexport TRANSLATE_MARKDOWN=true\n# Optional: When the string is \"true\", perform some basic redaction on prompts sent to OpenAI (default: false)\nexport REDACTION_ENABLED=true\n# Optional: When the string is \"true\", this app shares image files with OpenAI (default: false)\nexport IMAGE_FILE_ACCESS_ENABLED=true\n\n# To use Azure OpenAI, set the following optional environment variables according to your environment\n# default: None\nexport OPENAI_API_TYPE=azure\n# default: https://api.openai.com/v1\nexport OPENAI_API_BASE=https://YOUR_RESOURCE_NAME.openai.azure.com\n# default: None\nexport OPENAI_API_VERSION=2023-05-15\n# default: None\nexport OPENAI_DEPLOYMENT_ID=YOUR-DEPLOYMENT-ID\n\n# Experimental: You can try out the Function Calling feature (default: None)\nexport OPENAI_FUNCTION_CALL_MODULE_NAME=tests.function_call_example\n\npython -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\npython main.py\n```\n\n### Using .env for credential loading\n\nIf you prefer using .env file to load env variables for local development, you can rename .env.example file to .env:\n    \n```bash\ncp .env.example .env\n```\nThen, replace the values in .env file with your own API keys and tokens:\n```text\nOPENAI_API_KEY=sk-your-openai-key\nSLACK_BOT_TOKEN=xoxb-your-slack-bot-token\nSLACK_APP_TOKEN=xapp-1-your-slack-app-token\n```\n\n## Running the App for Company Workspaces\n\nConfidentiality of information is top priority for businesses.\n\nThis app is open-sourced! so please feel free to fork it and deploy the app onto the infrastructure that you manage.\nAfter going through the above local development process, you can deploy the app using `Dockerfile`, which is placed at the root directory.\n\nThe `Dockerfile` is designed to establish a WebSocket connection with Slack via Socket Mode.\nThis means that there's no need to provide a public URL for communication with Slack.\n\n## Contributions\n\nYou're always welcome to contribute! :raised_hands:\nWhen you make changes to the code in this project, please keep these points in mind:\n- When making changes to the app, please avoid anything that could cause breaking behavior. If such changes are absolutely necessary due to critical reasons, like security issues, please start a discussion in GitHub Issues before making significant alterations.\n- When you have the chance, please write some unit tests. Especially when you touch internal utility modules (e.g., `app/markdown.py` etc.) and add/edit the code that do not call any web APIs, writing tests should be relatively easy.\n- Before committing your changes, be sure to run `./validate.sh`. The script runs black (code formatter), flake8 and pytype (static code analyzers).\n\n## Related Projects\n\n- [iwamot/collmbo](https://github.com/iwamot/collmbo): @iwamot's forked project, which supports other LLM providers in addition to OpenAI by leveraging [LiteLLM](https://github.com/BerriAI/litellm)\n\n## The License\n\nThe MIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseratch%2Fchatgpt-in-slack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseratch%2Fchatgpt-in-slack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseratch%2Fchatgpt-in-slack/lists"}