claude
コマンドを起動し、/hooks
を入力し、hooksの設定画面を開く- 以下のような設定を Notification, Stop の両方に設定する
cat | jq -r --arg host "$(hostname)" ' { channel : "claude-code", username : "Claude Code", icon_emoji : ":claude:", text : ( "Notification from Claude:\n" + "> *session_id*: " + .session_id + "\n" + "> *hostname*: " + $host + "\n" + "> *title*: " + .title + "\n" + "> *message*: " + .message ) }' \ | curl -X POST -H 'Content-Type: application/json' --data @- "$(cat ~/.claude/slack_webhook.txt)" # Stop ... invoked when claude code stops its action curl \ -X POST \ -H 'Content-Type: application/json' \ --data "{\"text\":\"Stopped on $(hostname)\", \"channel\": \"claude-code\", \"username\": \"Cluade Code\", \"icon_emoji\": \":claude:\"}" \ "$(cat ~/.claude/slack_webhook.txt)"
- Slackに incoming webhook のappを追加し、設定画面からwebhookのURLを取得する
- webhook URLのみを記載したファイルを
~/.claude/slack_webhook.txt
に作成する
Last active
July 4, 2025 07:52
-
-
Save so298/f19e65be27d5f493f91868e822e189be to your computer and use it in GitHub Desktop.
Claude Codeのhooks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment