Build a Telegram Buy Alert Bot for Your Token (Python + BSC + Web3)

🧠 Why You Need a Buy Alert Bot for Your Token
Launching a token is one thing. Creating community engagement and hype is another.
Every buy on your token matters — especially the big ones.
But if no one knows it happened, that momentum is wasted.
That’s where a Telegram Buy Alert Bot comes in.
It instantly notifies your community when someone buys your token — showing the amount, wallet address, USD value, and more.
"Hype isn't automatic — it's built one alert at a time."
💡 What the Bot Can Do
This Telegram bot:
Detects buy transactions on PancakeSwap (BSC) / Uniswap (ETH)
Tracks your specific token’s address
Sends real-time alerts to your Telegram group or channel
Shows:
🧾 Buyer wallet (shortened)
💰 Amount bought
💵 USD equivalent
📊 Buy source (wallet or DEX)
You can also customize:
Minimum buy value for alert
Emojis, alert tone, channel style
Target token & chain (BSC, ETH, etc.)
🛠️ Built with Modern Stack
Python
Web3.py
for blockchain interactionTelegram Bot API
to send messages
This bot isn’t a random GitHub script.
It’s a production-grade tool I’ve refined for actual token teams — fully customizable and hosted.
🔍 How It Works (Simplified)
Connects to BSC using a RPC endpoint
Listens to your token's liquidity pool Swap Events
Filters out buy transactions only
Extracts key data like wallet, token amount, USD value
Formats a clean alert message
Sends it to your Telegram group
🧪 How the Code Works
Here’s a simplified breakdown of how I built the Telegram Buy Alert Bot:
Connecting with the blockchain
from web3 import Web3 web3 = Web3(Web3.HTTPProvider("YOUR_RPC_URL_HERE")) if web3.is_connected(): print("Connected to the blockchain, Polling for events...")
Listen for token pair Swap Events (Buy or Sell)
import json PAIR_ABI= json.loads("") #You can get this from your pair contract via bscscan or ethscan pair_contract = web3.eth.contract( address=Web3.to_checksum_address(os.getenv("PAIR_ADDRESS")), abi=PAIR_ABI ) swap_event = pair_contract.events.Swap() logs = swap_event.get_logs(fromBlock=from_block, toBlock=to_block) # U have to create a python logic to keep polling continous block to not miss any buy
Filter Buy Transactions
TOKEN_NUMBER = 1 # Each pair have different token number u can check ethscan pair contract -> code -> read contract to check if "token1" is your token address if yes token number is 1 else it will be bnb valid_tx = [] for log in logs: # Determine which is token amount based on TOKEN_NUMBER if TOKEN_NUMBER == 0: token_in = amount0In / (10 ** TOKEN_DECIMALS) token_out = amount0Out / (10 ** TOKEN_DECIMALS) base_in = amount1In / (10 ** 18) base_out = amount1Out / (10 ** 18) else: token_in = amount1In / (10 ** TOKEN_DECIMALS) token_out = amount1Out / (10 ** TOKEN_DECIMALS) base_in = amount0In / (10 ** 18) base_out = amount0Out / (10 ** 18) is_buy = base_in > 0 and token_out > 0 if is_buy: data = { "status": "processed", "bnb_in": float(round(base_in, 5)), "tokens_out": float(round(token_out, 4)), "txn_hash": log['transactionHash'].hex(), "to": log.get("to") } valid_tx.append(data)
Send alert to telegram
from telebot import TeleBot BOT_TOKEN = "" CHAT_ID = "" # Make sure bot admin in the chat bot = TeleBot(BOT_TOKEN) msg = """ 📢 *New Buy Detected!* *💰 Buyer:* [{to_address[0:15]}..............](https://bscscan.com/address/{to_address}) *🔄 Spent:* `{bnb_in}` BNB *🪙 Amount:* `{tokens_out}` """.strip() for tx in valid_tx: msg_final = msg.format(to_address=tx['to'], bnb_in=tx['bnb_in'], tokens_out=tx['tokens_out']) bot.send_message(CHAT_ID, msg_final)
🤝 Want This for Your Token?
If you're launching a token and want a custom Telegram Buy Alert Bot, you don’t need to build it from scratch.
I've already done the hard work — and I can set it up for you in a few hours.
📬 DM me on Telegram: Telegram
🌐 Or order directly via Fiverr: Fiver
Some projects of mine: https://adityaexp.dev
Let your community feel every pump.
Subscribe to my newsletter
Read articles from Aditya Aditya directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
