Home / Blog / Amazon Buy Box Lost Alert via ntfy: Offers Poll, Confirm, One Push

Amazon Buy Box Lost Alert via ntfy: Offers Poll, Confirm, One Push

Get an Amazon Buy Box lost alert pushed to your phone with ntfy, no account or app registration needed: poll the live offer listing for each ASIN, compare the featured offer's sellerId with yours, confirm the change on a second check and POST one ntfy notification per run. Just a topic name, no webhook server, no login. Costs one credit per ASIN per check.

November 23, 2026
8 min read
SellerMagnet Team
Share & Bookmark
Terminal window showing the Amazon Buy Box lost alert a Python script pushed via ntfy

To get an Amazon Buy Box lost alert pushed to your phone today, poll /amazon-product-offers for each of your ASINs, compare buyBox.sellerId with your own seller ID, and send a notification through ntfy: POST the message as the plain-text body to ntfy.sh/<your-topic>, no account, no app registration, no webhook server. The script below sends one push per run, tells a lost Buy Box apart from a suppressed one, and costs one SellerMagnet credit per ASIN per check plus one ntfy message, well inside the free public server's daily allowance.

Key Takeaways

  • ntfy has no registration step: pick any topic string and POST to it. That also means anyone who knows (or guesses) the topic can publish to it, or subscribe to it - a long random topic is the only thing standing between your alert and a stranger's, not a secret key like Pushover's token/user pair.
  • buyBox is the featured offer: its sellerId is the seller who holds the Buy Box, the literal "Amazon" when Amazon does.
  • An empty buyBox means two different things: buyBoxSuppressed true (offers exist, Amazon features none) or no offers at all.
  • Alert only when two checks in a row agree: an offer page can come back without parsable offers, and one reading should not page you.
  • A successful send is HTTP 200 with a JSON body that carries an id/time/event, never a status/ok field the way Pushover's response does - the HTTP status code is the whole contract, there is nothing else in the body worth checking.
  • Each check costs 1 SellerMagnet credit per ASIN; 502/503 retries are billed per attempt, a 500 is refunded, and a free 401/403 stops the run with one STOP push.

How is ntfy different from a Pushover- or Slack-style alert?

There is no account to create and no app to register. ntfy (docs.ntfy.sh/publish, checked 2026-11-23) works by topic name alone: pick any string, and POST your message as the raw request body to https://ntfy.sh/<topic> - that single call both creates the topic (if it does not exist yet) and delivers the message to every subscriber. There is no token, no user key, no signing. The flip side is that an unprotected topic has no real secrecy: whoever else requests the same topic string can publish to it or subscribe to it too, which is why this script insists on a long, random topic rather than something guessable like my-buybox-alerts.

The four readings and the ntfy push each one can trigger.
ResponseReadingntfy message
buyBox.sellerId is your sellerIdmineBACK, after a confirmed loss
buyBox.sellerId is any other seller or "Amazon"lostLOST, with holder, price and your offer
buyBox is {} and buyBoxSuppressed is truesuppressedNONE
buyBox is {} and offers is []no-offersEMPTY

How do I build the Amazon Buy Box lost alert for ntfy?

read_buy_box() turns one offers response into a reading, check() keeps a streak per ASIN in buybox_state.json and queues a line once a new reading has been seen CONFIRM times in a row, and post_to_ntfy() sends every queued line as one push. get_with_retry comes from retry.py and ApiError and new_session from sellermagnet.py, both from the Python quickstart. Malformed ASINs are skipped before any call, because the offers endpoint bills a typo like any other request. MY_SELLER_ID has no default on purpose: without it every ASIN would read as lost, so the script refuses to start. post_to_ntfy() also refuses to send at all on a topic shorter than 20 characters, catching a guessable topic before the first real alert ever goes out. A new ASIN seeds its state to whatever it first reads, so a listing that starts out suppressed never fires a false alert just for staying that way. Lines are capped and summarized before the message reaches ntfy's documented 4,096-byte body limit, instead of letting a long batch silently turn into an attachment.

buybox_ntfy_alert.py - offers check, 2-check confirmation, one push per run

