Coder Social home page Coder Social logo

slack-summarizer's Introduction

Script for summarizing Slack public channels using ChatGPT

日本語はこちら

by masuidrive @ Bloom&Co., Inc. 2023- APACHE LICENSE, 2.0

This script uses OpenAI's ChatGPT API to create and post a summary of a Slack public channel.

In organizations where the number of channels is increasing, it can be difficult to keep up with reading all the activity. By creating and posting summaries, it is easier to keep track of channel activity.

Most of this code was written using ChatGPT. If you have any better prompts or feature enhancements, please submit a Pull Request.

Please check OpenAI's terms and conditions of information handling for yourself, including the following

https://platform.openai.com/docs/data-usage-policies

If you have any questions, please feel free to contact me on http://twitter.com/masuidrive_en or http://twitter.com/masuidrive.

How to set it up on GitHub Actions

It runs on GitHub Actions every day at 5:00 a.m., so if you want to run it in a different environment, you'll have to figure it out.

Fork it to your own GitHub account

  • Click the "Fork" button in the upper right to fork it to your own repository.
  • Make the GitHub Actions executable by upgrading to a paid plan or some other means.

Edit running time

  • GitHub Actions uses the cron syntax to schedule jobs, which is specified in the .github/workflows/summarizer.yaml file with the minute hour * * * format.
  • Since this is in UTC, you need to adjust for your own time zone.
  • For example, to run the script every day at 5:00 AM in Japan, you would specify 0 20 * * * to run it at 8:00 PM UTC the day before.

Set environment variables

  • Open the "Settings" tab and click "Secrets and variables"->"Actions".
  • Click the green "New Repository Secret" button to set environment variables for the following three variables.

OPEN_AI_TOKEN

  • OpenAI's authentication token
  • Access OpenAI's website.
  • Click the "Sign In" button on the upper right and log in to your account.
  • Click "API Key" from the "API" menu at the top of the page to generate an API key.
  • When you access the "API Key" page, the API key will be displayed. Copy it and paste it into Value.

SLACK_BOT_TOKEN

  • Slack's API authentication token
  • Access the Slack API website and log in.
  • Click "Create a new app" and select "From an app manifest", and copy the following contents to the manifest.
{"display_information":{"name":"Summary","description":"Public channelのサマリーを作る","background_color":"#d45f00"},"features":{"bot_user":{"display_name":"Summary","always_online":false}},"oauth_config":{"scopes":{"bot":["channels:history","channels:join","channels:read","chat:write","users:read"]}},"settings":{"org_deploy_enabled":true,"socket_mode_enabled":false,"token_rotation_enabled":false}}
  • Click "Install App" on the left side of the screen, then click "Install App to Workspace" that appears on the right side to install the app in your workspace. Once the installation is complete, the bot's OAuth access token will be displayed.
  • Copy this token that begins with xoxb- and paste it into Value.

SLACK_POST_CHANNEL_ID

  • The channel_id in Slack where you want to post the summary result
  • Open the Slack channel where you want to post the summary results.
  • Click the channel name at the top and paste the Channel ID, which appears at the bottom of the popup window.

LANGUAGE

  • Specifies the language used for summarization.
  • Any value can be specified, such as "ja" or "Japanese" for Japanese, or "en" or "English" for English.

TIMEZONE

Install the bot in the channel

  • Search for "Summary" in the search window at the top of the screen and click "Summary [APP]".
  • Click "Summary" and click "Add this app to a channel" to specify the channel where you want to post the summary results.

Run

  • Open the "Settings" tab in the GitHub repository, then click "Actions"->"General" on the left side.
  • Select "Allow all actions and reusable workflows" in "Actions permissions" and save it.

With these settings, a summary of Slack's public channels will be posted every day at 5:00 a.m.

you would manually execute it by opening the "Actions" tab, clicking on "Summary" on the left, and clicking "Run workflow" on the right.

slack-summarizer's People

Contributors

akio0911 avatar mai-nakagawa avatar masuidrive avatar okabe-junya avatar yoonchulkoh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

slack-summarizer's Issues

bug: Running `pip install -r requirements.txt` failed

Bug Description

During the CI workflow or in a local environment, executing pip install -r requirements fails.

result: https://github.com/masuidrive/slack-summarizer/actions/runs/6659199301

Cause

This is because there's a bug when a library, which we depend on indirectly, supports Python 3.12.

How to Resolve

Fix the version of Python. Inside the CI workflow, the input to setup-python has python-version: "3.x" passed to it, which sets it to the latest stable version automatically. By explicitly setting it to 3.11.6, this issue can be resolved.

[Reference] Verification results in the fork:


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.