Last active
July 18, 2025 03:30
-
-
Save jeremynsl/b7928e126d1bb5c4a51164f75ac643dc to your computer and use it in GitHub Desktop.
Claude Code Pushover Notifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOG_FILE="/tmp/claude_notification_input.log" | |
STDIN_DATA=$(cat) | |
echo "--- Start of Notification ---" >> "$LOG_FILE" | |
echo "$STDIN_DATA" >> "$LOG_FILE" | |
echo "--- End of Notification ---" >> "$LOG_FILE" | |
NOTIFICATION_MESSAGE=$(echo "$STDIN_DATA" | jq -r '.message') | |
# you can add ntfy, sendgrid emails or whatever type of notifications you like by changing the endpoint. This is pushover as an example. | |
if [[ -z "$NOTIFICATION_MESSAGE" || "$NOTIFICATION_MESSAGE" == "null" ]]; then | |
curl -s \ | |
-F "token=yourtoken" \ | |
-F "user=youruser" \ | |
-F "message=Claude has stopped and requires input" \ | |
https://api.pushover.net/1/messages.json | |
else | |
# Now, execute the curl command with the extracted message | |
curl -s \ | |
-F "token=yourtoken" \ | |
-F "user=youruser" \ | |
-F "message=Claude: $NOTIFICATION_MESSAGE" \ | |
https://api.pushover.net/1/messages.json\ | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"hooks": { | |
"Notification": [ | |
{ | |
"hooks": [ | |
{ | |
"type": "command", | |
"command": "/home/yourname/.claude/send_notification.sh" | |
} | |
] | |
} | |
] | |
, | |
"Stop": [ | |
{ | |
"hooks": [ | |
{ | |
"type": "command", | |
"command": "/home/yourname/.claude/send_notification.sh" | |
} | |
] | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment