Broadcast/newsletter library for aiogram 3.x
Project description
aiogram-broadcast
Broadcast/newsletter library for Telegram bots built with aiogram 3.x.
Features
- Automatic subscriber registration via middleware
- Rate-limited broadcasting to avoid Telegram API limits
- Scheduled broadcasts with APScheduler
- Redis subscriber storage
- Progress callbacks for monitoring
- Interactive UI menu with multi-language support (EN/RU)
Installation
pip install aiogram-broadcast
With scheduled broadcasts and UI:
pip install aiogram-broadcast[all]
Quick Start
from aiogram_broadcast import BroadcastMiddleware, BroadcastService, RedisBroadcastStorage
redis = Redis(host="localhost")
storage = RedisBroadcastStorage(redis)
service = BroadcastService(bot, storage)
# Auto-register subscribers
dp.update.outer_middleware.register(BroadcastMiddleware(storage))
# Broadcast to all
result = await service.broadcast_text("Hello everyone!", parse_mode="HTML")
print(f"{result.successful}/{result.total} sent, {result.success_rate:.0f}%")
See examples/basic.py for a complete runnable bot.
Usage
Broadcasting
# Text, photo, video, document, or copy any message
await service.broadcast_text("Hello!", parse_mode="HTML")
await service.broadcast_photo(photo_file_id, caption="Check this out")
await service.broadcast_copy(from_chat_id=admin_id, message_id=msg_id)
# Custom sender for any message type
await service.broadcast_custom(my_sender_func)
Scheduled Broadcasts
from aiogram_broadcast import BroadcastScheduler
scheduler = BroadcastScheduler(service, AsyncIOScheduler())
task_id = await scheduler.schedule_text("Reminder!", run_date=some_datetime)
await scheduler.cancel(task_id)
See examples/scheduled.py for full setup.
Progress Tracking
async def on_progress(current, total, result):
print(f"{current}/{total} — {result.successful} sent, {result.failed} failed")
await service.broadcast_text("msg", progress_callback=on_progress)
See examples/progress.py.
Interactive UI Menu
A complete FSM-based wizard for composing and scheduling broadcasts from Telegram — supports text/photo/video/document messages, inline URL buttons, and scheduled delivery.
See examples/ui_menu.py.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiogram_broadcast-0.1.1.tar.gz.
File metadata
- Download URL: aiogram_broadcast-0.1.1.tar.gz
- Upload date:
- Size: 32.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f20e3d8718b8d9ba73d804b4621ef4cf468bf7df7dab18ad3a52999795675576
|
|
| MD5 |
155ac44fd076c3169cba6b4dc0990b91
|
|
| BLAKE2b-256 |
d980df85f183fd5d8cfa76064174cf4290b103f4bc7ef74d597c3185dac4d3df
|
Provenance
The following attestation bundles were made for aiogram_broadcast-0.1.1.tar.gz:
Publisher:
publish.yml on DefaultPerson/aiogram-broadcast
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiogram_broadcast-0.1.1.tar.gz -
Subject digest:
f20e3d8718b8d9ba73d804b4621ef4cf468bf7df7dab18ad3a52999795675576 - Sigstore transparency entry: 1081178993
- Sigstore integration time:
-
Permalink:
DefaultPerson/aiogram-broadcast@5516f492cbe3d4df7be9bd84e8d45ac107b83172 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/DefaultPerson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5516f492cbe3d4df7be9bd84e8d45ac107b83172 -
Trigger Event:
release
-
Statement type:
File details
Details for the file aiogram_broadcast-0.1.1-py3-none-any.whl.
File metadata
- Download URL: aiogram_broadcast-0.1.1-py3-none-any.whl
- Upload date:
- Size: 32.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0966cfab8c5737dcfe0bb3316cb3c12a9177c37296ed57a6aae81f6c81584e9a
|
|
| MD5 |
92b6c2e1971bb03c1bbce60d1d65f166
|
|
| BLAKE2b-256 |
d8d89c3f8884344574f2552a61aca2a8e94a33dd1dcf45e88dfc0d629470d925
|
Provenance
The following attestation bundles were made for aiogram_broadcast-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on DefaultPerson/aiogram-broadcast
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiogram_broadcast-0.1.1-py3-none-any.whl -
Subject digest:
0966cfab8c5737dcfe0bb3316cb3c12a9177c37296ed57a6aae81f6c81584e9a - Sigstore transparency entry: 1081179051
- Sigstore integration time:
-
Permalink:
DefaultPerson/aiogram-broadcast@5516f492cbe3d4df7be9bd84e8d45ac107b83172 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/DefaultPerson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5516f492cbe3d4df7be9bd84e8d45ac107b83172 -
Trigger Event:
release
-
Statement type: