Get a text when something is back in stock

Yes. Homing Pigeon (homingpigeon.dev) lets a small Python script check a product page and text your phone when the item goes from sold out to in stock. It texts once when that happens, not on every check, and your coding agent can write it for the page you are watching.

What to tell your agent

Use Homing Pigeon to text me when this product is back in stock.

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 requests, save this as check_stock.py, with your own page, marker and name:

import datetime, pathlib, requests
import homingpigeondev

url = "https://example.com/products/trail-shoes"
marker = "schema.org/InStock"
state = pathlib.Path("trail-shoes.txt")

res = requests.get(url, headers={"User-Agent": "Mozilla/5.0"}, timeout=20)
res.raise_for_status()
in_stock = marker in res.text
was_in_stock = state.exists() and state.read_text() == "in"

if in_stock and not was_in_stock:
    today = datetime.date.today().isoformat()
    homingpigeondev.send("Trail shoes are back in stock.", idempotency_key=f"trail-shoes-{today}")
state.write_text("in" if in_stock else "out")

Then run it every 15 minutes from cron:

*/15 * * * * cd /home/me/stock-check && /usr/bin/python3 check_stock.py

Good to know

  • The file trail-shoes.txt remembers what the last check saw, so you get a text only when the item goes from sold out to in stock, not every 15 minutes while it stays in stock. If it is already in stock the first time the script runs, you get a text right away, which also shows the setup works.
  • Many shops put stock status in the page's structured data, as https://schema.org/InStock or https://schema.org/OutOfStock. Open the page source and search for InStock to check. If it is not there, use text that appears only when you can buy the item, and make sure it is missing while the item is sold out.
  • On a page with several sizes or colors, the marker can show up for one of them while yours is still sold out. Use the page for your exact size or color if the shop has one, or ask your coding agent to match the marker for that one only.
  • The date in the idempotency key means you get at most one text a day, even if the item sells out and comes back several times. To hear about each restock, put the hour in the key too.
  • If the page does not load, raise_for_status stops the script with an error and the file is left alone, so a failed check never counts as sold out. If the text cannot be sent, the file is left alone too, so the next check tries again, and the idempotency key keeps that retry from texting you twice.
  • Some pages only fill in stock status with JavaScript, so the script never sees it. For those, ask your coding agent to find where the page loads its stock status from.
  • Every 15 minutes is enough for most restocks. Check the shop's terms before you check its pages from a script.
  • Cron runs with a short PATH, so use the full path to Python. Run which python3 to find yours. Verify your phone as the same user the cron job runs as, with python3 -m homingpigeondev verify +15551234567, then again with the six-digit code it texts you.
  • 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.