import json
import os
import re
import time

import requests

from retry import get_with_retry
from sellermagnet import ApiError, new_session

MARKETPLACE_ID = "ATVPDKIKX0DER"                 # amazon.com
MY_SELLER_ID = os.environ["MY_SELLER_ID"]        # your sellerId as it appears in offers[]; no default on purpose
ASINS = ["B0CL61F39H", "B0EXAMPLE2", "B0EXAMPLE3"]
CONFIRM = 2                                      # same reading on 2 checks in a row before ntfy hears about it
STATE_FILE = "buybox_state.json"
ASIN_RE = re.compile(r"^[A-Z0-9]{10}$")           # offers calls are billed even for a typo, so filter first
MAX_MESSAGE_BYTES = 4096                          # docs.ntfy.sh/publish: longer bodies become an attachment
MAX_LINES = 20                                    # keep well under the 4096-byte body even with long lines
MIN_TOPIC_LEN = 20                                # a short/guessable topic is PUBLIC: anyone can read or post to it


def read_buy_box(session, asin: str) -> tuple[str, str]:
    """('mine' | 'lost' | 'suppressed' | 'no-offers', detail for the message)."""
    data = get_with_retry(session, "amazon-product-offers", asin=asin, marketplaceId=MARKETPLACE_ID)
    box = data.get("buyBox") or {}
    if not box:
        # {} has two causes: offers exist but Amazon features none, or no offer at all (or none parsable)
        return ("suppressed", "") if data.get("buyBoxSuppressed") else ("no-offers", "")
    holder = box.get("sellerId") or "unknown"
    if holder == MY_SELLER_ID:
        return "mine", ""
    currency = (data.get("currency") or {}).get("code", "")
    detail = f"{box.get('sellerName', '?')} ({holder}, {box.get('fulfillmentType', '?')})"
    if isinstance(box.get("totalPrice"), (int, float)):      # price + shipping as floats, not rounded by the API
        detail += f" at {box['totalPrice']:.2f} {currency}"
    mine = [o["totalPrice"] for o in data.get("offers") or []
            if o.get("sellerId") == MY_SELLER_ID and isinstance(o.get("totalPrice"), (int, float))]
    detail += f", your offer {min(mine):.2f}" if mine else ", your offer: not on the first offer page"
    return "lost", detail                      # any other holder is the same reading: a rotation still confirms


def line_for(asin: str, key: str, detail: str) -> str:
    text = {"mine": "BACK, you hold the Buy Box again",
            "suppressed": "NONE, offers exist but Amazon features none",
            "no-offers": "EMPTY, no offers on the listing"}.get(key, f"LOST, held by {detail}")
    return f"{asin}: {text}"


def build_message(lines: list[str]) -> str:
    # docs.ntfy.sh/publish: a message over 4,096 bytes is NOT rejected or trimmed - it is silently treated
    # as an attachment instead, which a notification client renders completely differently. Summarize first.
    if len(lines) > MAX_LINES:
        lines = lines[:MAX_LINES] + [f"+{len(lines) - MAX_LINES} more, see the dashboard"]
    body = "\n".join(lines)
    while len(body.encode()) > MAX_MESSAGE_BYTES and lines:
        lines = lines[:-1] + ["+1 more, see the dashboard"]
        body = "\n".join(lines)
    return body


