DidierRLopes / slackGPT

Read slack messages from selected channels since last night and summarize them

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SlackGPT

The SlackGPT is a Slack bot that summarizes conversations and sends you a summary per channel.

If you want to run it locally, you can use:

python slackgpt.py

Otherwise, fork the project, set up the GitHub secrets and you can leverage the GitHub action to run it automatically.

Getting Started

Slack API

  1. Go to Slack API page and create a new app.

  2. Install the app in the workspace you are interested in summarizing Slack messages.

  3. Get the User OAuth Token which exists in the Install App settings. This will be needed to use Slack's SDK. Set this value as the SLACK_TOKEN on a .env file if you want to run the script locally or as a GitHub secret if you want to leverage the GitHub workflow.

Screenshot 2023-11-18 at 9 49 53 PM

  1. Create a Webhook URL for your channel so that you can receive messages' summary. Set this value as the SLACK_WEBHOOK_URL on a .env file if you want to run the script locally or as a GitHub secret if you want to leverage the GitHub workflow.

  2. Depending on the type of access needed, different User Token Scopes need to be set. Here's the methods that we will need and the associated user token scopes.

  • conversations_history: This method retrieves a conversation's history of messages and events. It requires the channels:history scope for public channels, or groups:history for private channels and im:history for direct messages.

  • users_info: This method returns information about a user. It requires the users:read scope.

  • conversations_info: This method retrieves information about a conversation. It requires the channels:read scope for public channels, or groups:read for private channels and im:read for direct messages.

Screenshot 2023-11-18 at 9 53 57 PM

OpenAI API

Go to OpenAI API page to extract the API key. Set this value as the OPENAI_API_KEY on a .env file if you want to run the script locally or as a GitHub secret if you want to leverage the GitHub workflow.

Slack channels

Get the Channel IDs that you are interested in reading messages from.

Set those values as the SLACK_CHANNEL_IDS on a .env file if you want to run the script locally or as a GitHub secret if you want to leverage the GitHub workflow. If you want to read from multiple channels you can set SLACK_CHANNEL_IDS with multiple IDs separated by commas (with no space), e.g. ABC123,DEF456,GHI789.

About

Read slack messages from selected channels since last night and summarize them


Languages

Language:Python 100.0%