Claude Task Notify
简体中文 | English
A Claude Code plugin for DingTalk notifications with remote interaction support. Get notified when Claude Code needs your attention and reply remotely via web interface.
Features
- DingTalk Notifications: Get notified when Claude Code asks questions or completes tasks
- Remote Interaction: Reply to Claude Code questions from your phone via web interface
- Secure: Uses DingTalk's signature verification
- Auto-injection: Automatically injects your replies into Claude Code via tmux
- Plugin Architecture: Easy installation as a Claude Code plugin
Architecture
+------------------+ +-------------------+ +------------------+
| Claude Code |---->| Hook Scripts |---->| DingTalk |
| (in tmux) | | | | Robot |
+------------------+ +-------------------+ +------------------+
^ |
| v
| +-------------------+ +------------------+
| | Poll Script |<----| Worker API |
| | (background) | | (optional) |
| +-------------------+ +------------------+
| | ^
+------------------------+ |
(tmux inject) +------------------+
| Web Browser |
| (user reply) |
+------------------+
Prerequisites
- Claude Code CLI
- tmux
- jq
- curl
- DingTalk Robot with signature verification enabled
Installation
Option 1: Plugin Mode (Recommended)
git clone https://github.com/wuliang142857/claude-task-notify.git
cd claude-task-notify
./install.sh
# Select option 1 for plugin mode
This installs the plugin to ~/.claude/plugins/local/notify/.
Option 2: Legacy Mode
./install.sh
# Select option 2 for legacy mode
This copies scripts to ~/.claude/scripts/.
Configuration
1. Configure DingTalk Credentials
Add to ~/.claude/settings.json:
{
"env": {
"DINGTALK_WEBHOOK_URL": "https://oapi.dingtalk.com/robot/send?access_token=YOUR_TOKEN",
"DINGTALK_SECRET": "SECxxxxxxxx"
}
}
Or use the interactive setup command:
/notify:setup
2. Configure Hooks
For plugin mode, add to ~/.claude/settings.json:
{
"hooks": {
"UserPromptSubmit": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "~/.claude/plugins/local/notify/scripts/kill-poll-processes.sh",
"timeout": 5
}
]
}
],
"PreToolUse": [
{
"matcher": "AskUserQuestion",
"hooks": [
{
"type": "command",
"command": "~/.claude/plugins/local/notify/scripts/handle-ask-user.sh",
"timeout": 30
}
]
}
],
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "~/.claude/plugins/local/notify/scripts/handle-stop.sh"
}
]
}
]
}
}
3. Test Configuration
/notify:test
Plugin Commands
| Command | Description |
|---|
/notify:status | Check notification service status |
/notify:test | Send a test notification to DingTalk |
/notify:setup | Interactive setup guide |
Optional: Remote Interaction
For full remote interaction support (reply via web interface), deploy the Worker API.
Deploy Worker
See worker/README.md for deployment instructions.
Configure Worker URL
Add to ~/.claude/settings.json:
{
"env": {
"CLAUDE_WORKER_URL": "https://your-worker-url.workers.dev"
}
}
Default: https://claude-interactive-message.wuliang142857.me
How It Works
AskUserQuestion Hook
When Claude Code uses the AskUserQuestion tool:
handle-ask-user.sh is triggered
- Sends notification to DingTalk with question details
- If Worker is configured, creates a session for remote reply
- Starts background polling process
- When user replies via web, poll script injects the answer into tmux
Stop Hook
When Claude Code stops (task complete or needs input):
handle-stop.sh is triggered
- Extracts Claude's last output from transcript
- Sends notification to DingTalk
- If Worker is configured, allows user to send next instruction remotely
UserPromptSubmit Hook
When user types directly in Claude Code:
kill-poll-processes.sh is triggered
- Kills any running poll processes (no longer needed)
Scripts