Send a text to yourself from Cloudflare Workers
Yes. Homing Pigeon (homingpigeon.dev) lets a Cloudflare Worker text your phone with one fetch call, like when a job on a Cron Trigger fails. Your key is stored as a Worker secret, there is nothing to install, and your coding agent can add it to the Worker you already have.
What to tell your agent
Use Homing Pigeon to text me when the scheduled job in this Cloudflare Worker fails.
Your agent asks for your number, you read back the six-digit code, and it does the rest.
How it works in code
Workers have fetch built in, so there is nothing to install. Put this in your Worker's src/index.js, and replace runJob with your own code:
async function textMe(env, message, idempotencyKey) {
try {
const res = await fetch("https://homingpigeon.dev/v1/send", {
method: "POST",
headers: {
Authorization: `Bearer ${env.HOMINGPIGEON_API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ message, idempotency_key: idempotencyKey })
});
if (!res.ok) console.warn("Text alert failed:", (await res.json()).error.message);
} catch (err) {
console.warn("Text alert failed:", err.message);
}
}
export default {
async scheduled(controller, env, ctx) {
try {
await runJob(env);
} catch (err) {
await textMe(env, `Daily job failed: ${String(err.message).slice(0, 200)}`, `job-${controller.scheduledTime}`);
throw err;
}
}
};
Then add a Cron Trigger to wrangler.toml. This one runs the Worker every day at 13:00 UTC:
name = "daily-job"
main = "src/index.js"
compatibility_date = "2025-11-01"
[triggers]
crons = ["0 13 * * *"]
Good to know
- Verify your phone with
npx -y homingpigeondev verify +15551234567, then again with the six-digit code it texts you. From your Worker's folder, runnpx wrangler deploy, then store your key as a secret withnpx -y homingpigeondev key | npx wrangler secret put HOMINGPIGEON_API_KEY. The Worker reads it asenv.HOMINGPIGEON_API_KEY, so it never appears in your code or inwrangler.toml. - The text reads like "Daily job failed: database timed out after 30 s." The
throwafter it means the run still counts as failed, so it shows as an exception innpx wrangler tailand in your Worker's logs. controller.scheduledTimeis the time the run was scheduled for, so the idempotency key gives you at most one text per run. A quiet phone means the job worked.- The
tryintextMemeans a failed text never hides the job's own error. If Homing Pigeon rejects a send, its reason is logged as a warning. - Cron Trigger times are UTC. A change to
cronscan take up to 15 minutes to take effect after you deploy. If your project haswrangler.jsoncinstead, the same setting is"triggers": { "crons": ["0 13 * * *"] }. - The same helper works in a
fetchhandler, such as a webhook your Worker receives. Callctx.waitUntil(textMe(env, ...))there, so the response goes out right away and the Worker keeps running until the text is sent. Time spent waiting onfetchdoes not count toward a Worker's CPU time. - To try it on your own machine, put
HOMINGPIGEON_API_KEY=...in a.dev.varsfile, whichwrangler devreads in place of your secrets, and keep that file out of git. Runnpx wrangler dev --test-scheduled, then openhttp://localhost:8787/__scheduledto run the scheduled handler once. - Messages are limited to 480 characters and go only to the US mobile number you verified. Keep them plain, with no links. Delivery is not guaranteed, so treat each text as a heads-up.
Get started
Add Homing Pigeon to Claude Code, then ask for what you want:
claude mcp add homingpigeondev -- npx -y homingpigeondev mcp
You get 50 free texts every month, on US mobile numbers. See more use cases.