Auto-notify Slack/Discord when using Claude Code on Mobile
Recently, mobile vibe coding with Claude Code has been trending. I also use my iPad or iPhone to remotely connect to my home PC for vibe coding.
However, when vibe coding on mobile, what I want to know is when the AI completes its work.
On PC, there are various options like system notifications, audio alerts, etc., but with mobile remote connection, it’s challenging.
So I want to send notifications to Discord/Slack when tasks are completed!
Setting up Webhooks
First, let’s prepare to receive notifications.
For Discord
- Open the Discord server where you want to send notifications
- Click “Server Settings” from the menu
- Go to “Integrations” → “Webhooks”
- Create a “New Webhook”
- Set a name (e.g., “Claude Code”) and select a channel
- “Copy Webhook URL”
For Slack
- In your Slack workspace, go to “Apps” → “Add Apps”
- Search for and add “Incoming Webhooks”
- Select the channel where you want to send notifications
- Click “Add Incoming Webhook Integration”
- Copy the Webhook URL
Creating the notification script
1. Create folder
Navigate to your working folder and create a folder to save the script (optional)
mkdir -p scripts/claude-code/
2. Create notification script
For Discord notifications
cat > scripts/claude-code/notify-completion-with-message.sh << 'EOF'
#!/bin/bash
MESSAGE="$1"
curl -H "Content-Type: application/json" -X POST -d "{\"content\":\"${MESSAGE}\"}" "https://discord.com/api/webhooks/YOUR_WEBHOOK_URL_HERE"
EOF
Replace YOUR_WEBHOOK_URL_HERE
with the Webhook URL you obtained.
For Slack notifications
cat > scripts/claude-code/notify-completion-slack.sh << 'EOF'
#!/bin/bash
MESSAGE="$1"
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"${MESSAGE}\"}" "https://hooks.slack.com/services/YOUR_SLACK_WEBHOOK_URL_HERE"
EOF
Discord and Slack basically work the same way, with just slight differences in the Webhook URL and JSON format. You can choose based on the tools your team uses.
Script-based “workaround”
Actually, this method doesn’t directly permit curl commands, but instead creates script files and permits those scripts. This way, approval prompts won’t appear during auto-accept.
Permission settings in Claude Code
This is the key point.
- After starting Claude Code, type
/allowed-tools
- Select “1. Add a new rule…”
- Enter the following:
Bash(scripts/claude-code/notify-completion-with-message.sh*)
Now this script can be executed without approval.
CLAUDE.md instruction settings
Create a CLAUDE.md
file in your project’s root directory and add the following instruction. This will make Claude Code automatically send notifications when tasks are completed.
# End-of-task instructions
- When completing a task, always execute the following:
`bash scripts/claude-code/notify-completion-with-message.sh "description of completed task"`
Just adding this one line will make Claude Code automatically send notifications to Discord every time it finishes work.
Testing it out
Give some work instructions and enable auto-accept. After the work is completed, notifications will be sent to Discord.
It was a surprisingly simple solution, but these small improvements accumulate to make daily work much more comfortable.
Discussion