目次
1. 現状確認 (notifier.py)
- 各 client が
slack_destinations: []で複数宛先 (incoming webhook URL) を持つ min_score(per-destination 閾値) /simple_mode(詳細 vs シンプル) /group_routing(group_id 別 ルーティング) は実装済- 旧形式 (
slack_webhook_url単体) との後方互換あり - Discord webhook も executive 通知用に並列対応
- all incoming webhook 方式 — 1-way / channel 固定 / 動的投稿不可
これは pilot 段階 (buggy / itou_dept / luv / lis / pr の 5 client) では十分だが、 事務所が増えるたびに env keys を 6 個ずつ手動追加する運用は scalable でない。
2. 商用化で直面する 5 つの課題
| # | 課題 | 現状の限界 |
|---|---|---|
| 1 | テナント増加時の webhook 管理 | 事務所 1 個追加するごとに LINE_<NAME>_CHANNEL_SECRET / TOKEN / SLACK_<NAME>_WEBHOOK を手作業で 6 env 設定、 LaunchAgent plist 追加、 Tailscale Funnel port 1 つ消費 |
| 2 | Slack workspace の所有者 | 現状は自社 1 ワークスペース内で channel 分離。 クライアント (他事務所) が自分の Slack で受け取りたい場合 webhook を貰って差し込む運用は scalable でない |
| 3 | 通知粒度のカスタマイズ | tenant ごとに 「P0×immediate = realtime、 P3×no_deadline = 週次サマリー」 を per-tenant に設定したいが、 config.yaml hardcode |
| 4 | 双方向化 | Slack 通知だけで終わり、 承認 (approve / reject / snooze) は Talent Hub UI を開く必要あり → manager の朝ルーチンが分断 |
| 5 | escalation / SLA | P0 task 24h 未対応の自動再通知 / executive escalation がない |
3. Phase 1 — webhook 維持 + priority/urgency 対応 + escalation 2026-05-15 完了予定
目的: 商用化前に通知 payload と routing rule を確定、 priority / urgency に対応。
3.1 通知 payload を priority/urgency 対応
🚨 P0 × 今日中 高橋 さくら (PR)
プレスリリース文面チェック (本日 17 時)
▸ 根拠: 第三者からの締切提示 / 公開後の取り消し不可
▸ thread: line_t-pr-202 conf: 0.93
[ Talent Hub で見る → ]
3.2 通知 rule を config.yaml で per-(priority, urgency)
notification_rules:
P0_immediate: { route: realtime, channels: ["#talent-urgent"] }
P1_immediate: { route: realtime, channels: ["#talent-urgent"] }
P0_this_week: { route: morning_digest, channels: ["#talent-daily"] }
P1_*: { route: morning_digest, channels: ["#talent-daily"] }
P2_*: { route: daily_summary, channels: ["#talent-daily"] }
P3_*: { route: weekly_summary, channels: ["#talent-weekly"] }
3.3 escalation worker (Cloudflare Worker cron、 1h 周期)
- P0×immediate で
status=pendingかつ 24h 経過 → 再通知 + Slack DM (manager + executive) - Discord webhook で executive にも escalation 配信
- 2 回目 escalation も無視 → 48h 経過で SLA 違反 alert、 監視 dashboard に記録
priority/urgency 通知 + escalation worker + per-(priority, urgency) channel routing rule が pilot 5 client (buggy/itou_dept/luv/lis/pr) 全てで動作。
4. Phase 2 — Slack App OAuth2 install flow 2026-07 〜 8 月
目的: クライアントが own Slack workspace に 「インストール」 ボタンで連携、 operator が webhook を個別配るのを廃止。
4.1 Slack App 設計
- Slack App を 1 個作成 (公開不要、 distribution: any workspace)
- scopes:
chat:write/chat:write.public/channels:read/groups:read/chat:write.customize - Talent Hub 設定 page (executive only) に 「Slack ワークスペースに追加」 ボタンを置く
- クライアントがクリック → Slack OAuth2 → callback で
bot_token取得 → Supabase に保存
4.2 新 schema: talent_mgmt.tenant_slack_integrations
CREATE TABLE talent_mgmt.tenant_slack_integrations (
tenant_id text PRIMARY KEY,
team_id text NOT NULL,
team_name text,
bot_token text NOT NULL, -- 暗号化 (pgcrypto)
bot_user_id text,
installed_by uuid REFERENCES talent_mgmt.handlers(id),
installed_at timestamptz NOT NULL DEFAULT now(),
scopes text[],
channels jsonb DEFAULT '[]'::jsonb, -- [{id, name, purpose}] cache
default_channel_id text,
notification_rules jsonb DEFAULT '{}'::jsonb, -- per priority×urgency
active boolean NOT NULL DEFAULT true,
updated_at timestamptz NOT NULL DEFAULT now()
);
4.3 LINE-MEMORY notifier.py 変更
SlackBotNotifierclass を新規追加 (chat.postMessage API)slack_destinations[].bot_token_envがあれば bot 経由、 なければ webhook fallback- bot 経由なら channel を動的指定可能 (priority/urgency 別 channel が config UI で切替可能)
4.4 channel selector UI (Talent Hub)
- bot がインストール後
conversations.listで channel 取得 → executive が select - per-priority × urgency 別 channel 選択 (緊急タレント用 #urgent / 日常用 #daily 等)
- tenant_slack_integrations.notification_rules JSON を UI で編集
既存 5 client (buggy/itou_dept/luv/lis/pr) を OAuth2 移行、 operator は新 client onboarding 時に Slack token を手作業で扱わない。
5. Phase 3 — Interactive 双方向 + Slash + App Home 2026-09 月以降
目的: Slack 内で task 承認 / reject / snooze を完結、 manager の朝ルーチンを Slack 1 画面で。
5.1 Slack Interactive Components (block_actions)
- task candidate alert に
[approve] [reject] [snooze 24h]ボタン - ボタン押下 → Slack → Cloudflare Worker (slack-callback) → talent-mgmt webhook →
task_candidates.status更新 - 承認時に
approved_task_idをinternal_tasksに転記
5.2 Slash Commands
/task-list: 自分担当の P0/P1 pending 5 件をエフェメラル表示/talent <id>: talent quick view (狙い + 最新案件 + 直近 LINE 3 件)/snooze <task-id> <時間>: task を一時停止
5.3 Modal
- reject 時に reason 入力 modal を pop up (rationale 強化)
- approve 時に担当者 assign modal (handlers.access_level で executive のみ assign 可能)
5.4 App Home tab
- 自分担当 talent の今日タスク matrix (priority × urgency 4×4) を tab 化
- 毎朝 9:00 に matrix が更新、 talents.html を開かずに概観できる
manager の朝ルーチン (P0/P1 確認 → approve / snooze / reject) が Slack 内で完結、 平均所要時間が Talent Hub UI 経由比で 50% 短縮。
6. 商用化ロードマップ
| 時期 | Phase | 達成内容 |
|---|---|---|
| 2026-05-15 (pilot 開始) | Phase 1 | priority/urgency 通知 + escalation worker |
| 2026-06 月内 | Phase 2 着手 | Slack App 作成 + tenant_slack_integrations migration |
| 2026-07 〜 8 月 | Phase 2 完了 | 既存 5 client を OAuth2 移行 |
| 2026-09 月以降 | Phase 3 | Interactive + Slash + App Home tab |
7. 実装容易性 / 価値マトリクス
実装易 ───────────→ 実装困難
価値高 │ priority/urgency 通知 │ Slack OAuth install │
│ escalation worker │ Interactive approve btn │
│ morning digest │ App Home tab │
価値中 │ per-tenant channel │ Slash commands │
│ ───────────────────── │ ──────────────────────── │
価値低 │ シンプル simple_mode │ DM 個別通知細分化 │
→ Phase 1 (priority 通知 + escalation) を最優先、 これは pilot 開始 5/15 までに完了可能。