Polymarket Telegram Alert Bot in One Prompt (Polymarket US, No Trading)

Polymarket US Alerts only

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.

Short answer: 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. It needs no wallet and no trading access, and the bot token stays in an env var.

What are the key facts?

  • Data: Polymarket US public endpoints, no key: GET https://gateway.polymarket.us/v1/markets/{slug}/bbo (best bid/ask, last trade, state, settlement price) and GET /v1/market/slug/{slug} (question, title, sides).
  • Prices are for the market's long side, and a question like "Highest temperature in Miami on October 26?" is shared by every bucket, so each alert says what the price is for.
  • Skip wide books: a 0.02/0.99 book has a 0.505 mid that means nothing.
  • Telegram: create a bot with @BotFather, then send messages with the Bot API sendMessage method (https://api.telegram.org/bot<token>/sendMessage, params chat_id, text).
  • Keep the bot token in an env var. Anyone with the token controls the bot.
  • Polymarket US documents 25 req/s, but the public gateway answered 429 with Retry-After: 10 after about a dozen quick calls in our runs. Space calls a second apart and poll every 30–60 seconds.
DifficultyBeginner
Time45 min
Cost$0
Works withClaude Code, Cursor, ChatGPT / Codex, Grok

What will you build?

A small script on your computer that watches a list of Polymarket US markets and sends you a Telegram message when a price crosses a level you set or moves more than X points in Y minutes.

Who is it for?

Traders who want alerts without handing a wallet or keys to a random Telegram trading bot.

Not for: Telegram bots that trade, hold funds or ask for a private key. Those are a top way people get drained.

What happened when we rebuilt it from this prompt

On Nov 17, 2026 we built it again from the Oct 25 prompt in a clean folder and ran it in TELEGRAM_MOCK=1 mode from 9:22 to 9:31 AM ET on six live Polymarket US markets: two Bitcoin markets, an MLS champion market, the Alaska Senate winner (two weeks after the election, still open), a Luka Doncic points-leader market for that night, and the expired Chargers–Titans game. The Oct 25 fixes held: the expired market got one "settled/closed at 1.00" message and was dropped, wide and empty books were skipped, and every price line said what it was for. 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: 10 after about a dozen calls, a long way under the documented 25 req/s. The backoff recovered, but the new prompt spaces calls a second apart and waits the Retry-After value.
  • Two markets went quiet with no warning. Alaska had an ask of 0.01 and no bid; the Doncic market had an ask of 0.55 and no bid. Both logged "no price, skipped" every 20 seconds, and nothing told you your levels on them couldn't fire. The new bot sends one message after 60 minutes without a usable price and one when it comes back.
  • A wrong token only showed up when an alert failed. We called the real Telegram API with a fake token: sendMessage came back 401 and the alert was lost, logged once. The token was scrubbed from the log. The new bot calls getMe at startup and stops with a clear error on 401, and an alert that fails to send is retried on the next poll instead of being marked as sent.
  • settlementPx isn't a settlement price on open markets. It read 0.23 on the open Bitcoin $100k market and 0.36 on Alaska. The bot only reads it once the state isn't MARKET_STATE_OPEN, and the prompt now says that outright.

The Telegram retry_after wait worked against a local fake server that returned 429 once (it waited the 3 seconds it was told). Prices hardly moved that morning, so no level alert fired live. Replaying the saved prices showed the other thing to know: we'd set both above and below to 0.164 on the MLS market, and when the bid flicked from 0.160 to 0.157 and back, both alerts fired a minute apart. Leave a gap between your levels.

The rebuild from the new prompt, 9:31 AM ET, with the no-price wait cut to 2 minutes for the test:

[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.
09:31:40 tec-mls-winner-2026-11-07-vwh 0.16/0.17 mid 0.165
09:31:41 ewc-usse-ak-2026-11-03-rep: no price, skipped
...
[mock telegram] Alaska Senate Election Winner | Price is for: Dan Sullivan (R) (Yes) | No usable price for 2 min (bid none / ask 0.01). Levels can't fire until it's back. | Alert only. Not advice.

Earlier, on Oct 25, the first rebuild found that alerts didn't say what the price was for (the Miami temperature question is shared by every bucket), mids from 0.02/0.99 books, a typo that failed quietly forever, a settled market that said "no price" forever, and no handling of Telegram 429s. Those fixes are in the prompt. A real alert from that run, when the Miami book jumped from 0.59/0.60 to 0.64/0.67 with no trade:

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.

Built this between Oct 25 and Nov 17? Paste this follow-up into the same project. If you built it before Oct 25, rebuild from the prompt below instead.

Fix these problems in this alert bot. Read alert_bot.py first and tell
me which ones apply before changing anything.

1. Space Polymarket calls at least 1s apart, startup checks included.
   On 429/5xx wait the Retry-After header (else back off 1, 2, 4... s).
2. If a slug has had no usable price (no bid, no ask, or spread wider
   than max_spread) for 60 min, send one message saying so with its
   bid/ask, and one more when a usable price comes back.
3. If TELEGRAM_BOT_TOKEN is set, call getMe at startup; on 401 stop
   with "Telegram rejected TELEGRAM_BOT_TOKEN".
4. An alert counts for de-dup only once Telegram accepted it. If a send
   fails, retry it on the next poll.
5. Only use settlementPx when state is not MARKET_STATE_OPEN; it is
   filled in on open markets too.

Add tests for the failed-send retry and the no-price notice, and run
them all.

What prompt do you paste into your AI coding tool?

Works in Claude Code, Cursor, Codex/ChatGPT, Grok or any agent that can write files. Paste it into an empty folder. Read what it builds before you run anything.

Build a personal Telegram ALERT bot in Python for Polymarket US markets.
It must never trade, never hold funds, and never ask for a wallet or
private key. It only sends messages to my own chat.

Data (public, no auth), documented at https://docs.polymarket.us:
- GET https://gateway.polymarket.us/v1/markets/{slug}/bbo
  marketData: bestBid, bestAsk, lastTradePx (each {"value": "0.41"} or
  null), state, settlementPx. Prices are for the market's LONG side.
  settlementPx is filled in on open markets too, so only use it when
  state is not MARKET_STATE_OPEN.
- GET https://gateway.polymarket.us/v1/market/slug/{slug} -> "market":
  question, title (e.g. "83 to 84"; can be missing) and marketSides[].
  The side with long=true is what the price is for ("Chiefs", or just
  "Yes"). The question alone is often the whole event ("Highest
  temperature in Miami on October 26?"), so every message names what
  the price is for: the title if set, then the long side, e.g.
  "83 to 84 (Yes)" or "Chiefs".

watchlist.yaml (I edit by hand):
  - slug: "..."
    above: 0.60        # alert when the price crosses above
    below: 0.40        # alert when it crosses below
    move_pts: 5        # alert on a move of >= 5 points...
    move_minutes: 15   # ...within 15 minutes
    event_slug: "..."  # optional, for the link (from GET /v1/search)

alert_bot.py:
- At startup check every slug once. A 404 or a typo: print it and stop
  with a clear error. MARKET_STATE_EXPIRED (or any non-OPEN state): send
  one message "settled/closed at {settlementPx}" and drop it. If a token
  is set, call getMe once; on 401 stop with "Telegram rejected
  TELEGRAM_BOT_TOKEN" instead of failing on the first alert.
- Price = mid of bid and ask, but only if ask - bid <= max_spread
  (default 0.05, per slug override). Otherwise log "spread too wide" and
  skip that poll; never alert on a mid from a 0.02/0.99 book. No bid or
  no ask: log "no price" and skip; never treat it as 0. If a slug has
  had no usable price for 60 min, send one message saying so (with its
  bid/ask), and one more when a usable price comes back.
- A crossing needs a previous sample, so the first poll never alerts.
- Poll every 60s (configurable, minimum 15s). Keep history in memory and
  in data/history.jsonl (drop rows older than 2 days).
- Message: time in my local zone, question, what the price is for,
  bid/ask/mid and last trade, the rule that fired, the link
  https://polymarket.us/event/{event_slug} if set, and
  "Alert only. Not advice."
- De-duplicate per slug and rule type (above, below, move) for 30 min.
  An alert counts for de-dup only once Telegram accepted it; if a send
  fails, retry it on the next poll.
- Telegram: POST https://api.telegram.org/bot<TOKEN>/sendMessage with
  chat_id and text, from env TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID. On
  429 wait the retry_after seconds it returns. Never log the token (it is
  in the URL, so scrub it from exceptions too).
- No incoming commands at all: the bot never reads getUpdates in normal
  runs. get_chat_id.py is a separate one-time helper.
- TELEGRAM_MOCK=1: write each alert to logs/telegram_mock.jsonl and print
  it instead of calling Telegram. Also the default if the token is unset.
- --replay data/history.jsonl: run the rules over saved samples with no
  network calls, so I can test levels.
- Space Polymarket calls at least 1s apart, startup checks included.
  The public gateway can return 429 well below its documented 25 req/s;
  on 429/5xx wait the Retry-After header (else back off 1, 2, 4... s).
- .env.example, .gitignore with .env, README. Tests for crossing, moves,
  spread, dedup, failed-send retry, the no-price notice and the startup
  checks. Run them.

Show the plan, build, then tell me how to get my chat id and run it.

How do you build it, step by step?

  1. Create a Telegram bot. Message @BotFather, send /newbot, pick a name, and copy the token. Treat it like a password.
  2. Get your chat id. Send your new bot any message, then run the one-time get_chat_id.py helper the prompt builds (it calls getUpdates and prints chat.id). The alert bot itself never reads messages.
  3. Paste the prompt into your AI coding tool in a fresh folder with the Safety Pack .gitignore.
  4. Fill in watchlist.yaml. Find slugs with GET https://gateway.polymarket.us/v1/markets?active=true&closed=false&limit=20 or GET /v1/search?query=.... Look at each slug's /bbo before you set above/below levels. The bot stops at startup on a slug that doesn't exist and drops one that has settled, with a message saying so. If a book is wide, it skips that market until the spread is under max_spread.
  5. Put secrets in .env: TELEGRAM_BOT_TOKEN=... and TELEGRAM_CHAT_ID=....
  6. Run it: python alert_bot.py, or TELEGRAM_MOCK=1 python alert_bot.py to test without a token (alerts go to logs/telegram_mock.jsonl; mock is also the default when no token is set). To test your levels without waiting for the market, run python alert_bot.py --replay data/history.jsonl after it has collected some history.
  7. Keep it running on an always-on computer you control (a spare laptop, a Raspberry Pi, or a small VPS you own). BotCookery never hosts bots for you.

How do you test it in paper or demo mode first?

Alerts don't trade, so there's no money at risk in this recipe. If you later want the alerts to suggest an order, add a paper column: log the price you would have bought at and check it a day later. Do that for a few weeks before wiring alerts to anything that trades. When you're ready, the Polymarket bot recipe shows the paper-ledger setup.

What safety checks does it need before real money?

Tick every box before the bot touches real money. The full rules file, .gitignore and pre-commit hook are in the Safety Pack.

Which official docs did we check?

Endpoints and rules were checked against these pages on Nov 17, 2026. APIs change, so if something here disagrees with the official docs, trust the docs and tell us.

Frequently asked questions

How do I make a Polymarket Telegram bot?

Create a bot with @BotFather, poll Polymarket US public market data (for example the /v1/markets/{slug}/bbo endpoint), and send yourself messages with the Telegram Bot API's sendMessage method when your conditions hit. No Polymarket API key is needed for alerts.

Are Polymarket Telegram trading bots safe?

Third-party Telegram bots that trade for you usually need custody of funds or a private key, which is a major risk. An alert-only bot you run yourself, with no keys or wallet, avoids that whole category of risk.

Do I need a Polymarket API key for price alerts?

No. Polymarket US market data, including best bid/ask and order books, is available from the public gateway without authentication.

Why did my alert fire when nothing traded?

The bot uses the mid of the best bid and ask, so a quote change can move it while the last trade stays put. In our Oct 25 run the Miami book moved from 0.59/0.60 to 0.64/0.67 with the last trade still at 0.60. Each message shows bid, ask, mid and last trade so you can tell which it was.

Why does one of my markets just say "no price"?

The book is one-sided: there's an ask but no bid, or the reverse, so there's no mid to compare with your levels. On Nov 17 the Alaska Senate market, two weeks after the election, had an ask of 0.01 and no bid. The bot tells you once after an hour of this so a level doesn't sit there unable to fire without you knowing.

Can I share my alert bot in a public Telegram group?

For Polymarket US, check its terms before redistributing data. For anything using Kalshi data, Kalshi's Developer Agreement prohibits sharing API data with third parties without written permission. The safe default is alerts to your own chat only.

More from the kitchen: Recipes by platform · Kalshi & Polymarket fee calculator · How we verify recipes · Safety Pack