Skip to main content

brizahub — Python SDK of Briza Hub: force-sub that pays

PyPI Python versions Docs Support MIT License

brizahub

Earn from your Telegram bot's force-sub (mandatory subscription) block. Briza Hub fills it with paying sponsors — channels and bots from advertisers all over the world — and pays you in USDT for every subscriber who stays.

pip install brizahub              # aiohttp only
pip install "brizahub[aiogram]"   # with the aiogram 3 middleware

Key: @BrizaHubBot → Sell traffic → Connect a bot.

from brizahub import Briza

briza = Briza("your_key_here", smart_links=True)    # smart links: more advertisers, more earnings

if not await briza.check(message.from_user):        # Briza has shown the sponsors as your bot
    return

Three methods

Method What it does Returns
check(user) Briza checks the user and, if needed, shows the force-sub block as your bot True — let the user in, False — the block is shown, stop
get_sponsors(user) sponsors for your own block list[Sponsor]; [] — let the user in
check_sponsors(user) after «Check» under your block: who is not joined yet list[Sponsor]; [] — let the user in

None of them ever raises or makes the user wait because of Briza: no key, an outage or a timeout — the user is let in.

Turnkey: check

from brizahub import Briza

briza = Briza("your_key_here", smart_links=True)    # or the BRIZA_KEY environment variable

async def on_message(message):
    if not await briza.check(message.from_user):    # False — Briza has shown the block as your bot
        return
    ...

check also takes just the id — await briza.check(user_id) — or the message / button press itself. With the id alone we don't know the user's language and Premium: Briza guesses the language, and Premium-only orders (they pay more) come less often — so pass message.from_user when you have it.

Needs your bot token in @BrizaHubBot: with it we only send, update and delete our block message and read public profiles — never getUpdates or setWebhook, your updates stay yours. The block updates live: a joined sponsor disappears from it, and when none are left the block is deleted.

Your design

Write the block text in Telegram — bold, links, quotes, premium emoji — send it to your bot once and keep it:

from brizahub import message_from

design = message_from(msg, button_join="Join", button_icon="5368324170671202286", button_style="success")
# a plain dict: store it as JSON, then
await briza.check(message.from_user, message=design)

Or by hand: message={"text": '<tg-emoji emoji-id="5368324170671202286">⭐</tg-emoji> <b>$name</b>, join our sponsors', "rows": 2}.

Key
text up to 4096: HTML by default, parse_mode="MarkdownV2", or entities (what message_from gives); $name — the user's first name
rows sponsor buttons per row, 1–3
button_join, or per type button_channel / button_bot / button_url button labels, up to 64 (a folder takes button_channel, a mini app — button_url)
button_icon, or per type button_channel_icon / button_bot_icon / button_url_icon premium-emoji icon on the buttons (custom emoji id)
button_style primary, success or danger

Premium emoji in the text and on the buttons show if your bot's owner has Telegram Premium (Telegram's rule). If Telegram refuses the block, Briza sends it with regular emoji, then as plain text — users never see raw tags.

aiogram 3 — every handler at once (optional, instead of check in each handler):

from brizahub.aiogram import BrizaMiddleware

dp.message.middleware(BrizaMiddleware(briza))
dp.callback_query.middleware(BrizaMiddleware(briza))
dp.shutdown.register(briza.close)

Groups are skipped (private_only=False — check them too, the block goes to the group); let admins through with skip=lambda event, data: data["event_from_user"].id in ADMINS; your design — BrizaMiddleware(briza, message=design).

Your own block: get_sponsors + check_sponsors

For bots without a token, a custom design, or a block that mixes sponsors from several sources.

from aiogram.types import InlineKeyboardButton as Button, InlineKeyboardMarkup as Markup

# smart links and mini apps: more advertisers, more earnings
briza = Briza("your_key_here", smart_links=True, mini_apps=True)

def block(sponsors):
    # a visit may go to another offer for this device — label it generically, not with the site's name
    rows = [[Button(text="🎁 Offer" if s.type == "link" else s.title or "Subscribe", url=s.link)]
            for s in sponsors]
    rows.append([Button(text="✅ Check", callback_data="briza_check")])
    return Markup(inline_keyboard=rows)

async def on_message(message):
    photos = await message.bot.get_user_profile_photos(message.from_user.id, limit=1)
    sponsors = await briza.get_sponsors(message.from_user, has_photo=photos.total_count > 0)   # «photo only» pay more
    if sponsors:
        await message.answer("Join our sponsors to use the bot:", reply_markup=block(sponsors))
        return
    ...                                             # let the user in

