How to get a Telegram alert when a crypto price crosses your level (CoinGecko API)
You do not need to watch charts all day. A small script can check a price every few minutes and message you on Telegram only when it crosses the level you picked. This guide uses the free Demo plan of the CoinGecko API. It is an alert, not a trading signal, and nothing here promises any result.
What you need
- A Telegram account and a bot token from @BotFather (send
/newbot; treat the token like a password). - A free CoinGecko API Demo key. The Demo plan has 10,000 call credits per month and 100 calls per minute.
- Python 3 with the
requestslibrary.
Step by step
- Get your chat ID. Open your bot, send
/start(bots cannot message you first) and read the chat ID from thegetUpdatesresponse of the Telegram Bot API. - Ask for the price. The
/simple/priceendpoint returns prices for the coins and currencies you name. For the Demo plan, the base URL ishttps://api.coingecko.com/api/v3/and the key goes in thex-cg-demo-api-keyheader. A request withids=bitcoinandvs_currencies=usdreturns a small JSON such as{"bitcoin": {"usd": 76975}}. - Compare with your level. In Python, read the number and check it against your threshold, for example
if price >= 80000. - Send the message. Post to
https://api.telegram.org/bot<token>/sendMessagewith yourchat_idand atextsuch as "Bitcoin is above your level". - Avoid repeats. Keep a small flag (a variable or a file) so you are alerted once per crossing, not at every check.
- Schedule it with cron or your task scheduler.
Mind the monthly credits
Checking every minute means about 43,200 calls a month, far above the 10,000 of the Demo plan. Check every 5 minutes instead (about 8,600 calls) or ask for several coins in one request, since one call can include many ids. Check the official pricing page for current limits.
Other ways to do it
- Skip the Telegram code and send the message with Apprise or a phone push with ntfy.
- Build a full bot that answers "price of ETH?" with python-telegram-bot.
- For stocks and ETFs, see our daily price summary guide. For shop prices, see price-drop alerts.
Good to know
Prices from a free API can lag by a short time, so use this for awareness, not for split-second decisions. Any trading idea should be backtested with fees and tested in simulation first, and with risk limits you set yourself. The Demo key must stay out of public repositories.
See more ideas
Browse the use cases or try the live demo. Custom bots are coming soon: tell me when it opens.
Before you start
What does CoinGecko API cost and what licence does it use?
Free Demo plan; paid plans from $35/mo (Basic). Licence: Commercial service. Prices change, so check the official website before you decide.
What should I know before using CoinGecko API?
10,000 calls a month run out fast if you poll every minute (about 43,000 a month).
Tools in this guide
- CoinGecko API: Crypto data API (prices, market cap, history) with a free Demo plan.
Want a bot like this when custom bots open? Get notified · more bot ideas
Coming soon: custom bots
We are preparing a service to code, backtest and automate trading and statistics bots to your own rules. It is not available yet: follow our Telegram channel to know when it opens.