def post_to_ntfy(topic: str, lines: list[str], token: str = "") -> bool:
    """One message per run. docs.ntfy.sh/publish: a successful send is HTTP 200 with a JSON body that
    carries an id/time/event, never a status/ok field to additionally check - the HTTP status code IS
    the whole contract. A 4xx means the input was bad (oversized title/tags, unknown/blocked topic, over
    the rate limit) and must never be retried unchanged; ntfy documents no retry-safe window the way
    Pushover does, so a 5xx or no reply gets exactly one retry, after a short wait."""
    if len(topic) < MIN_TOPIC_LEN:
        # a short topic is guessable, and ntfy.sh has no secret on an unprotected topic besides its name:
        # anyone who requests the same string can subscribe to (or publish to) it too.
        raise ValueError(f"NTFY_TOPIC is only {len(topic)} chars; use a random topic >= {MIN_TOPIC_LEN} chars")
    if not lines:
        return True
    headers = {
        "Title": "Amazon Buy Box change, confirmed on 2 checks",
        "Priority": "4",                                      # high; 5 (urgent) is reserved for real emergencies
        "Tags": "rotating_light,amazon",
    }
    if token:
        headers["Authorization"] = f"Bearer {token}"           # only needed for a protected/self-hosted topic
    body = build_message(lines).encode()
    for attempt in range(2):                                   # at most one retry, only for the temporary class
        try:
            resp = requests.post(f"https://ntfy.sh/{topic}", data=body, headers=headers, timeout=10)
        except requests.RequestException as err:
            print(f"ntfy unreachable: {type(err).__name__}")
            if attempt == 0:
                time.sleep(5)
                continue
            return False
        if resp.status_code == 200:
            return True
        if resp.status_code >= 500 and attempt == 0:
            time.sleep(5)
            continue
        print(f"ntfy refused the message: {resp.status_code} {resp.text[:120]}")  # 4xx incl. 429 = input problem
        return False
    return False


def load_state() -> dict:
    try:
        with open(STATE_FILE, encoding="utf-8") as fh:
            return json.load(fh)
    except FileNotFoundError:
        return {}


def save_state(state: dict) -> None:
    tmp = STATE_FILE + ".tmp"
    with open(tmp, "w", encoding="utf-8") as fh:
        json.dump(state, fh, indent=1, sort_keys=True)
    os.replace(tmp, STATE_FILE)                     # a crash mid-write keeps the last good state


def check(asins: list[str], topic: str, token: str = "") -> None:
    session, state = new_session(), load_state()
    alerts, problems, checked, stopped = [], [], 0, ""
    for asin in dict.fromkeys(a.strip().upper() for a in asins):            # dedupe, keep order
        if not ASIN_RE.match(asin):
            problems.append(f"{asin}: not an ASIN, skipped")
            continue
        try:
            key, detail = read_buy_box(session, asin)
        except ApiError as err:
            if err.status in (401, 403):
                stopped = str(err)                       # bad key or no credits: every further call fails too
                problems.append(f"stopped: {stopped}")
                break
            problems.append(f"{asin}: {err}")            # 404 = listing gone (billed); state stays as it was
            continue
        except requests.RequestException as err:
            problems.append(f"{asin}: {type(err).__name__} after retries, state kept")
            continue
        checked += 1
        s = state.get(asin)
        if s is None:
            # first-ever sighting of this ASIN: seed state to it so a steady reading never alerts as a change
            s = state[asin] = {"last": key, "streak": 1, "reported": key}
            continue
        s["streak"] = s["streak"] + 1 if key == s["last"] else 1
        s["last"] = key
        if s["streak"] >= CONFIRM and key != s["reported"]:
            alerts.append((asin, key, line_for(asin, key, detail)))
    lines = [line for _, _, line in alerts]
    if stopped and state.get("_stopped") != stopped:
        lines.append(f"STOP: checks stopped: {stopped}")       # said once, not every run
    sent = post_to_ntfy(topic, lines, token)
    if sent:
        for asin, key, _ in alerts:
            state[asin]["reported"] = key               # only after ntfy answered 200, else re-sent next run
        if stopped:
            state["_stopped"] = stopped
    if not stopped:
        state.pop("_stopped", None)
    save_state(state)
    for line in problems:
        print(line)
    print(f"{checked} checked, {len(alerts)} alert(s) {'sent' if sent else 'NOT sent, retried next run'}")


if __name__ == "__main__":
    check(ASINS, os.environ["NTFY_TOPIC"], os.environ.get("NTFY_TOKEN", ""))

Five runs of the script (illustrative ASINs and sellers; [ntfy] = the push sent)

