I'll show how your can get notified, on your phone and on your laptop when Claude Code needs your input to move on or when it finishes.
Below should be a quick and simple win already. A debounce strategy and a self-host option will eventually be added.
Simplest strategy [NTFY cloud and no debounce]
NTFY
- Sign-up at ntfy.sh
- Sign-in and access your dashboard
- Click
Subscribe to topic - Click
GENERATE NAME->SUBSCRIBEand take note of the topic - Click on your avatar at the top -> Click your username
- At
Access tokensclickCreate access tokenand choose a name (e.g. claude-code) - take note of your token
- Download NTFY app to your mobile and enable notifications
- Sign-in to your ntfy account in the app (make sure you are subscribed to topic created on 4.)
Claude Code
- Edit ~/.claude/settings.json (create if needed) to have it as below
{
"hooks": {
"PermissionRequest": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "curl -H 'Authorization: Bearer <token-ntfy-step-7>' -v -L -d 'Claude Code is requesting your input to move on' ntfy.sh/<topic-ntfy-step-4>"
}
]
}
],
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "curl -H 'Authorization: Bearer <token-ntfy-step-7>' -v -L -d 'Claude Code has finished working' ntfy.sh/<topic-ntfy-step-4>"
}
]
}
]
}
}
Start a new claude session and enjoy!
Adding de-bouncer
To avoid multiple notifications at the same time we can add a debouncer.
- Create the de-bouncer script at the path below
#!/usr/bin/env bash
set -euo pipefail
LOCKFILE="/tmp/claude-notify-last"
COOLDOWN=30 # seconds
if [ -f "$LOCKFILE" ]; then
LAST=$(cat "$LOCKFILE")
NOW=$(date +%s)
if [ $((NOW - LAST)) -lt $COOLDOWN ]; then
exit 0
fi
fi
date +%s > "$LOCKFILE"
MSG="${1:-}" # first argument
if [ -z "$MSG" ]; then
echo "Usage: $0 \"message\"" >&2
exit 2
fi
curl -H 'Authorization: Bearer <token>' -L \
--data-binary "$MSG" \
"https://ntfy.sh/<topic-ntfy-step-4>"
- Chmod the script
chmod +x .claude/scripts/ntfy-debouncer.sh - Update claude to use it
{
"hooks": {
"PermissionRequest": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "./scripts/ntfy-debouncer.sh 'Claude Code is requesting your input to move on'"
}
]
}
],
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "./scripts/ntfy-debouncer.sh 'Claude Code has finished working'"
}
]
}
]
}
}
Top comments (0)