Open source · Built in Rust

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.

20 msg/sdefault pacing · configurable to 25 msg/s
100krecipients in a single job
<1 minfrom curl to first delivery
0runtime dependencies on Debian
deploy
$ curl -fsSL https://raw.githubusercontent.com/thaqiif/telegram-bot-delivery-enhanced/main/deploy/install.sh | sudo bash >> resolving latest release … v0.2.3 >> downloading telegram-bulk-delivery-0.2.3-linux-aarch64 >> verifying sha256 … OK >> installed /usr/local/bin/telegram-bulk-delivery >> service active · /healthz → ok $ curl -s http://127.0.0.1:8080/healthz ok
The problem

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
How it works

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.

Features

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.

Under the hood

Rate limits, layered

Every send must clear each bucket in the hierarchy. The tightest bucket at any moment decides the pace.

ScopeDefault limitWhy it exists
Global20 msg/s default — max 25, burst 50Pacing target and hard ceiling across every bot on the process
Per botyour target — max 25/sConfigured per bot via target_msgs_per_sec
Per chat1 msg/s — burst 2Telegram’s practical per-chat pacing
Per group1 per 3 sGroup chats are far more conservative
Per methodgenerous headroomPrevents 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.

Quick start

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.

API

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": "…"
}
Security & operations

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.

FAQ

Questions, answered

Can it really deliver 1,500 recipients in a minute?
With a target that keeps up — yes. In our lab run against a fast local Telegram target we delivered 1,500 / 1,500 messages in ~61 seconds at 25 msg/s with zero failures. Against production Telegram, the per-chat (≈1 msg/s) and per-group (≈1 per 3 s) limits dominate, so real wall-clock throughput depends mostly on how many distinct chats and groups you are sending to — 1,500 users in 1,500 chats may take much longer than a minute. That is Telegram’s rule, not the service’s.
How do I avoid hitting Telegram’s flood limits?
TGBulk already paces below the common ceilings (≤25 msg/s global, 1/s per chat, 1/3 s per group) and honors retry_after on 429 responses. Keep target_msgs_per_sec at or below 20 unless Telegram has explicitly raised your bot’s limits.
Which methods can I send in bulk?
Any committed bulk-capable method: sendMessage, sendPhoto, sendMediaGroup, sendDocument, sendVideo and friends (multipart for media). Non-bulk methods like answerInlineQuery are rejected up front with a clear error.
Can I use a Telegram test token?
Yes. Test tokens only work at https://api.telegram.org/bot<token>/test/…, so set the bot’s telegram_api_base to https://api.telegram.org/bot{token}/test — no proxy needed.
Where does my data live?
On your own server, in a local SQLite database under /var/lib/telegram-bulk-delivery. No telemetry, no cloud, no third-party callbacks unless you configure a completion webhook.
How is this different from using the Telegram Bot API directly?
The Bot API has no bulk or fan-out endpoint — you loop. TGBulk turns the loop into a service: durable queueing, hierarchical rate limiting tuned for real-world flood behavior, retries with proper backoff, progress/ETA, stable result ordering, and signed completion webhooks, all behind one REST API.

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.