Telegram Broadcast Bot: Segmented Mailing to Subscribers. Code + Guide

Price in currencies:
14.81 $ · 1050 RUB · 13.49 €
Category:
Others
Item:
broadcast-bot-v1.0.zip (71.9 KB)
Uploaded:
26.11.2026 13:49:27
Sales:
0
Refunds:
0
Seller:
Новинка Супер хит! · about the seller and their products
14.81 $

You will choose the payment method — bank card, cryptocurrency, WebMoney, Alipay, PIX, UPI and others — on the next step. See «Payment methods» for details.

DESCRIPTION

Telegram Broadcast Bot: Segmented Mailing to Subscribers. Code + Guide

An aiogram 3 bot gathers your own subscribers and sends them messages by segment: city and interest. A subscriber presses /start themselves, picks a city and an interest, and can unsubscribe at any time with /stop. The admin writes the broadcast text, picks a segment, sees a preview with the recipient count, and only then sends the broadcast after confirming.

Sending goes in batches with pauses: no more than 1 message per second, a 5-second pause between batches of 20 messages — so the bot does not hit Telegram´s rate limit (error 429). If delivery fails for someone (bot blocked, chat deleted), the error is counted and the broadcast goes on: one failure never kills the whole mailing. Every broadcast´s stats are saved in the database: delivered, errors, total recipients. An empty segment yields 0 recipients — the broadcast simply does not go out, and that is not an error.

Everything is stored locally in SQLite (broadcast.db): subscribers, their segments and broadcast history. No external services besides Telegram itself are needed. The bot uses long polling: no open ports or domain are required, just outgoing internet access.

Setup is one-time: create a bot with @BotFather, find your Telegram ID with @userinfobot, enter the token and the admin list in config.json and run ./run.sh. For permanent work on a VPS the guide includes a ready systemd unit: the bot starts itself on server boot and restarts on failure.

WHAT´S INSIDE THE ARCHIVE
• bot.py — aiogram 3 bot: subscribe (/start, city → interest), unsubscribe (/stop), admin broadcast (/broadcast: draft → segment → preview → send), stats (/stats)
• broadcast.py — logic without Telegram: subscriptions, segments, drafts, batches, rate limiting, SQLite storage, stats, config validation
• config.example.json — sample settings: token, admins, segments, send pauses, database path
• requirements.txt — aiogram dependency, run.sh — one-command launcher
• broadcast-bot.service — systemd unit for autostart on a VPS
• test_broadcast_bot.py — automated logic tests on fake data
• README.md and PDF — full guide: BotFather, token, subscribing, first broadcast, systemd, Telegram limits

GUIDE STEPS
1. Create a bot with @BotFather, save the token.
2. Find your Telegram ID with @userinfobot — that´s ADMIN_IDS.
3. config.example.json → config.json: token, admins, segments.
4. ./run.sh — install aiogram and launch the bot.
5. Subscription check: /start, pick a city and an interest; /stop.
6. First broadcast: /broadcast → text → segment → preview → «Send».
7. Stats: /stats — subscribers by segment and broadcast history.

WHAT YOU NEED
Python 3.10+ on a computer or VPS, a bot token from BotFather (free, 5 minutes) and the Telegram IDs of the admins. 15 minutes for the first setup.

HONEST LIMITS
Broadcasts go only to your own subscribers — people who pressed /start themselves and did not unsubscribe. Telegram does not let a bot message someone who never wrote to it: a bot cannot write first. Spam to other people´s databases is impossible and banned by Telegram´s rules — mass mailing to strangers gets the bot blocked. There is no contact-list import in the bot: segments are set only at subscribe time (city and interest). One message is at most 4096 characters: the bot does not split long text itself, shorten it before sending. Telegram limits how fast a bot may send (about 1 message per second): that is why the 1-second and 5-second batch pauses are built into the bot. The bot does not check whether a message was read: stats are only «delivered / send error». Never forward your bot token to anyone: it is the key to your bot, like a password.

IMPORTANT
These are files and a guide for self-setup — not a done-for-you installation. If you need the bot installed on your server turnkey, that´s a separate service.

SIMILAR PRODUCTS
• Telegram Support Bot with Tickets and Statuses: https://plati.market/itm/telegram-support-bot-with-tickets-and-statuses-code-guide/6447103
• Telegram Poll Bot: Surveys and Voting (aiogram): https://plati.market/itm/telegram-poll-bot-surveys-and-voting-aiogram-code-guide/6443870
• n8n: Auto-posting to Telegram from Google Sheets: https://plati.market/itm/n8n-auto-posting-to-telegram-from-google-sheets-workflow-guide/6443865
• Auto-posting from RSS to VK and Telegram: pure Python script: https://plati.market/itm/auto-posting-from-rss-to-vk-and-telegram-pure-python-script-code-guide/6429340
• Telegram Bot on VPS with systemd: autostart, restart, logs: https://plati.market/itm/telegram-bot-on-vps-with-systemd-autostart-restart-logs-templates-guide/6410458
• Telegram Channel Auto-Backup: Export Posts and Media to Archive: https://plati.market/itm/telegram-channel-auto-backup-export-posts-and-media-to-archive-script-guide/6443878

REVIEWS

Reviews: (0)

No customer reviews yet.

More in «Others»

All items in «Others» →