Send a text message to yourself from Python

Yes. Homing Pigeon (homingpigeon.dev) lets any Python script text your own phone with one function call. Your coding agent can add it to the script you already have.

What to tell your agent

Use Homing Pigeon to text me from this Python script when it finishes.

Your agent asks for your number, you read back the six-digit code, and it does the rest.

How it works in code

After pip install homingpigeondev and verifying your phone, this is the whole thing:

import datetime
import homingpigeondev

homingpigeondev.send("Report is ready.", idempotency_key=f"report-{datetime.date.today()}")

For a single-file script where you would rather install nothing, the standard library does it. Set HOMINGPIGEON_API_KEY to your key first. After you verify, npx -y homingpigeondev key prints it.

import json, os, urllib.request

def text_me(message, idempotency_key=None):
    body = {"message": message}
    if idempotency_key:
        body["idempotency_key"] = idempotency_key
    req = urllib.request.Request(
        "https://homingpigeon.dev/v1/send",
        data=json.dumps(body).encode(),
        headers={
            "Authorization": f"Bearer {os.environ['HOMINGPIGEON_API_KEY']}",
            "Content-Type": "application/json",
        },
    )
    urllib.request.urlopen(req, timeout=20)

text_me("Report is ready.", "report-42")

Good to know

  • To verify from Python, run python -m homingpigeondev verify +15551234567, then run it again with the six-digit code it texts you. The key is saved on your machine.
  • The package has no dependencies of its own. It finds your key in HOMINGPIGEON_API_KEY or in the file saved when you verified, so a phone verified through your coding agent works here too.
  • The idempotency key means a retry never texts you twice for the same event. Use a job ID, or the date for an alert you want once a day.
  • A failed send raises homingpigeondev.HomingPigeonError in the package and urllib.error.HTTPError in the standard-library version. Wrap the call in try if a failed text must never stop your script.
  • 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.