Contents
Claude Code integration

Claude Code push notifications

Claude Code can ping your phone through PushPiper when it needs permission or finishes a task, free for 10,000 messages a month on 10 devices. Pushes reach iPhones on iOS 16.4 or later without an app store purchase, and one HTTP request carries up to 1,024 characters.

Create the notification script

Claude Code executes external scripts through hooks and delivers session data as JSON straight to standard input. You can read this payload with a tiny shell wrapper and forward the alert directly to the PushPiper API.

The script relies on two command-line tools: curl to make the HTTPS POST call and jq to extract values from Claude Code's JSON input.

  1. Create the hook directory with mkdir -p ~/.claude/hooks.
  2. Save the script below as ~/.claude/hooks/pushpiper.sh.
  3. Make it executable with chmod +x ~/.claude/hooks/pushpiper.sh.
~/.claude/hooks/pushpiper.sh
#!/usr/bin/env bash
input=$(cat)
event=$(jq -r '.hook_event_name' <<<"$input")
project=$(basename "$(jq -r '.cwd' <<<"$input")")

if [ "$event" = "Notification" ]; then
  title="Claude Code needs you ($project)"
  message=$(jq -r '.message // "Waiting for input"' <<<"$input")
  priority=1
else
  title="Claude Code finished ($project)"
  message=$(jq -r '(.last_assistant_message // "Done")[0:1000]' <<<"$input")
  priority=0
fi

curl -s -o /dev/null https://api.pushpiper.com/1/messages.json \
  --form-string "token=APP_TOKEN" \
  --form-string "user=USER_KEY" \
  --form-string "title=$title" \
  --form-string "message=$message" \
  --form-string "priority=$priority"

In the script above, replace APP_TOKEN with your 30-character application token (starts with a) and USER_KEY with your 30-character user key (starts with u). You can grab both values right away when you open PushPiper and sign up free. If you are already running scripts elsewhere, you might also like our guide for shell scripts and cron jobs.

The script cuts off the assistant's final text at 1,000 characters using jq. PushPiper returns an HTTP 400 error if any message exceeds 1,024 characters, so trimming the input avoids dropped notifications when Claude writes long terminal summaries.

Register hooks in your Claude Code settings

Claude Code reads hook definitions from JSON configuration files. You can configure hooks globally across all your projects or scope them strictly to the current workspace.

  • Global: ~/.claude/settings.json applies to every session across all your directories.
  • Project-level: .claude/settings.json lives inside a repository and can be committed to source control for your team.
  • Local overrides: .claude/settings.local.json keeps your settings specific to one checkout without touching Git.

Add the Notification and Stop hooks to your settings file:

~/.claude/settings.json
{
  "hooks": {
    "Notification": [
      {
        "matcher": "permission_prompt|idle_prompt",
        "hooks": [{ "type": "command", "command": "~/.claude/hooks/pushpiper.sh" }]
      }
    ],
    "Stop": [
      {
        "hooks": [{ "type": "command", "command": "~/.claude/hooks/pushpiper.sh" }]
      }
    ]
  }
}

The Notification block uses a regular expression matcher for permission_prompt|idle_prompt, firing when Claude stops for tool approval or waits for you. The Stop event triggers automatically whenever Claude finishes a response turn and does not use a matcher.

Choose the right events and noise level

Different hook events serve distinct purposes, balancing immediate alerts against message volume throughout your workday.

Here is how the hooks compare across triggers and delivery urgency:

HookFires whenPriority in the script
Notification, permission_promptClaude needs approval to use a tool1
Notification, idle_promptClaude finished and you have not answered for 60 seconds or more1
StopClaude finishes any response0

The script assigns priority levels based on urgency as defined in the API reference:

  • Priority 1 (High): Used for permission prompts and idle warnings. It triggers with sound and bypasses PushPiper's internal quiet hours setting.
  • Priority 0 (Normal): Used when Claude finishes a run. It plays a standard sound and respects any quiet hours you configured inside the app.

If Claude Code runs frequently, getting a notification for every single response can clutter your screen. You can eliminate the chatter by keeping only idle_prompt. This setup ignores regular turn completions while you are actively working in the terminal and only sends an alert after you have walked away from your machine for 60 seconds or more. To do this, remove the Stop block from your settings file and change the Notification matcher to "matcher": "idle_prompt".

To isolate your coding alerts from other tools, give Claude Code its own PushPiper app and application token. Having a separate app lets you mute alerts or rotate credentials without breaking any other setups you configured through all integrations.

Sources

Questions and answers

Does PushPiper wake up an iPhone on Do Not Disturb?

No. PushPiper notifications cannot bypass iOS Focus modes or Do Not Disturb, even when sent at high or emergency priorities.

What happens if a command output produces a very long message?

The script truncates the final reply to the first 1,000 characters before calling curl. This keeps the payload under the 1,024-character API limit and prevents HTTP 400 rejection errors.

Can I run this hook setup on Cursor or Codex CLI instead?

Cursor supports stop hooks but does not support Claude Code's Notification event. For OpenAI's tool, you can see our guide for Codex CLI push notifications.

Why do I need both jq and curl installed?

Claude Code passes hook information as raw JSON via standard input. The script uses jq to parse the event name, working directory, and message text, and curl to send the data to the API.

Where can I find my user key and application token?

Open PushPiper and sign in with Google to get your 30-character user key and create an application token.