Originally published on BotCookery, free build recipes for AI-built trading and prediction-market bots. Written with AI assistance. Every output line in the first part below is from the Oct 25, 2026 rebuild, run on live Polymarket US public prices with Telegram mocked (TELEGRAM_MOCK=1): no message was sent and the Telegram API was never called. The bot is alert-only, has no keys and no wallet, and never trades. Nothing here is financial advice.
Updated Nov 17, 2026: we rebuilt this bot again from its Oct 25 prompt and ran it on six live Polymarket US markets. It turned up five more problems, summarized in "Nov 17 rerun" below. The current prompt and a follow-up prompt for bots built between Oct 25 and Nov 17 are on the recipe page.
A Polymarket Telegram alert bot is a small script that polls Polymarket US public prices (GET https://gateway.polymarket.us/v1/markets/{slug}/bbo, no API key) and sends you a Telegram message through the Bot API's sendMessage when a market crosses your level or moves fast. No wallet, no trading access, and the bot token stays in an env var.
On Oct 25, 2026 we pasted the Oct 22 version of the BotCookery prompt into a clean folder and ran the bot it built. The watchlist had five slugs: the Chiefs–Seahawks game, the Miami high-temperature market for "83 to 84°F" on Oct 26, an eBasketball game with an almost empty book, an NFL game that settled last year, and one deliberate typo. The crossing logic and its tests were fine. The messages and the edge cases weren't.
The one real alert we got
At 4:08 PM ET the Miami book jumped from 0.59/0.60 to 0.64/0.67. The old build sent this (mocked):
16:08:20 tc-temp-miahigh-2026-10-26-gte83lt84f bid 0.64 ask 0.67 last 0.6 price 0.655
[mock telegram] Highest temperature in Miami on October 26? | YES bid 0.64 / ask 0.67 / last 0.6 | Rule: crossed above 0.62 | Alert only. Not advice.
[mock telegram] Highest temperature in Miami on October 26? | YES bid 0.64 / ask 0.67 / last 0.6 | Rule: moved +6.0 pts in 15 min | Alert only. Not advice.
Two problems are in that message.
Problem 1: "YES" on a question every bucket shares
"Highest temperature in Miami on October 26?" is the question for every temperature bucket in that event. "YES bid 0.64" doesn't tell you which bucket. On team markets "YES" is ambiguous too. Polymarket US prices are for the market's long side, and the market-by-slug endpoint tells you what that is: title (for example "83 to 84", sometimes missing) and marketSides[], where the side with long=true is what the price is for. The rebuilt bot names it in every message: "83 to 84 (Yes)" or "Chiefs".
Problem 2: the alert was moved by quotes, not a trade
The last trade stayed at 0.60 the whole time. The bot alerts on the mid of bid and ask, so a quote change alone fired both the level rule and the move rule. That's correct behavior, but you should be able to see it. New messages show bid, ask, mid and last trade, plus the local time.
Problem 3: a 0.505 "price" from an empty book
The old build's first cycle at 4:07 PM ET:
16:07:33 aec-nfl-kc-sea-2026-10-25 bid 0.4125 ask 0.415 last 0.415 price 0.414
16:07:33 tc-temp-miahigh-2026-10-26-gte83lt84f bid 0.59 ask 0.6 last 0.6 price 0.595
16:07:33 aec-ebb-nyk-was-2026-10-25 bid 0.02 ask 0.99 last None price 0.505
aec-nfl-lac-ten-2025-11-02: no price
aec-nfl-kc-sea-2026-10-52: error 404 Client Error: Not Found for url: https://gateway.polymarket.us/v1/markets/aec-nfl-kc-sea-2026-10-52/bbo
The eBasketball book was 0.02 bid / 0.99 ask, so its "price" was 0.505. Any level near the middle would alert on noise. The fix is a max_spread setting (default 0.05, per-slug override): if the spread is wider, log "spread too wide" and skip that poll.
Problem 4: a typo that failed quietly, forever
The misspelled slug logged a 404 on every poll and never stopped. The rebuilt bot checks every slug once at startup and stops with an error that names it.
Problem 5: a settled market that said "no price" forever
The expired NFL market returns settlementPx 1.0000 and an expired state. The old bot ignored both. The new one sends one "settled/closed at 1.00" message and drops the slug.
Smaller things
- No handling of Telegram's
retry_afteron 429. - The bot token sits in the Telegram URL, so an exception from the Telegram call could print it. The new prompt scrubs it from error text before logging.
- History grew forever. Now rows older than 2 days are dropped.
- "Ignore incoming messages" was unclear. The bot now never calls
getUpdatesat all; a separate one-time helper gets your chat id.
After: the rebuild from the new prompt
With the typo still in the watchlist (4:10 PM ET):
telegram: MOCK (logs/telegram_mock.jsonl)
[mock telegram] Los Angeles vs. Tennessee | Price is for: Chargers | aec-nfl-lac-ten-2025-11-02 is MARKET_STATE_EXPIRED, settled/closed at 1.00. Dropping it from the watchlist. | Alert only. Not advice.
ERROR: aec-nfl-kc-sea-2026-10-52 not found on Polymarket US. Check the slug in watchlist.yaml.
With the typo fixed (4:11 PM ET, first cycle):
16:11:04 aec-nfl-kc-sea-2026-10-25 0.4125/0.415 mid 0.414
16:11:04 tc-temp-miahigh-2026-10-26-gte83lt84f 0.64/0.67 mid 0.655
16:11:04 aec-ebb-nyk-was-2026-10-25: spread too wide (0.02/0.99), skipped
Prices didn't move during the live rerun, so we ran --replay over the old build's saved history, which includes the real 4:08 PM jump. The same alert now reads:
Sun 16:08 EDT
Highest temperature in Miami on October 26?
Price is for: 83 to 84 (Yes)
bid 0.640 / ask 0.670 / mid 0.655, last trade 0.600
Rule: crossed above 0.62
Alert only. Not advice.
The move alert is the same apart from "Rule: moved +6.0 pts in 15 min". This market had no event_slug set, so there's no link. --replay is worth keeping on its own: it runs the rules over saved samples with no network calls, so you can test your levels without waiting for the market.
Built this before Oct 25?
Paste this follow-up into the same project:
Fix these problems in this alert bot. Read alert_bot.py first and tell
me which ones apply before changing anything.
1. Name what the price is for. GET /v1/market/slug/{slug} has title
(e.g. "83 to 84") and marketSides[]; the price is for the side with
long=true. Put "Price is for: {title} ({long side})", or just the
side if there's no title, under the question in every message.
2. Add max_spread (default 0.05, per slug override). If ask - bid is
wider, log "spread too wide" and skip that poll.
3. At startup check every slug once. 404: stop with a clear error that
names the slug. state not MARKET_STATE_OPEN: send one
"settled/closed at {settlementPx}" message and drop the slug.
4. Add the local time and bid/ask/mid/last trade to each message.
5. De-duplicate per slug and rule type (above, below, move) for 30 min.
6. Telegram: on 429 wait the retry_after seconds it returns. Scrub the
token from any exception text before logging it.
7. Remove any getUpdates call from the main loop. The bot reads no
incoming messages.
8. Drop rows older than 2 days from data/history.jsonl.
9. Add --replay data/history.jsonl to run the rules over saved samples
with no network calls.
Add tests for spread, dedup and the startup checks, and run them all.
Starting fresh? The full one-shot prompt is on the recipe page.
That follow-up covers the Oct 25 fixes only. If you built the bot after Oct 25, or applied the follow-up above, the recipe page has a second follow-up with the Nov 17 fixes.
Nov 17 rerun
On Nov 17, 2026 we built it again from the Oct 25 prompt and ran it in mock mode on six live Polymarket US markets, including an expired game and two one-sided books. The Oct 25 fixes held. What the run turned up:
-
429s at startup. The startup check makes two calls per slug. With six slugs the gateway returned 429 with
Retry-After: 10after about a dozen calls, far under the documented 25 req/s. The new prompt spaces calls a second apart and waits the Retry-After value. - One-sided books went quiet with no warning. Alaska Senate (ask 0.01, no bid) and a Doncic market (ask 0.55, no bid) logged "no price, skipped" every 20 seconds, and nothing told you those levels couldn't fire. The new bot sends one notice after 60 minutes without a usable price and one when it comes back.
-
A wrong token only showed up when an alert failed. With a fake token the real Telegram API returned 401 on
sendMessageand the alert was lost (the token was scrubbed from the log). The new bot callsgetMeat startup and stops on 401, and a failed send is retried on the next poll. -
settlementPxisn't a settlement price on open markets. It read 0.23 on the open Bitcoin $100k market and 0.36 on Alaska. Only read it once the state isn'tMARKET_STATE_OPEN. - Equal levels fire both ways. With above and below both at 0.164, a bid flicker from 0.160 to 0.157 and back fired both alerts a minute apart. Leave a gap between your levels.
The Telegram retry_after wait worked against a local fake server (it waited the 3 seconds it was told). Prices hardly moved that morning, so no level alert fired live; the level rules were checked by replaying the saved prices.
Why alert-only
Third-party Telegram bots that trade for you usually need custody of funds or a private key, and that's a common way people get drained. An alert bot you run yourself, with no wallet and no keys, avoids that whole category. It only sends to your own chat id and never reads incoming messages, so nobody can command it. If the token leaks, revoke it in @botfather (/revoke) and make a new one. And poll gently: a 30 to 60 second poll is plenty for alerts, far below Polymarket US's 25 req/s retail limit.
Limits
The page's verified line, word for word: Verified working on live data in mock mode, Nov 17, 2026. Ran Nov 17 for about 17 minutes on live Polymarket US prices across six markets (one expired, two with one-sided books). Telegram delivery was mocked. The real Telegram API was called only with a fake token, to check the 401 and token-scrub paths; the 429 retry_after wait was tested against a local fake server. Prices barely moved, so no level alert fired live; the level rules were checked by replaying that morning's saved prices.
So these runs show the bot reads live prices, names what each price is for, skips junk books, handles typos, settled markets and one-sided books, and catches a bad token at startup. They don't prove real Telegram delivery. An alert is a notification, not a signal.
The full recipe, with the complete prompt, the step-by-step build, the safety checklist and every doc we checked, is at botcookery.com/recipes/polymarket-telegram-alert-bot.
API changes and new field notes: @botcookery on X (https://x.com/botcookery)
Top comments (0)