--- run 1 (illustrative ASINs and sellers)
3 checked, 0 alert(s) sent
--- run 2, B0EXAMPLE2 lost (1st sighting, not yet confirmed)
3 checked, 0 alert(s) sent
--- run 3, same reading confirmed
[ntfy] Amazon Buy Box change, confirmed on 2 checks: B0EXAMPLE2: LOST, held by Example Outlet (A2OTHERSELLER0, FBA) at 18.49 USD, your offer 19.99
3 checked, 1 alert(s) sent
--- run 4, back to mine (1st sighting, not yet confirmed)
3 checked, 0 alert(s) sent
--- run 5, back to mine, confirmed
[ntfy] Amazon Buy Box change, confirmed on 2 checks: B0EXAMPLE2: BACK, you hold the Buy Box again
3 checked, 1 alert(s) sent

What the script actually POSTs (curl equivalent, illustrative values)

curl -s -X POST https://ntfy.sh/sm-buybox-x7q2mA9ktRz4LpN3 \
  -H "Title: Amazon Buy Box change, confirmed on 2 checks" \
  -H "Priority: 4" \
  -H "Tags: rotating_light,amazon" \
  -d "B0EXAMPLE2: LOST, held by Example Outlet (A2OTHERSELLER0, FBA) at 18.49 USD"
# {"id": "9sMvklF...", "time": 1732000000, "event": "message", "topic": "sm-buybox-x7q2mA9ktRz4LpN3"}
Blueprint flow: offers check per ASIN, two-check confirmation, then one ntfy push
A reading has to repeat before it reaches ntfy; failed calls change nothing.

How do I pick a topic and, optionally, protect it?

  1. Generate a long, random topic nameThere is no registration: a topic is just a string. Generate one with, for example, python3 -c "import secrets; print('sm-buybox-' + secrets.token_urlsafe(16))" - long enough that a stranger cannot guess it.
  2. Subscribe a deviceInstall the ntfy Android/iOS/desktop app or open ntfy.sh/<your-topic> in a browser, and subscribe to your exact topic string. No login is required for the public server.
  3. Send a test messagecurl -d "test" ntfy.sh/<your-topic> from a terminal; it should appear on every subscribed device within a few seconds.
  4. Optional: protect the topicFor real access control, self-host ntfy with an access-control list, or use an ntfy.sh paid tier's reserved topics with a login; either way, pass the resulting token as NTFY_TOKEN and the script adds it as a Bearer Authorization header automatically.

Environment file and a cron entry for a 15-minute check (flock -n prevents overlapping runs)

# .env (keep it out of git: the topic name is the only thing standing between your alert and a stranger's)
export SELLERMAGNET_API_KEY="your-key-here"
export NTFY_TOPIC="sm-buybox-x7q2mA9ktRz4LpN3"   # a long, random topic; anyone who knows it can publish or subscribe
export NTFY_TOKEN=""                              # optional: only set for a protected/self-hosted topic
export MY_SELLER_ID="A1MYSELLER0001"              # your sellerId as it appears in offers[]

# crontab -e: every 15 minutes, 3 ASINs = 288 credits a day; flock -n skips a run while the last one still runs
*/15 * * * * cd /opt/buybox && . ./.env && flock -n .lock .venv/bin/python buybox_ntfy_alert.py >> alert.log 2>&1

ntfy's own documentation (docs.ntfy.sh/publish, checked 2026-11-23) describes the contract the script relies on: a successful publish answers HTTP 200 with a JSON body carrying id, time, event and topic fields - there is no status/ok/ack field the way Pushover's response has one, so the HTTP status code alone is the signal to act on. The docs do not describe a retry-safety classification for publishers the way Pushover's support knowledge base does, so the safe rule carried over from the shipped alert posts in this series applies here too: a 4xx (bad title/tags, an unknown or blocked topic, or a 429 over the rate limit) means the request itself was rejected and must not be retried unchanged, while a 5xx or no reply at all is the server's own temporary problem and gets exactly one retry. Messages over 4,096 bytes are not rejected outright; they are silently treated as an attachment instead, which is why the script summarizes a long batch rather than relying on the server to do it.

What should you check when a LOST alert fires?

