Welcome to the world of AI-enhanced communication! This blog will guide you through the process of setting up your very own open-source Slack AI app, enabling you to summarize threads and channels on command using OpenAI technologies. Let’s embark on this journey of making your Slack workspace smarter!
Getting Started
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
Prerequisites
- Python 3.9.x – 3.11.x
- OpenAI API key
- Slack App associated API tokens
- Poetry package manager
- ngrok (recommended)
Installation
- Clone the repository to your local machine.
- Navigate to the project directory.
- Install the required Python packages using Poetry:
- Install the dictionary model:
- Create a
.env
file in the root directory of the project, and fill it with your API keys and tokens. Use theexample.env
file as a template:
poetry install
poetry run python -m spacy download en_core_web_md
cp example.env .env
open .env
Slack App Configuration
Make a copy of manifest.json
and change the request URL to your ngrok or server URL. Create a new Slack app here and configure it using your manifest.yaml
file. You can adjust the name and description as needed. Make sure to retrieve the Bot User OAuth Token from the Install App page and add it to your .env
file as SLACK_BOT_TOKEN
.
Usage
To run the application, start the FastAPI server:
poetry run uvicorn ossai.slack_server:app --reload
Next, expose the server to the internet using ngrok. Run ngrok with the following command:
ngrok http 8000
Finally, add the ngrok URL to your Slack app settings. Now you’re all set!
Customization
You can customize the following options:
- Channel Summary: Adjust the ChatGPT prompt in
topic_analysis.py
- Thread Summary: Modify the ChatGPT prompt in
summarizer.py
Testing
This project utilizes pytest and pytest-cov for testing and measuring coverage. To run the tests:
- Navigate to the project root directory.
- Run the following command to execute the tests with coverage:
- You’ll see a coverage report that highlights the code lines tested.
pytest --cov=ossai tests
Troubleshooting
If you run into issues during setup, consider the following:
- Ensure you have installed all prerequisites correctly.
- Double-check your API keys and tokens in the
.env
file. - Make sure your ngrok tunnel is running and the URL is correctly set in Slack.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Future Enhancements
The development of this AI app is ongoing. Upcoming features you can expect include:
- Integration with LangChain for greater flexibility.
- Option to summarize messages since a specified date.
- Support for anonymized message summaries.
- And much more to enhance functionality!
Conclusion
Congratulations on setting up your open-source Slack AI application! You’ve taken a significant step towards enhancing communication and productivity in your Slack workspace. At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.