$ recombobulate _
home / tips / use-http-hooks-to-send-webhooks-on-tool-execution
0

Use HTTP Hooks to Send Webhooks on Tool Execution

bagwaa @bagwaa · Mar 26, 2026 · Configuration
use-http-hooks-to-send-webhooks-on-tool-execution

HTTP hooks send POST requests to a URL whenever a hook event fires, letting you integrate Claude Code with external services like Slack, PagerDuty, or a custom audit dashboard without writing shell scripts.

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "http",
            "url": "http://localhost:8080/hooks/tool-executed",
            "timeout": 30,
            "headers": {
              "Authorization": "Bearer $WEBHOOK_TOKEN",
              "Content-Type": "application/json"
            },
            "allowedEnvVars": ["WEBHOOK_TOKEN"]
          }
        ]
      }
    ]
  }
}

The hook sends the full event payload as the POST body, including session ID, tool name, arguments, and output. Your endpoint can log it, send a Slack notification, or enforce custom policies.

Headers support environment variable interpolation with the $VAR_NAME syntax, but you must explicitly list allowed variables in allowedEnvVars for security. This prevents accidental leakage of sensitive environment variables.

HTTP hooks can also return decisions. A 2xx response with JSON containing "decision": "block" will block the action, just like a command hook returning exit code 2:

{
  "decision": "block",
  "reason": "This operation requires manager approval"
}

A 2xx response with plain text adds that text as context to Claude. Non-2xx responses and timeouts are treated as non-blocking errors, so your webhook endpoint going down will not break Claude's workflow.

Connect Claude Code to any HTTP service with zero scripting.


via Claude Code Hooks

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Switch to the Stable Update Channel with autoUpdatesChannel

The autoUpdatesChannel setting pins Claude Code to a stable release track that skips versions with major regressions.

bagwaa @bagwaa · 1 hour ago
0
Set Claude's Response Language with the language Setting

The language setting makes Claude respond in your preferred language by default, across every session and project.

bagwaa @bagwaa · 1 hour ago
0
Customize or Remove Claude's Git Attribution with the attribution Setting

The attribution setting lets you customize or completely remove Claude's Co-Authored-By trailer from git commits and pull requests.

bagwaa @bagwaa · 1 hour ago