This Slack bot allows users to ask questions to a Quivr brain directly from Slack.
- Python 3.x
- Slack bot token and signing secret
- Quivr API key
quivr-explanation-slack-low-quality.mp4
-
Clone the repository:
git clone https://github.com/quivrHQ/slackbot.git
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Create a
.env
file in the project root. - Add the following variables to the
.env
file:SLACK_BOT_TOKEN=your-slack-bot-token SLACK_SIGNING_SECRET=your-slack-signing-secret QUIVR_API_KEY=your-quivr-api-key
- Create a
-
Set up a Slack app:
- Create a new Slack app.
- Add a bot user to the app.
- Install the app to your workspace.
- Copy the bot token and signing secret to the
.env
file.
-
Go to your Quivr account:
- Go to the user settings page.
- Copy the API key to the
.env
file.
-
Start the bot:
ngrok http 1234
This will create a public URL that you can use to expose the bot to the internet.
uvicorn main:api --reload --port 1234
-
Set up the Slack app:
- Go to the Slack app settings page.
- Add the public URL as the request URL for the Slack app.
- Subscribe to the
app_mention
event. - Save the changes.
-
Invite the bot to a Slack channel.
-
Mention the bot in a message to ask a question:
@quivr-bot What is the capital of France?
The bot will retrieve the answer from the Quivr brain and respond in the Slack channel.
- You can modify the
handle_app_mentions
function inmain.py
to customize the bot's behavior. - Adjust the Quivr API endpoints and request parameters as needed.
This project is licensed under the MIT License.