Get a text when your agent finishes
You start a long run and walk away. SelfPing texts your own phone when it is done, or when it needs you. Two ways to wire it up: let the agent decide what is worth telling you, or fire on every run automatically.
1. Let the agent text you
Give your agent the SelfPing tool and it writes you a real message: what happened, the numbers that matter, and whether anything needs you. This is the one that produces texts worth reading.
Claude Code
claude mcp add --transport http selfping https://www.selfping.com/api/mcp \
--header "Authorization: Bearer sp_your_api_key"Cursor, Zed, or anything else that speaks MCP
{
"mcpServers": {
"selfping": {
"type": "http",
"url": "https://www.selfping.com/api/mcp",
"headers": {
"Authorization": "Bearer sp_your_api_key"
}
}
}
}2. Tell it when to reach for the tool
This part matters more than it looks. Connecting the server gives your agent the ability to text you. It does not give it the habit. Without this, most agents simply never think to use it.
Paste into your CLAUDE.md, or the equivalent rules file for your agent.
## Notifications
Text me via SelfPing (`send_ping`) when:
- a run takes more than a couple of minutes and I am not watching
- anything fails or needs a decision from me
- I explicitly ask to be told when something finishes
Do not text me for a routine pass with no surprises, or while I am clearly
sitting here reading your output.
Keep it under 160 characters so it stays one message. Lead with the outcome,
include the numbers, and say plainly whether anything needs me.3. Or fire on every run, automatically
A completion hook texts you every time your agent stops, whether it thought to or not. Blunter than the tool above, and it never forgets.
Claude Code, in .claude/settings.json
{
"hooks": {
"Notification": [
{
"matcher": "*",
"hooks": [
{
"type": "http",
"url": "https://www.selfping.com/api/hooks/claude-code",
"headers": {
"Authorization": "Bearer ${SELFPING_API_KEY}"
},
"allowedEnvVars": ["SELFPING_API_KEY"]
}
]
}
]
}
}Export your key before you start the agent. Run export SELFPING_API_KEY=sp_your_api_key first. The hook reads it from the environment the agent was launched with, so setting it afterwards does nothing.
Restart your agent after pasting this. Hook config is read once at startup. Paste it into a running session and nothing happens, with no error to tell you why.
If you put the key in .claude/settings.local.json, gitignore that file. It is not ignored by default.
Cursor and Codex
Neither can call a URL from config, so they run a one-line curl instead. No script to install: SelfPing reads the payload they already send.
curl -sS -X POST https://www.selfping.com/api/hooks/cursor \
-H "Authorization: Bearer $SELFPING_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @-Swap cursor for codex in the URL for Codex. Run it by hand once with -v before you paste it into config, because Codex discards both stdout and stderr from hooks, so a broken command there fails completely silently.
Cursor sends no message with its events, only that a run ended, so its texts read simply Finished. Add ?label=my-project to the URL if you run several projects and want to tell them apart.
What the texts look like
The first two are written by the agent. The third is a hook firing on its own, with nothing but a status to go on.
Nightly sync done: 412 records in, 8 failed on timeouts and need a retry. Everything else is clean.
Prod migration finished clean. 1.2M rows, 0 errors, 6m41s. Nothing needs you.
Finished.
Limits
Every text costs one credit. Free accounts get 10 a month, refilling on the 1st, which is enough to try this properly for a week. Paid plans start at $3. See pricing.
A key can only text the phone number that created it. There is no recipient field, so a leaked key cannot be used to message anyone else.