The alert tells you who holds the Buy Box and at what total price, not why Amazon featured that offer. Amazon's US help page Becoming the Featured Offer (Seller Central, checked 2026-10-23) lists what it weighs: the total price including shipping, a fast and specific delivery promise, free shipping, free returns and seller performance, and an out-of-stock offer cannot be featured. Its Featured Offer guide on sell.amazon.com adds that fulfilling orders yourself can be just as effective as FBA. Start with the gap between the holder's price and your offer in the push, then your delivery date and stock. Amazon's own guidance is on sell.amazon.com's Featured Offer page and Seller Central's "Becoming the Featured Offer" help article. The Buy Box price gap guide shows why the lowest price alone does not decide it.

How many credits does a Buy Box alert cost?

One offers call per ASIN per check, so the SellerMagnet cost is the number of ASINs times the number of checks; ntfy itself is free on the public server and, at one push per confirmed change, stays far under its 250-messages-a-day allowance for almost any tracking volume. With a 2-check confirmation the worst-case delay before ntfy hears about a loss is about two intervals. Errors add to the SellerMagnet bill in different ways: a 404 is billed once and not retried, a 502 or 503 is billed on every attempt, a 500 is refunded, and the free gate errors (400 for a missing parameter, 401, 403, 429) cost nothing. The Buy Box monitoring interval guide compares intervals in more detail, and Pricing lists the plans.

Credits per tracked ASIN by check interval (1 credit per offers call).
Check intervalCredits per dayCredits per 30 daysWorst-case alert delay
Every 15 minutes962,880about 30 minutes
Every hour24720about 2 hours
Every 4 hours6180about 8 hours
Once a day130about 2 days
Blueprint table of credits per tracked ASIN for four check intervals and the alert delay
Shorter intervals cost more credits and cut the delay; the confirmation doubles it.

Frequently Asked Questions

Do I need to register an account or an app with ntfy before I can send?

No. ntfy.sh has no registration step at all for an unprotected topic: pick any topic string and POST to it. That also means anyone who requests the same topic string can subscribe to it, or publish to it, which is why the script below refuses to run on a short, guessable topic (fewer than 20 characters).

Does ntfy confirm the message was delivered, like Pushover's status field?

No, and differently so: a successful send is HTTP 200 with a JSON body carrying an id/time/event, but there is no status/ok field inside it to additionally check. The HTTP status code is the entire contract; this script checks resp.status_code == 200 and nothing else.

Why does the script wait for a second check before posting?

An offer page can come back without parsable offers, which looks like a stock-out. Waiting for the same reading on two checks in a row filters one-off readings at the cost of one interval.

What happens if I send more than ntfy.sh's daily message limit?

The public ntfy.sh server caps anonymous publishing at 250 messages per visitor (IP address) per day, governed by the same request-limit bucket as every other call. Once exhausted, further sends answer HTTP 429 until the next day's reset. Checking one ASIN every 15 minutes with a 2-check confirmation sends at most a handful of pushes a day, well under the limit.

Can I protect my topic so a stranger cannot publish fake Buy Box alerts to it?

Not on the public ntfy.sh server for a free-form topic: anyone who knows the string can publish to it. A long random topic (the script enforces at least 20 characters) makes guessing impractical but is still not a real secret. Real access control needs either a self-hosted ntfy server with an access-control list, or an ntfy.sh tier that supports reserved topics behind a login, passed as a Bearer token in the Authorization header.

What happens when my SellerMagnet credits run out?

The API answers 401 (or 403 during a burst), which is not billed. The script stops instead of calling the remaining ASINs, sends one STOP message and does not repeat it until a run gets through without a 401 or 403.

Bottom line: compare buyBox.sellerId with your own seller ID, keep a streak per ASIN, and send one ntfy push per run with a plain POST to a long, random topic - no account, no webhook server required. To see who held the Buy Box and for how long after the fact, use the Buy Box history API; a free account includes 150 credits to try the alert.

Ready to Extract Amazon Data at Scale?

Start building with SellerMagnet API today. Real-time product data, competitive pricing, and review analytics at your fingertips.

150 free API credits • No credit card required • Cancel anytime