{"id":50751353,"url":"https://github.com/mashabow/slack-rota","last_synced_at":"2026-06-11T01:11:05.551Z","repository":{"id":40050603,"uuid":"284977114","full_name":"mashabow/slack-rota","owner":"mashabow","description":"日々のローテーションをお知らせする Slack アプリ","archived":false,"fork":false,"pushed_at":"2023-01-24T03:37:40.000Z","size":1608,"stargazers_count":17,"open_issues_count":18,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-03-02T16:42:03.705Z","etag":null,"topics":["firebase","slack","slack-bot"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/mashabow.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}},"created_at":"2020-08-04T12:45:59.000Z","updated_at":"2022-12-04T15:31:52.000Z","dependencies_parsed_at":"2023-02-13T15:45:27.587Z","dependency_job_id":null,"html_url":"https://github.com/mashabow/slack-rota","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/mashabow/slack-rota","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashabow%2Fslack-rota","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashabow%2Fslack-rota/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashabow%2Fslack-rota/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashabow%2Fslack-rota/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mashabow","download_url":"https://codeload.github.com/mashabow/slack-rota/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashabow%2Fslack-rota/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34177755,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["firebase","slack","slack-bot"],"created_at":"2026-06-11T01:11:03.649Z","updated_at":"2026-06-11T01:11:05.470Z","avatar_url":"https://github.com/mashabow.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rota\n\n日々のローテーションをお知らせする Slack アプリ\n\n\u003cimg src=\"assets/post-1.png\" alt=\"お知らせの例\" width=\"668\"\u003e\n\n## 使い方\n\n### ローテーションの作成\n\nローテーションをお知らせしたいチャンネルで、`/rota` コマンドを実行します。\n\n\u003cimg src=\"assets/command.png\" alt=\"/rota コマンドを実行する\" width=\"643\"\u003e\n\nすると、ローテーションを作成するためのモーダルが開きます。ローテーションを回すメンバーや、お知らせするメッセージ、曜日・時刻を入力しましょう。\n\n\u003cimg src=\"assets/modal-1.png\" alt=\"作成モーダル\" width=\"534\"\u003e\n\nお知らせ時にメンションする範囲を選ぶこともできます（スクロールで隠れていて少々わかりにくいですが…）。\n\n\u003cimg src=\"assets/modal-2.png\" alt=\"作成モーダル下部\" width=\"534\"\u003e\n\n[作成する] をクリックして完了です。「ローテーションを作成しました！」というメッセージが表示されます。\n\n\u003cimg src=\"assets/success.png\" alt=\"作成成功メッセージ\" width=\"668\"\u003e\n\n### Rota からのお知らせ\n\n指定した日時になると、Rota が今日の担当者をお知らせします。\n\n\u003cimg src=\"assets/post-1.png\" alt=\"お知らせ1回目\" width=\"668\"\u003e\n\n指定した日時がもう一度来ると、ローテーションがひとつ進み、次の担当者になります。以降も同様です。\n\n\u003cimg src=\"assets/post-2.png\" alt=\"お知らせ2回目\" width=\"668\"\u003e\n\n右端の […] メニューから、手動でローテーションを進めたり、戻したりもできます。ローテーションの編集も、ここからできます。\n\n\u003cimg src=\"assets/overflow.png\" alt=\"[…] メニュー\" width=\"212\"\u003e\n\n### 補足\n\n- メッセージ部分には [Slack の `mrkdwn` フォーマット](https://api.slack.com/reference/surfaces/formatting#basics)が使えます。作成モーダル上では整形表示されませんが、実際のお知らせではきちんと表示されます。\n- 権限上、Rota はパブリックチャンネルのみで動作します。プライベートチャンネルや DM では利用できません。\n\n## インストール\n\n### Firebase プロジェクトの作成\n\nまずは、アプリを動かすための Firebase プロジェクトを用意します。\n\n1. [Firebase コンソール](https://console.firebase.google.com/)から、新規プロジェクトを作成\n\n1. ⚙️ \u003e プロジェクトを設定 \u003e 全般 のページに移動し、デフォルトのリソースロケーションを `asia-northeast1`（東京）に設定\n\n1. ⚙️ \u003e 使用量と請求額 \u003e 詳細と設定 のページに移動し、料金プランを Spark（無料）から Blaze（従量制）に変更\n\n1. 開発 \u003e Database のページに移動し、Cloud Firestore データベースを作成\n\n1. [Firebase CLI](https://firebase.google.com/docs/cli) をインストール\n\n   ```console\n   $ npm install -g firebase-tools\n   ```\n\n1. 作成したプロジェクトを選択し、適当なエイリアス名を設定\n\n   ```console\n   $ firebase use --add\n   ```\n\n### Slack アプリの作成\n\n1. [Bolt 入門ガイド](https://slack.dev/bolt-js/ja-jp/tutorial/getting-started) の「[アプリを作成する](https://slack.dev/bolt-js/ja-jp/tutorial/getting-started#%E3%82%A2%E3%83%97%E3%83%AA%E3%82%92%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B)」を参考にして、Slack アプリを作成\n\n   1. [アプリ作成ページ](https://api.slack.com/apps?new_app=1) に移動\n   1. 適当なアプリ名と、インストール先のワークスペースを入力し、アプリを作成\n   1. Manage Distribution \u003e Share Your App with Other Workspaces を開き、Remove Hard Coded Information のチェックを入れたら [Activate Public Distribution] をクリック\n   1. Scopes \u003e Bot Token Scopes に `chat:write`, `chat:write.public`, `commands`, `users:read` を追加\n\n### Firebase へのデプロイ\n\nSlack アプリの Basic Information \u003e App Credentials の情報を Firebase に設定し、デプロイします。\n\n1. Slack アプリの Client ID, Client Secret, Signing Secret を、Firebase Functions の `slack.*` に設定\n\n   ```console\n   $ firebase functions:config:set \\\n     slack.client_id=\"012345678.1234567...\" \\\n     slack.client_secret=\"01234567890abcdef...\" \\\n     slack.signing_secret=\"01234567890abcdef...\"\n   ```\n\n1. Firebase Functions の `rota.*` に任意のランダム値を設定\n\n   ```console\n   $ firebase functions:config:set \\\n     rota.state_secret=\"state_secret\" \\\n     rota.encryption_secret=\"encryption_secret\"\n   ```\n\n1. Firebase にデプロイ 🚀\n\n   ```console\n   $ firebase deploy\n   ```\n\n### Slack アプリの追加設定\n\nSlack から Firebase Functions を呼び出せるようにします。\n\n1. 「[アクションの送信と応答](https://slack.dev/bolt-js/ja-jp/tutorial/getting-started#%E3%82%A2%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E9%80%81%E4%BF%A1%E3%81%A8%E5%BF%9C%E7%AD%94)」を参考にして Interactivity を有効化\n\n   1. Interactivity \u0026 Shortcuts の Interactivity を On に変更\n   1. Request URL に `https://asia-northeast1-\u003cFirebaseのプロジェクトID\u003e.cloudfunctions.net/slack/events` と入力\n   1. 設定を保存\n\n1. Slash Commands を設定\n\n   1. Slash Commands の [Create New Command] をクリック\n   1. Command に `/rota` と入力\n   1. Request URL に `https://asia-northeast1-\u003cFirebaseのプロジェクトID\u003e.cloudfunctions.net/slack/events` と入力\n   1. 設定を保存\n\n1. Redirect URLs を設定\n\n   1. OAuth \u0026 Permissions の Redirect URLs に `https://asia-northeast1-\u003cFirebaseのプロジェクトID\u003e.cloudfunctions.net/slack/oauth_redirect` と入力して、[Add] をクリック\n   1. [Save URLs] をクリックして設定を保存\n\n1. Event Subscriptions を有効化\n\n   1. Event Subscriptions の Enable Events を On に変更\n   1. Request URL に `https://asia-northeast1-\u003cFirebaseのプロジェクトID\u003e.cloudfunctions.net/slack/events` と入力\n   1. Subscribe to bot events に `user_change` を追加\n   1. 設定を保存\n\n### ワークスペースへのインストール\n\n`https://asia-northeast1-\u003cFirebaseのプロジェクトID\u003e.cloudfunctions.net/slack/install` にアクセスして、ワークスペースにインストールします。\n\n### 動作確認\n\n以上で完了です。適当なパブリックチャンネル上で `/rota` コマンドを実行し、Rota が動作するか確認してください。\n\n## 開発\n\n### ローカル環境で動かす\n\n[Firebase Emulator](https://firebase.google.com/docs/functions/local-emulator?hl=ja) で Functions と Firestore を起動します。\n\n```console\n$ cd functions/\n$ firebase functions:config:get \u003e .runtimeconfig.json\n$ npm run serve\n```\n\nhttp://localhost:4000 で、Functions のログや Firestore の状態を確認することができます。`slack` 関数のエンドポイントは、http://localhost:5001/your-project-id/asia-northeast1/slack になります。\n\nSlack からのイベントを受け取るためには、[ngrok](https://ngrok.com/) などを利用して、このエンドポイントを外部に公開する必要があります。別のターミナルで\n\n```console\n$ ngrok http 5001\n```\n\nを実行すると、https://12345abcde.ngrok.io のような URL で、http://localhost:5001 にアクセスできるようになります。Slack アプリの以下の設定に、ngrok の URL をそれぞれ指定しましょう。Firebase で動かす本番用 Slack アプリとは別に、開発用の Slack アプリを作成しておくと楽です。\n\n- Interactivity \u0026 Shortcuts \u003e Interactivity \u003e Request URL\n  - `https://12345abcde.ngrok.io/your-project-id/asia-northeast1/slack/events`\n- Slash Commands \u003e `/rota` \u003e Request URL\n  - `https://12345abcde.ngrok.io/your-project-id/asia-northeast1/slack/events`\n- OAuth \u0026 Permissions \u003e Redirect URLs\n  - `https://12345abcde.ngrok.io/your-project-id/asia-northeast1/slack/oauth_redirect`\n- Event Subscriptions \u003e Request URL\n  - `https://12345abcde.ngrok.io/your-project-id/asia-northeast1/slack/events`\n\n[Cloud Functions シェル](https://firebase.google.com/docs/functions/local-shell?hl=ja)を使うと、Firebase Emulator 上の `cron` 関数を手動で実行することができます。\n\n```console\n$ npm start\nfirebase \u003e cron()\n'Successfully invoked function.'\n```\n\n### テスト\n\n```console\n$ npm run test\n```\n\n#### firebase-functions-test によるオンラインテスト\n\n`functions/src/__tests__/online.test.ts` は[オンラインテスト](https://firebase.google.com/docs/functions/unit-testing?hl=ja#initializing)になっているため、Firebase 上にある実物の Firestore を使用します（一方、Functions はローカルで動作します）。以下の手順で、テスト用のプロジェクトを用意してください。\n\n1. テスト用の Firebase プロジェクトを作成する\n1. プロジェクトにウェブアプリを追加する\n1. ⚙️ \u003e プロジェクトを設定 \u003e サービス アカウント \u003e Firebase Admin SDK を表示し、[新しい秘密鍵の生成] をクリックする\n1. ダウンロードした秘密鍵ファイルをリネームし、ルートディレクトリの `serviceAccountKey.json` に配置する\n1. プロジェクト ID を `.env` ファイルの `TEST_PROJECT_ID` に設定する\n\n## License\n\nMIT\n\n## Author\n\nMasaya Nakamura (@mashabow)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmashabow%2Fslack-rota","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmashabow%2Fslack-rota","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmashabow%2Fslack-rota/lists"}