Bulk Telegram delivery,
for developers.
Submit one HTTP request with shared parameters and up to 100,000 recipients. TGBulk persists it, then schedules every send under Telegram’s rate limits — with fair multi-bot scheduling, automatic retries, live progress, and signed completion webhooks.
Sending to 1,500 people one by one is a trap
Looping over recipients and awaiting each Telegram call sounds simple — until flood limits, retries, and rate math take over your codebase.
The naive way
- Await every send — one slow chat blocks everyone
- Reinvent rate limiting by hand, chat by chat
- Drop failures silently or write your own retry ladder
- Flood errors need manual retry_after handling
- No visibility into what sent, failed, or is stuck
With TGBulk
- One request, 100k recipients — ack after it’s durable
- Hierarchical rate limiters pace global → bot → chat → group
- Automatic retries with exponential backoff + jitter
- Flood responses park that recipient and resume later
- Live progress, ETA, rate, and paginated results in order
Four moving parts, one system
Submit
POST /bot<token>/sendMessage with shared parameters and an ordered recipients array. It is written to SQLite and acknowledged before a single send happens.
Schedule
A fair weighted scheduler (WDRR) plus hierarchical token buckets — global, per-bot, per-chat, per-group, per-method — decide exactly when each send may go out.
Deliver
Concurrent sends per bot, paced per scope. A flood or transient error triggers backoff and re-queues that recipient only — other chats keep flowing.
Observe
Poll progress with exact counters, rates, and ETA; read results paginated in your original recipient order; get a signed webhook when the job completes.
Paced, retried, observable
Async by design
The request is acknowledged once it’s durable. Delivery keeps running in the background, so a 100k-recipient job never blocks the caller.
Fair multi-bot scheduling
Weighted Deficit Round Robin means N bots sharing the pipe each get a fair slice — no single bot can starve the others.
Retries that behave
Exponential backoff with full jitter. Flood (429) responses honor retry_after and burn no attempts; at-least-once, at-most-once, or method-aware is your choice.
Progress & ETA
Exact counters (queued / in_flight / delayed / succeeded / failed / ambiguous), live rates, percent complete, and an ETA per job.
Stable result ordering
Results come back paginated in your original recipient order — no dedup, no reordering, so reconciliation with your own records stays trivial.
Signed completion webhooks
When a job finishes, a webhook fires with its full summary, HMAC-signed with your shared secret — so downstream systems can trust it without a database query.
Rate limits, layered
Every send must clear each bucket in the hierarchy. The tightest bucket at any moment decides the pace.
| Scope | Default limit | Why it exists |
|---|---|---|
| Global | 20 msg/s default — max 25, burst 50 | Pacing target and hard ceiling across every bot on the process |
| Per bot | your target — max 25/s | Configured per bot via target_msgs_per_sec |
| Per chat | 1 msg/s — burst 2 | Telegram’s practical per-chat pacing |
| Per group | 1 per 3 s | Group chats are far more conservative |
| Per method | generous headroom | Prevents one method type from hogging a bot |
Telegram itself enforces its own per-chat and per-group limits. TGBulk’s buckets are the safe floor: real-world throughput is bounded by how many distinct chats you are sending to, not just the global target. Our lab run against a fast target delivered 1,500 / 1,500 recipients in ~61 seconds at 25 msg/s, 0 failures.
Live in under a minute
Debian 13, x86_64 or arm64. The installer fetches the latest release, verifies its checksum, and configures a hardened service.
1 Install
$ curl -fsSL https://raw.githubusercontent.com/thaqiif/telegram-bot-delivery-enhanced/main/deploy/install.sh | sudo bash
Pin a version: TGBULK_VERSION=v0.2.3 curl -fsSL… | sudo bash
2 Verify it’s up
$ curl -s http://127.0.0.1:8080/healthz ok
Also: /readyz for readiness, /metrics for Prometheus.
3 Set your bot token
# /etc/telegram-bulk-delivery/env BULK_MASTER_KEY=<filled by install — back it up> BULK_API_KEY=your-long-random-key # OPTIONAL, recommended
Bots are registered per token; BULK_API_KEY gates every /bot endpoint.
4 Send your first bulk job
$ curl -s -X POST "http://127.0.0.1:8080/bot$TOKEN/sendMessage" \ -H "Authorization: Bearer $BULK_API_KEY" -H "Content-Type: application/json" \ -d '{"parameters":{"text":"Hello from TGBulk!"}, "recipients":[ {"chat_id":-1008001228039}, {"chat_id":1008001967399,"text":"Personal override"} ] }' # → {"ok":true,"result":{"job_id":"01a06cbb-…","state":"queued","total":2, # "accepted_at_unix":1788670596, # "status_url":"/bot$TOKEN/bulk/jobs/01a06cbb-…"}}
Then poll /bulk/jobs/<id> for progress and /results for outcomes.
Poll progress, read results
Two reads answer everything: is it done, and what happened.
Poll progress
$ curl -s "http://127.0.0.1:8080/bot$TOKEN/bulk/jobs/$JOB_ID" | jq { "state": "running", "total": 1500, "queued": 121, "in_flight": 4, "delayed": 131, "succeeded": 1244, "failed": 0, "ambiguous": 0, "rate": { "instant_per_sec": 24.8, "window_per_sec": 25.1 }, "percent_complete": 84.9, "eta": { "seconds": 14 } }
Read results, in your order
$ curl -s "http://127.0.0.1:8080/bot$TOKEN/bulk/jobs/$JOB_ID/results" | jq { "results": [ { "idx": 0, "status": "succeeded", "telegram_message_id": 5142 }, { "idx": 1, "status": "succeeded", "telegram_message_id": 5143 } ], "next_cursor": "…" }
Private by default, hardened by design
Tokens encrypted at rest
Bot tokens are stored encrypted with a local master key; losing the key means re-registering bots — so it’s backed up on install.
API-key gated
Every /bot endpoint requires BULK_API_KEY (Bearer or X-TGBulk-Key), so only your systems can submit jobs.
SSRF-guarded outbound
Custom Telegram API bases must explicitly opt into private targets (allow_private_targets, default false).
Hardened systemd unit
NoNewPrivileges, ProtectSystem=strict, private /tmp, dedicated unprivileged user — a locked-down default install.
Questions, answered
Can it really deliver 1,500 recipients in a minute?
How do I avoid hitting Telegram’s flood limits?
Which methods can I send in bulk?
Can I use a Telegram test token?
Where does my data live?
How is this different from using the Telegram Bot API directly?
Ship your next campaign the boring way.
One command installs it. One request sends them all. Your recipients won’t know the difference — your infra will.