Bac Bo Telegram bot: build one with Python, step by step
A complete tutorial for building a Bac Bo Telegram bot: BotFather, live results from the API, messages that never repeat, Discord, and where to host it 24/7.
Published on October 18, 2026 · updated on October 31, 2026 · 5 min read
A Bac Bo Telegram bot that posts every result to your group is one of the most common requests on freelance sites, and the hard part was never Telegram. The hard part is getting the results reliably, because a scraper dies when the casino session expires, the layout changes or the IP gets blocked. In this tutorial you build the whole bot in Python, with the results coming from the Bac Bo Live API, and by the end it runs 24/7 without you touching it.
What you will need
- Python 3.10 or newer and the requests library (
pip install requests). - A Telegram account and a group or channel for the bot to post in.
- A Bac Bo Live API key, which you get from the free 2-hour trial after confirming your email.
Step 1: create the bot in BotFather
- On Telegram, open a chat with @BotFather and send
/newbot. - Choose the name that shows up in the group, then a username ending in
bot. - BotFather replies with the bot's token, a string like
123456:ABC.... Keep that token as you would a password. - Add the bot to your group or channel. In a channel, it needs to be an administrator to post.
Step 2: find the group's chat_id
Send any message in the group after adding the bot and open https://api.telegram.org/botYOUR_TOKEN/getUpdates in your browser. In the response, look for "chat":{"id": and note the number, which in groups starts with -100. That is the chat_id the bot will send messages to.
Step 3: fetch the latest round
The /latest endpoint returns the most recent round. Every round has a fixed id, and that is what stops you sending the same message twice: the bot only posts when the id changes.
import requests
API = "https://api.lynxmetrics.com/v1/bacbo-live"
def latest_round(key):
r = requests.get(API + "/latest", headers={"x-api-key": key}, timeout=10)
r.raise_for_status()
return r.json()["data"]Step 4: the complete bot
Save it as bot.py. The keys live in environment variables, never in the code, so they do not leak if you publish the project on GitHub.
bot.py
import os
import time
import requests
API = "https://api.lynxmetrics.com/v1/bacbo-live"
LYNX_KEY = os.environ["LYNX_KEY"]
TELEGRAM_TOKEN = os.environ["TELEGRAM_TOKEN"]
CHAT_ID = os.environ["CHAT_ID"]
NAMES = {"player": "🔵 Player", "banker": "🔴 Banker", "tie": "🟡 Tie"}
def latest_round():
r = requests.get(API + "/latest", headers={"x-api-key": LYNX_KEY}, timeout=10)
if r.status_code == 429:
time.sleep(int(r.headers.get("Retry-After", "5")))
return None
r.raise_for_status()
return r.json()["data"]
def message(round_):
d = round_["data"]
text = NAMES[round_["outcome"]]
if d["multiplier"]:
text += " " + str(d["multiplier"]) + "x"
score = "P " + str(d["player"]["score"]) + " x " + str(d["banker"]["score"]) + " B"
dice = str(d["player"]["dice"]) + " " + str(d["banker"]["dice"])
return text + " | " + score + " | " + dice
def send(text):
requests.post(
"https://api.telegram.org/bot" + TELEGRAM_TOKEN + "/sendMessage",
json={"chat_id": CHAT_ID, "text": text},
timeout=10,
)
last_id = None
while True:
try:
round_ = latest_round()
if round_ and round_["id"] != last_id:
if last_id is not None:
send(message(round_))
last_id = round_["id"]
except requests.RequestException as error:
print("Temporary failure:", error)
time.sleep(3)Note three details. The bot does not post the round that already existed when it started, only new ones. It respects Retry-After if it goes over the per-minute limit. And a network error does not kill the program, which simply waits and tries again.
To run it on your computer:
export LYNX_KEY="sk-lynx..." export TELEGRAM_TOKEN="123456:ABC..." export CHAT_ID="-100..." python bot.py
On Windows, swap export for set in Command Prompt.
How many requests the bot spends
Polling every 3 seconds, the bot makes 20 requests a minute, well below the Pro plan's 60. A round takes about 34 seconds, so it sees each result a few seconds after the dice settle. To save more, send the previous response's ETag in If-None-Match and the API returns 304 with no body while there is no new round.
A lighter path: the stream
This bot asks; the API can also tell. GET /bacbo-live/stream keeps a connection open and sends every round the moment it is stored, spending one request on opening instead of 20 a minute. It also brings two things polling does not have: the optional heads-up (?phases=1) that the table started resolving the round, about 8 seconds before the result, and automatic recovery of whatever closed while the bot was down.
The switch is worth it if your bot runs in an always-on process. The walkthrough is in Bac Bo results in real time, and the same bot already written on top of the stream is in a Lightning Baccarat Telegram bot — you only swap the API slug and the message format. In a serverless function or a cron job, stick with the polling in this article.
What about Discord?
On Discord the shortest path is a webhook. In the channel settings, open Integrations, create a webhook and copy the URL. Then swap the send function for this one:
def send(text):
requests.post(os.environ["DISCORD_WEBHOOK"], json={"content": text}, timeout=10)The rest of the bot stays the same, and you can post to both places at once.
Going beyond the round result
With the same bot you can send an hourly summary using /stats, which returns the counts and percentages for Player, Banker and Tie plus the current streak. You can also announce when a 25x or 88x tie comes up, or when a streak passes a length you choose. The ideas for a well-run group are in a Bac Bo signal group.
Where to host the bot 24/7
The bot is a process that stays on all the time, so it needs somewhere that does not sleep. The most used options in Brazil are bot hosts such as Discloud and SquareCloud, which run a Python project from a configuration file, or a simple VPS at any provider. In all of them, the keys go in the host panel's environment variables, never inside the code.
Since the bot only makes HTTP requests, it runs fine on the smallest plan anywhere, and it needs no browser, Selenium or Chromedriver — which are exactly what weighs the most and breaks the most in a scraping-based bot. The full comparison is in scraper or API for Bac Bo.
Frequently asked questions
- Do I need to know how to code to build a Bac Bo bot?
It helps, but the bot in this tutorial is just over 40 lines and works by copying, pasting and swapping the three keys. The part that usually causes trouble, getting the results, is handled by the API.
- Can the bot send entry signals?
The bot sends whatever you program. LynxMetrics delivers results and statistics, not predictions, because every round is random. Sending results, scores and statistics is honest, while promising accuracy is not.
- How much does it cost to keep the bot running?
The Bac Bo Live API's Pro plan costs R$ 21.90 a month, and hosting a simple Python bot fits in the cheapest plan at the bot hosts.
For adults 18 and over only. LynxMetrics is not affiliated with Evolution or with the casinos that offer Bac Bo Live, and it only sells data and stats, never predictions or betting tips, because every round is random and past results do not predict the next one.
Read also
- Bac Bo API: live results in JSON, with a free trial
How to use the Bac Bo results API: what each round contains, examples in Python and Node, the stream, history, pricing and a free 2-hour trial.
- Bac Bo history: LynxMetrics and CasinoScores compared
We compared 72 hours of Bac Bo Live between LynxMetrics and the public CasinoScores list on 18/10/2026, with the original files for you to check.
- How Bac Bo works: rules, payouts and the 88x tie
The rules of Bac Bo Live explained: the four dice, Player, Banker and tie, what each bet pays, and how often each tie actually came up.