async def on_check(call):                           # callback_data == "briza_check"
    left = await briza.check_sponsors(call.from_user)
    if left:
        await call.message.edit_reply_markup(reply_markup=block(left))
        await call.answer("Join all sponsors first", show_alert=True)
        return
    await call.message.delete()                     # done — let the user in

check_sponsors takes the user's current sponsors from Briza itself, so you store nothing; pass the list you showed (check_sponsors(user, sponsors)) to save a call. Subscriptions through our links are counted even without «Check» — the next get_sponsors returns only what is left.

What you pass

Pass the Telegram user object (aiogram, python-telegram-bot, Pyrogram), the message or button press it came with, or just the id — the package takes what it needs. Values passed by hand win over the object. Something without a user id (a mistake) lets the user in and is reported by the brizahub logger.

From the user object By hand Why
user.id user_id= required
user.language_code language_code= block language, language-targeted orders
user.is_premium is_premium= Premium-only orders pay more
user.first_name first_name= we compare it with Telegram after the subscription
— has_photo= orders for users with a profile photo

Options: limit — sponsors at a time, 1–10 (default — your bot setting in @BrizaHubBot); min_price — only sponsors paying you at least this, USDT; smart_links — True recommended: visit tasks and device-targeted orders pay more; mini_apps (get_sponsors / check_sponsors) — True recommended: mini app tasks too, a link button (check shows them itself). check only: chat_id — where to show the block (default: the private chat), message — your design (a dict or a Telegram message, see above).

What you get: Sponsor

Field
id the same as task_id in webhooks
type channel, group, bot, link (a visit), folder (a chat folder, t.me/addlist/… — show it like a channel) or app (a bot's mini app — a link button)
title text for the button
link URL for the button
price what you earn when the user does it, USDT (Decimal)

Webhooks

from brizahub import verify_webhook

async def briza_hook(request):                      # aiohttp
    body = await request.read()
    if not verify_webhook(WEBHOOK_SECRET, request.headers, body):
        return web.Response(status=401)
    event = json.loads(body)        # event_id, event (task.pending | task.completed | task.left | ping), task_id, user_id
    ...                             # the same event_id may come again — process it once
    return web.Response(text="ok")  # any 2xx within 5 s

Your numbers

await briza.me() — your bot and today's numbers; await briza.stats(days=7) — per day; await briza.balance() — earnings and payouts (USDT as decimal strings). These raise BrizaError (.status, .error).

When Briza is down

  • every call fits into timeout (3 s); a connection that does not open within 1 s is opened again at once;
  • no answer or an error: the user is let in, then no calls for 5 s; key problems (wrong key, paused bot, no bot token) go to the brizahub logger once a minute;
  • a user who passed check() is let in for 60 s without a call; one kept-alive connection for all calls.
Briza(...) Default
key BRIZA_KEY your API key
base_url BRIZA_API_URL or https://api.brizahub.com change only if we announce a new address
timeout 3.0 seconds for a call
cache_ttl 60.0 seconds a passed user is let in without a call; 0 — always ask
fail_pause 5.0 seconds without calls after Briza did not answer
smart_links API default default for every call
mini_apps API default default for get_sponsors / check_sponsors
session own your aiohttp.ClientSession

Docs (English, Russian, Persian, Arabic) · @BrizaHubBot · @BrizaHub · support @BrizaSupport · MIT License

Metadata

Release files for brizahub 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brizahub 0.1.2
File Size Uploaded Provenance Actions
brizahub-0.1.2.tar.gz 19.7 kB With provenance Details for brizahub-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for brizahub 0.1.2
File Interpreter ABI Platform Actions
brizahub-0.1.2-py3-none-any.whl Python 3 none any Details for brizahub-0.1.2-py3-none-any.whl

Total release size: 38.0 kB

Release files / brizahub-0.1.2.tar.gz

Download URL brizahub-0.1.2.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
edfdcddd632fcee4ee53b295e9e3d33bc5abe9678d189ec08680ce90b1d1305c
BLAKE2b-256 checksum
How to use checksums
ce58740c131c70fd3e760b66578743a42dc487b00f30daf99fcd68fd39e0d92a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / brizahub-0.1.2-py3-none-any.whl

Download URL brizahub-0.1.2-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc36588e6f1a35be7b6f4509218ce2fd99fc874572222785da9253bce9d99982
BLAKE2b-256 checksum
How to use checksums
5014af956ef618365581cc914d8b76e4734942b817503b72036b3a837db4e12d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for brizahub 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for brizahub-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page