Get a text when Claude Code finishes

Start a long Claude Code task, walk away, and get a text when it's done or when it's waiting for you — a permission prompt, a question, a finished run. Texts go only to your own verified phone; there's no way to send to anyone else.

1. Get your UserAlertX API key

It's on your account screen. No account yet? Start a free trial (50 alerts or 30 days) — then add your mobile number on the account screen.

Put the key in your shell profile (~/.bashrc, ~/.zshrc), not in a project file, so it never ends up in a repo:

export UX_KEY="YOUR_API_KEY"

Open a new terminal (or source the file) before starting Claude Code, so it sees the key.

2. Text me when Claude Code is waiting for me (recommended)

Claude Code has hooks: commands it runs on certain events. The Notification event fires when Claude Code is waiting for you — idle for your next instruction (idle_prompt) or asking permission (permission_prompt). Add this to ~/.claude/settings.json (your user settings, all projects; merge it into an existing "hooks" section if you have one):

{
  "hooks": {
    "Notification": [
      {
        "matcher": "idle_prompt",
        "hooks": [
          { "type": "command",
            "command": "curl -s -X POST https://useralertx.com/cgi-bin/itmessages.cgi -H \"X-Api-Key: $UX_KEY\" --data-urlencode \"body=Claude Code is waiting for you\" >/dev/null" }
        ]
      },
      {
        "matcher": "permission_prompt",
        "hooks": [
          { "type": "command",
            "command": "curl -s -X POST https://useralertx.com/cgi-bin/itmessages.cgi -H \"X-Api-Key: $UX_KEY\" --data-urlencode \"body=Claude Code needs your permission\" >/dev/null" }
        ]
      }
    ]
  }
}

Why not the Stop hook? Stop fires at the end of every reply, so in a normal back-and-forth it would text you constantly and run into the per-hour limit below. Notification only fires when Claude Code actually needs you.

3. Or: let Claude Code text you itself (with a summary)

Add the UserAlertX connector so Claude Code can send an alert as a tool, with its own words:

claude mcp add --transport http useralertx https://useralertx.com/mcp --header "Authorization: Bearer $UX_KEY"

Then ask, in a prompt or in your project's CLAUDE.md:

When you finish a long task, text me a one-line summary via UserAlertX.
Before deleting files or deploying, ask my approval via UserAlertX first.

The connector has send_sms_to_me plus request_approval / confirm_approval: Claude Code texts you a 6-digit code and goes ahead only after you give it back.

No connector? Claude Code can run the same one-line curl as above — just tell it to.

4. Send a test

In a terminal:

curl -X POST https://useralertx.com/cgi-bin/itmessages.cgi \
  -H "X-Api-Key: $UX_KEY" --data-urlencode "body=Hello from Claude Code"

The first text may be held until you reply START to the one-time text UserAlertX sends you — after that, alerts go straight through.

Good to know

  • Cost: each alert is a normal UserAlertX alert — 1 token by text, 0.1 token by email. Free trial, then $5/month including 50 tokens a month.
  • Limits: 10 alerts an hour and 50 a day per account, at least 3 seconds apart.
  • Only to you: there is no recipient field. A prompt, a hook or a misbehaving agent can't text anyone but the phone you verified.
  • Pause: reply P to any alert text to pause alerts (they're held, not lost); START sends them.
  • On/off per session: the “alertme on” example adds a small script so you can type alertme on / off in a session.
  • More: the API, the Grok Bot connector, examples.

More examples · ← Home