When the AI assistant finishes a round of tasks, Deep Code can automatically execute a notification script to send task results to your chosen channel (Slack, system notifications, etc.).
Configure the notify field in settings.json with the full path to an executable script. Every time the AI assistant completes a task response, Deep Code executes that script and injects context as environment variables.
| Variable | Description |
|---|---|
DURATION |
Session duration in seconds (integer) |
STATUS |
Session status: "completed" or "failed" |
FAIL_REASON |
Failure reason (only set on failure) |
BODY |
The text content of the last AI assistant reply |
TITLE |
Session title (matches the resume list title) |
Edit ~/.deepcode/settings.json and add the notify field:
{
"env": {
"MODEL": "deepseek-v4-pro",
"BASE_URL": "https://api.deepseek.com",
"API_KEY": "sk-..."
},
"thinkingEnabled": true,
"reasoningEffort": "max",
"notify": "/path/to/your-notify-script.sh"
}You can also configure custom environment variables for the notify script in env, such as a Slack Webhook URL:
{
"env": {
"MODEL": "deepseek-v4-pro",
"BASE_URL": "https://api.deepseek.com",
"API_KEY": "sk-...",
"SLACK_WEBHOOK_URL": "https://hooks.slack.com/services/*****/****/**********"
},
"notify": "/Users/you/.deepcode/notify-slack.sh"
}These env variables are injected into the script's execution environment.
- Create a Slack App
- In the App page, go to Incoming Webhooks → Add New Webhook to Workspace to generate a Webhook URL
Create ~/.deepcode/notify-slack.sh:
#!/usr/bin/env bash
SLACK_WEBHOOK_URL="${SLACK_WEBHOOK_URL:-}"
CURRENT_DIR=$(pwd)
BRANCH=$(git branch --show-current 2>/dev/null)
curl -X POST "$SLACK_WEBHOOK_URL" \
-H "Content-type: application/json" \
--data "{
\"text\": \"✅ Deep Code task completed\n · cwd: $CURRENT_DIR\n · Branch: $BRANCH\n · Duration: $DURATION s\"
}"Make the script executable:
chmod +x ~/.deepcode/notify-slack.sh{
"env": {
"SLACK_WEBHOOK_URL": "https://hooks.slack.com/services/*****/****/**********"
},
"notify": "/Users/you/.deepcode/notify-slack.sh"
}A Python version is also supported; you can pass and reference any custom environment variables via
env.
Use node to build JSON (auto-escapes special characters) and curl to send. Pass WEBHOOK_URL via env:
#!/bin/bash
WEBHOOK_URL="${WEBHOOK_URL:-}"
STATUS="${STATUS:-completed}"
TITLE="${TITLE:-Untitled}"
DURATION="${DURATION:-0}"
BODY="${BODY:-(no output)}"
PAYLOAD=$(node -e "
process.stdout.write(JSON.stringify({
msg_type: 'interactive',
card: {
header: { title: { tag: 'plain_text', content: 'DeepCode: ' + process.env.TITLE + ' ' + process.env.STATUS + ' [' + process.env.DURATION + 's]' } },
elements: [{ tag: 'markdown', content: (process.env.BODY || '').slice(0, 2000) || '(no output)' }]
}
}))
")
curl -s -X POST "$WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"{
"env": {
"WEBHOOK_URL": "https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxxx"
},
"notify": "/Users/you/.deepcode/notify-feishu.sh"
}Replace WEBHOOK_URL with your Feishu bot webhook URL. This pattern also works for other webhook-based notifications (Slack, WeCom, etc.) — just adjust the JSON payload format.
On iTerm2 or Windows Terminal, you can use the OSC 9 escape sequence for native terminal notifications with zero dependencies.
Create ~/.deepcode/notify.sh:
#!/bin/bash
# iTerm2 / Windows Terminal OSC 9 notification
printf '\x1b]9;DeepCode: task %s (%ss)\x07' "${STATUS:-completed}" "${DURATION}"{
"notify": "/Users/you/.deepcode/notify.sh"
}Windows users on Git Bash can use the same script; alternatively, create a .bat script:
@echo off
REM Windows Terminal OSC 9 notification
echo \x1b]9;DeepCode: task %STATUS% (%DURATION%s)\x07#!/bin/bash
# macOS system notification
osascript -e "display notification \"Task ${STATUS:-completed}, took ${DURATION}s\" with title \"DeepCode\""{
"notify": "/Users/you/.deepcode/notify.sh"
}Requires libnotify-bin:
sudo apt install libnotify-bin # Debian/UbuntuCreate ~/.deepcode/notify.sh:
#!/bin/bash
# Linux notify-send notification
notify-send "DeepCode" "Task ${STATUS:-completed}, took ${DURATION}s"{
"notify": "/home/you/.deepcode/notify.sh"
}@echo off
REM Windows msg popup notification
msg %USERNAME% "DeepCode: task %STATUS% (%DURATION%s)"{
"notify": "C:\\Users\\you\\.deepcode\\notify.bat"
}You can write your own notification scripts in any language (Python, Node.js, Ruby, etc.) using the injected environment variables and any additional variables passed via env.