Briza Hub API for bot owners
Sell the spots in your bot's force-sub block: Briza Hub supplies advertisers' channels and pays for every subscriber.
How you earn
- Your share is 85% of the task price. Prices depend on the order; at the base price it's 0.01955 USDT per subscriber.
- A verified subscription is paid once the person has stayed 24 hours.
- Payouts — in @BrizaHubBot → Sell traffic, from 3 USDT, within 24 hours.
- Traffic from any country, in any language.
- Tasks without check, join requests, bot starts and clicks are paid at once.
- @CryptoBot and @xRocket — no fee; to a USDT wallet (TRC-20, BEP-20, TON) — soon.
- Fake traffic means a ban and frozen payouts.
- The advertiser paused or deleted the order, changed the channel or removed our bot — tasks given out before that still count.
Quickstart
Python in 2 minutes, other languages in 5
Your bot gets tasks for a user from Briza, shows them as buttons and checks the subscription.
Step 1 · Get your key
@BrizaHubBot → Sell traffic → Connect a bot → With a token. After review (usually within a day) the bot sends an API key — put it in place of your_key_here.
Step 2 · Python: install the package faster
Requests, timeouts and errors are handled inside: no answer in 3 s or a failure — the user goes through.
pip install brizahub
pip install "brizahub[aiogram]" # + middleware for aiogram 3Step 3 · One line in your handler
- Turnkey —
check: Briza shows the block as your bot (needs its token). - Your own block —
get_sponsorsandcheck_sponsors: you draw the buttons, no token needed. - aiogram — middleware: the check runs before every handler at once.
from brizahub import Briza
# your key from @BrizaHubBot; smart_links — more advertisers: device-targeted orders and visits
briza = Briza("your_key_here", smart_links=True)
@dp.message()
async def work(message: Message) -> None:
if not await briza.check(message.from_user): # False — Briza has shown the sponsors as your bot
return
await message.answer("⏳ Downloading…") # your bot's real workfrom brizahub import Briza
# your key from @BrizaHubBot; smart_links and mini_apps — more advertisers: device-targeted orders, visits, mini apps
briza = Briza("your_key_here", smart_links=True, mini_apps=True)
def block(sponsors) -> InlineKeyboardMarkup:
# a visit may go to another offer for this device — label it generically, not with the site's name
rows = [[InlineKeyboardButton(text="🎁 Offer" if s.type == "link" else s.title or "Subscribe", url=s.link)]
for s in sponsors]
rows.append([InlineKeyboardButton(text="✅ Check", callback_data="briza:check")])
return InlineKeyboardMarkup(inline_keyboard=rows)
@dp.message()
async def work(message: Message) -> None:
photos = await message.bot.get_user_profile_photos(message.from_user.id, limit=1) # «photo only» pay more
sponsors = await briza.get_sponsors(message.from_user, has_photo=photos.total_count > 0)
if sponsors: # [] — let the user in
await message.answer("Join our sponsors to use the bot:", reply_markup=block(sponsors))
return
await message.answer("⏳ Downloading…")
@dp.callback_query(F.data == "briza:check")
async def check(call: CallbackQuery) -> None:
if await briza.check_sponsors(call.from_user): # not joined yet
await call.answer("Please join all the channels first", show_alert=True)
return
await call.message.edit_text("✅ Thank you! Now send me a link.")from brizahub import Briza
from brizahub.aiogram import BrizaMiddleware
# your key from @BrizaHubBot; smart_links — more advertisers: device-targeted orders and visits
briza = Briza("your_key_here", smart_links=True)
dp.message.middleware(BrizaMiddleware(briza)) # the check runs before every handler
dp.callback_query.middleware(BrizaMiddleware(briza))
dp.shutdown.register(briza.close)Done. Your own block design and every parameter — in the package description.
Other languages: HTTP API
Without the package — two API requests in any language.
Address: https://api.brizahub.com. Key: Authorization: Bearer ….
1 · First request: tasks for a user
When a user messages your bot, request tasks for them:
# user_id, language_code, is_premium, first_name — from the Telegram user; has_photo — getUserProfilePhotos
curl -s -X POST "https://api.brizahub.com/v1/tasks" \
-H "Authorization: Bearer your_key_here" \
-H "Content-Type: application/json" \
-d '{
"user_id": 123456789,
"language_code": "fa",
"is_premium": false,
"has_photo": true,
"first_name": "Ali",
"smart_links": true,
"mini_apps": true
}'import aiohttp
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
HEADERS = {"Authorization": f"Bearer {BRIZA_KEY}"}
# user — message.from_user; has_photo — getUserProfilePhotos(user.id).total_count > 0
async def briza_tasks(user, has_photo: bool) -> dict:
async with aiohttp.ClientSession() as s:
async with s.post("https://api.brizahub.com/v1/tasks", headers=HEADERS, json={
"user_id": user.id,
"language_code": user.language_code,
"is_premium": bool(user.is_premium),
"has_photo": has_photo,
"first_name": user.first_name,
"smart_links": True,
"mini_apps": True,
}) as r:
return await r.json()const BRIZA_KEY = "your_key_here"; // your key from @BrizaHubBot
// user — ctx.from; hasPhoto — getUserProfilePhotos(user.id).total_count > 0
async function brizaTasks(user, hasPhoto) {
const r = await fetch("https://api.brizahub.com/v1/tasks", {
method: "POST",
headers: { Authorization: `Bearer ${BRIZA_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
user_id: user.id,
language_code: user.language_code,
is_premium: !!user.is_premium,
has_photo: hasPhoto,
first_name: user.first_name,
smart_links: true,
mini_apps: true,
}),
});
return r.json();
}<?php
const BRIZA_KEY = 'your_key_here'; // your key from @BrizaHubBot
// $user — $update['message']['from']; $hasPhoto — getUserProfilePhotos: total_count > 0
function briza_tasks(array $user, bool $hasPhoto): ?array {
$ch = curl_init('https://api.brizahub.com/v1/tasks');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . BRIZA_KEY, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'user_id' => $user['id'],
'language_code' => $user['language_code'] ?? null,
'is_premium' => !empty($user['is_premium']),
'has_photo' => $hasPhoto,
'first_name' => $user['first_name'],
'smart_links' => true,
'mini_apps' => true,
]),
CURLOPT_RETURNTRANSFER => true,
]);
return json_decode(curl_exec($ch), true);
}{
"ok": true,
"tasks": [
{
"task_id": "t_Qx3kW2",
"type": "channel",
"link": "https://t.me/+AbCdEf",
"title": "Persian News",
"price": "0.01955",
"photo": "https://api.brizahub.com/photo/3f9c2a1b7d4e8f0a6c5b.jpg"
}
]
}2 · Handle the answer
It all comes down to the tasks list:
| Briza's answer | Your bot |
|---|---|
tasks is empty | Let the user through. "suspicious": true — the user is flagged by our anti-fraud; what to do with them in your bot is up to you. |
tasks has tasks | Buttons with link plus “Check” → POST /v1/tasks/check. Hold while any task is incomplete. |
| an error, or no answer within 3 seconds | Let the user through. |
A minimal handler:
import aiohttp
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
BRIZA = "https://api.brizahub.com"
HEADERS = {"Authorization": f"Bearer {BRIZA_KEY}"}
TIMEOUT = aiohttp.ClientTimeout(total=3)
async def briza(path: str, payload: dict) -> dict:
"""{} if Briza did not answer — let the user in."""
try:
async with aiohttp.ClientSession(timeout=TIMEOUT) as s:
async with s.post(BRIZA + path, json=payload, headers=HEADERS) as r:
return await r.json() if r.status == 200 else {}
except (aiohttp.ClientError, TimeoutError):
return {}
async def sponsors(user, has_photo: bool | None = None) -> list[dict]:
"""user — message.from_user; has_photo — getUserProfilePhotos(user.id).total_count > 0. Empty — let the user in."""
return (await briza("/v1/tasks", {
"user_id": user.id,
"language_code": user.language_code,
"is_premium": bool(user.is_premium),
"first_name": user.first_name,
"has_photo": has_photo, # «photo only» orders pay more
"smart_links": True, # more advertisers: device-targeted orders and visits
"mini_apps": True, # mini app tasks too
})).get("tasks", [])
async def must_hold(user_id: int, task_ids: list[str]) -> bool:
"""«Check» pressed. True — hold the user."""
answer = await briza("/v1/tasks/check", {"user_id": user_id, "task_ids": task_ids})
return any(x["status"] == "incomplete" for x in answer.get("results", []))const BRIZA_KEY = "your_key_here"; // your key from @BrizaHubBot
const BRIZA = "https://api.brizahub.com";
const HEADERS = { Authorization: `Bearer ${BRIZA_KEY}`, "Content-Type": "application/json" };
// {} if Briza did not answer — let the user in
async function briza(path, payload) {
try {
const r = await fetch(BRIZA + path, {
method: "POST", headers: HEADERS, body: JSON.stringify(payload), signal: AbortSignal.timeout(3000),
});
return r.ok ? await r.json() : {};
} catch {
return {};
}
}
// user — ctx.from; hasPhoto — getUserProfilePhotos(user.id).total_count > 0. Empty — let the user in
export async function sponsors(user, hasPhoto) {
return (await briza("/v1/tasks", {
user_id: user.id,
language_code: user.language_code,
is_premium: !!user.is_premium,
first_name: user.first_name,
has_photo: hasPhoto, // «photo only» orders pay more
smart_links: true, // more advertisers: device-targeted orders and visits
mini_apps: true, // mini app tasks too
})).tasks ?? [];
}
// «Check» pressed. true — hold the user
export async function mustHold(userId, taskIds) {
const answer = await briza("/v1/tasks/check", { user_id: userId, task_ids: taskIds });
return (answer.results ?? []).some((x) => x.status === "incomplete");
}<?php
const BRIZA_KEY = 'your_key_here'; // your key from @BrizaHubBot
// [] if Briza did not answer — let the user in
function briza(string $path, array $payload): array {
$ch = curl_init('https://api.brizahub.com' . $path);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . BRIZA_KEY, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 3,
]);
$body = curl_exec($ch);
$ok = $body !== false && curl_getinfo($ch, CURLINFO_RESPONSE_CODE) === 200;
curl_close($ch);
return $ok ? (json_decode($body, true) ?? []) : [];
}
// $user — $update['message']['from']; $hasPhoto — getUserProfilePhotos total_count > 0. Empty — let the user in
function sponsors(array $user, ?bool $hasPhoto = null): array {
return briza('/v1/tasks', [
'user_id' => $user['id'],
'language_code' => $user['language_code'] ?? null,
'is_premium' => !empty($user['is_premium']),
'first_name' => $user['first_name'],
'has_photo' => $hasPhoto, // «photo only» orders pay more
'smart_links' => true, // more advertisers: device-targeted orders and visits
'mini_apps' => true, // mini app tasks too
])['tasks'] ?? [];
}
// «Check» pressed. true — hold the user
function must_hold(int $userId, array $taskIds): bool {
$answer = briza('/v1/tasks/check', ['user_id' => $userId, 'task_ids' => $taskIds]);
foreach ($answer['results'] ?? [] as $x) {
if ($x['status'] === 'incomplete') return true;
}
return false;
}Next: the reference and a full bot.
Or turnkey: Briza shows the force-sub block, you keep one line — if not await briza_check(user): return.
No code? Take a smart link instead: @BrizaHubBot → Sell traffic → Connect a bot → No code. Put it in your force-sub or menu — we show the tasks and check the subscriptions ourselves.
Turnkey: Briza shows the force-sub block
One line in your handlers: if not await briza.check(message.from_user): return.
- You send your bot token when connecting; your bot's updates stay with you.
skip: true— let through,false— block shown, hold. No answer within 3 s — let through: the block won't come later.- No “Check” button: once the user subscribes, the button leaves the block by itself; when they write to your bot again, call
/v1/check: we let them through or show what's left. - Custom look —
message.
Full bot:
# pip install "brizahub[aiogram]" — Briza Hub turnkey
import asyncio
from aiogram import Bot, Dispatcher
from aiogram.filters import CommandStart
from aiogram.types import Message
from brizahub import Briza
from brizahub.aiogram import BrizaMiddleware
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
BOT_TOKEN = "your_bot_token_here" # your bot's token from @BotFather
bot = Bot(BOT_TOKEN)
dp = Dispatcher()
briza = Briza(BRIZA_KEY, smart_links=True) # more advertisers: device-targeted orders and visits
dp.message.middleware(BrizaMiddleware(briza)) # force-sub before every handler
dp.callback_query.middleware(BrizaMiddleware(briza))
dp.shutdown.register(briza.close)
@dp.message(CommandStart())
async def start(message: Message) -> None:
await message.answer("Hi! Send me a link and I will download the video.")
@dp.message()
async def work(message: Message) -> None:
await message.answer("⏳ Downloading…") # your bot's real work
if __name__ == "__main__":
asyncio.run(dp.start_polling(bot))# pip install aiogram aiohttp — Briza Hub turnkey
import asyncio
import aiohttp
from aiogram import Bot, Dispatcher
from aiogram.filters import CommandStart
from aiogram.types import Message, User
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
BOT_TOKEN = "your_bot_token_here" # your bot's token from @BotFather
bot = Bot(BOT_TOKEN)
dp = Dispatcher()
photos: dict[int, bool] = {} # user_id → has a profile photo (asked once per user)
async def has_photo(user_id: int) -> bool | None:
"""«Photo only» orders pay more. None — unknown, not sent."""
if user_id not in photos:
try:
photos[user_id] = (await bot.get_user_profile_photos(user_id, limit=1)).total_count > 0
except Exception:
return None
return photos[user_id]
async def briza_check(user: User) -> bool:
"""True — let the user in. False — block shown, stop."""
payload = {
"user_id": user.id,
"language_code": user.language_code,
"is_premium": bool(user.is_premium),
"first_name": user.first_name,
"has_photo": await has_photo(user.id),
"smart_links": True, # more advertisers: device-targeted orders and visits
}
try:
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=3)) as s:
async with s.post("https://api.brizahub.com/v1/check", json=payload,
headers={"Authorization": f"Bearer {BRIZA_KEY}"}) as r:
return (await r.json()).get("skip", True) if r.status == 200 else True
except (aiohttp.ClientError, TimeoutError):
return True # Briza did not answer: never hold the user
@dp.message(CommandStart())
async def start(message: Message) -> None:
# use it wherever the check is needed
if not await briza_check(message.from_user):
return
await message.answer("Hi! Send me a link and I will download the video.")
@dp.message()
async def work(message: Message) -> None:
if not await briza_check(message.from_user):
return
await message.answer("⏳ Downloading…") # your bot's real work
async def main() -> None:
await dp.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())// npm i grammy — Briza Hub turnkey (Node.js 18+)
import { Bot } from "grammy";
const BRIZA_KEY = "your_key_here"; // your key from @BrizaHubBot
const BOT_TOKEN = "your_bot_token_here"; // your bot's token from @BotFather
const bot = new Bot(BOT_TOKEN);
const photos = new Map(); // userId → has a profile photo (asked once per user)
// «Photo only» orders pay more; undefined — unknown, not sent
async function hasPhoto(userId) {
if (!photos.has(userId)) {
try {
photos.set(userId, (await bot.api.getUserProfilePhotos(userId, { limit: 1 })).total_count > 0);
} catch {
return undefined;
}
}
return photos.get(userId);
}
// true — let the user in; false — block shown, stop
async function brizaCheck(user) {
const payload = {
user_id: user.id,
language_code: user.language_code,
is_premium: !!user.is_premium,
first_name: user.first_name,
has_photo: await hasPhoto(user.id),
smart_links: true, // more advertisers: device-targeted orders and visits
};
try {
const r = await fetch("https://api.brizahub.com/v1/check", {
method: "POST",
headers: { Authorization: `Bearer ${BRIZA_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify(payload),
signal: AbortSignal.timeout(3000),
});
return r.ok ? (await r.json()).skip !== false : true;
} catch {
return true; // Briza did not answer: never hold the user
}
}
bot.command("start", async (ctx) => {
// use it wherever the check is needed
if (!(await brizaCheck(ctx.from))) return;
await ctx.reply("Hi! Send me a link and I will download the video.");
});
bot.on("message", async (ctx) => {
if (!(await brizaCheck(ctx.from))) return;
await ctx.reply("⏳ Downloading…"); // your bot's real work
});
bot.start();<?php
// A Telegram bot on a webhook, no libraries — Briza Hub turnkey
const BRIZA_KEY = 'your_key_here'; // your key from @BrizaHubBot
const BOT_TOKEN = 'your_bot_token_here'; // your bot's token from @BotFather
// true — let the user in; false — block shown, stop
function briza_check(array $user): bool {
$payload = [
'user_id' => $user['id'],
'language_code' => $user['language_code'] ?? null,
'is_premium' => !empty($user['is_premium']),
'first_name' => $user['first_name'],
'has_photo' => has_photo($user['id']),
'smart_links' => true, // more advertisers: device-targeted orders and visits
];
$ch = curl_init('https://api.brizahub.com/v1/check');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . BRIZA_KEY, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 3,
]);
$body = curl_exec($ch);
$ok = $body !== false && curl_getinfo($ch, CURLINFO_RESPONSE_CODE) === 200;
curl_close($ch);
if (!$ok) return true; // Briza did not answer: never hold the user
return (json_decode($body, true)['skip'] ?? true) !== false;
}
function tg(string $method, array $params): ?array {
$url = 'https://api.telegram.org/bot' . BOT_TOKEN . '/' . $method;
$r = @file_get_contents($url, false, stream_context_create(['http' => [
'method' => 'POST', 'header' => 'Content-Type: application/json', 'content' => json_encode($params),
]]));
return $r === false ? null : (json_decode($r, true)['result'] ?? null);
}
// «Photo only» orders pay more (cache it per user in production); null — unknown
function has_photo(int $userId): ?bool {
$r = tg('getUserProfilePhotos', ['user_id' => $userId, 'limit' => 1]);
return $r === null ? null : $r['total_count'] > 0;
}
$update = json_decode(file_get_contents('php://input'), true);
$msg = $update['message'] ?? null;
if ($msg) {
if (!briza_check($msg['from'])) exit; // use it wherever the check is needed
$start = ($msg['text'] ?? '') === '/start';
tg('sendMessage', ['chat_id' => $msg['chat']['id'],
'text' => $start ? 'Hi! Send me a link and I will download the video.' : '⏳ Downloading…']);
}# Your key from @BrizaHubBot
BRIZA_KEY="your_key_here"
# Briza checks the user and shows the block itself
curl -s https://api.brizahub.com/v1/check \
-H "Authorization: Bearer $BRIZA_KEY" -H "Content-Type: application/json" \
-d '{
"user_id": 123456789,
"language_code": "fa",
"is_premium": false,
"has_photo": true,
"first_name": "Ali",
"smart_links": true
}'
# → {"ok": true, "skip": true} — let the user in
# → {"ok": true, "skip": false, "tasks": [...], "message_id": 4521} — block shown, stop
# The user wrote to your bot again — the same call: let through or the block with what's leftAPI reference
https://api.brizahub.com, key in Authorization: Bearer …, JSON. Limit: 65 requests per second.
Read-only key (bzr_…) — for a stats dashboard or your accountant: opens /v1/me, /v1/stats, /v1/balance, issues no tasks. Create it in @BrizaHubBot: your bot's card → “👁 Read-only key”.
POST/v1/tasks
Tasks for the force-sub block. Until the user completes them, the same ones come back. Once they pass the block, no new ones until the list reset (bot settings in @BrizaHubBot, 6 h by default).
Parameters
user_idintegerrequiredfrom.idlimitintegeroptional1–10, more is cut to 10. Default — your bot's setting (5).
language_codestringoptionalfrom.language_code. Omitted — we detect it by user_id.is_premiumbooleanoptionalfrom.is_premiumhas_photobooleanoptionalWhether the user has a profile photo (your bot sees it via
getUserProfilePhotos). Gives “photo only” orders; we check it after the subscription.first_namestringoptionalfrom.first_name— we compare it with Telegram after the subscription.min_pricestringoptionalMinimum payout per task, USDT, e.g.
"0.015".smart_linksbooleanoptionalWhether to take tasks with smart links. We recommend
true: more advertisers.mini_appsbooleanoptionalWhether to take mini-app tasks (
type: app). Withouttrueyou get none.
Response fields
tasksarrayEmpty — let the user through.
task_idstringFor
/v1/tasks/check.typestringchannel,group,bot,link,folder(a chat folder —t.me/addlist/…; show it like a channel),app(a bot's mini app; button “Open”).linkstringButton link.
titlestringButton text.
pricestringYour payout, USDT.
photostringPicture of the channel, group or bot (a mini app — its bot): a link to a JPEG of exactly 320×320 px on
api.brizahub.com, the same size for every task. No photo, a website or a folder — a Telegram-style placeholder of the same size.photo_placeholderbooleantrue—photois a placeholder (gradient and initials): show it or draw your own. A real photo — no field.
Example
# user_id, language_code, is_premium, first_name — from the Telegram user; has_photo — getUserProfilePhotos
curl -s -X POST "https://api.brizahub.com/v1/tasks" \
-H "Authorization: Bearer your_key_here" \
-H "Content-Type: application/json" \
-d '{
"user_id": 123456789,
"language_code": "fa",
"is_premium": false,
"has_photo": true,
"first_name": "Ali",
"smart_links": true,
"mini_apps": true
}'import aiohttp
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
HEADERS = {"Authorization": f"Bearer {BRIZA_KEY}"}
# user — message.from_user; has_photo — getUserProfilePhotos(user.id).total_count > 0
async def briza_tasks(user, has_photo: bool) -> dict:
async with aiohttp.ClientSession() as s:
async with s.post("https://api.brizahub.com/v1/tasks", headers=HEADERS, json={
"user_id": user.id,
"language_code": user.language_code,
"is_premium": bool(user.is_premium),
"has_photo": has_photo,
"first_name": user.first_name,
"smart_links": True,
"mini_apps": True,
}) as r:
return await r.json()const BRIZA_KEY = "your_key_here"; // your key from @BrizaHubBot
// user — ctx.from; hasPhoto — getUserProfilePhotos(user.id).total_count > 0
async function brizaTasks(user, hasPhoto) {
const r = await fetch("https://api.brizahub.com/v1/tasks", {
method: "POST",
headers: { Authorization: `Bearer ${BRIZA_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
user_id: user.id,
language_code: user.language_code,
is_premium: !!user.is_premium,
has_photo: hasPhoto,
first_name: user.first_name,
smart_links: true,
mini_apps: true,
}),
});
return r.json();
}<?php
const BRIZA_KEY = 'your_key_here'; // your key from @BrizaHubBot
// $user — $update['message']['from']; $hasPhoto — getUserProfilePhotos: total_count > 0
function briza_tasks(array $user, bool $hasPhoto): ?array {
$ch = curl_init('https://api.brizahub.com/v1/tasks');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . BRIZA_KEY, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'user_id' => $user['id'],
'language_code' => $user['language_code'] ?? null,
'is_premium' => !empty($user['is_premium']),
'has_photo' => $hasPhoto,
'first_name' => $user['first_name'],
'smart_links' => true,
'mini_apps' => true,
]),
CURLOPT_RETURNTRANSFER => true,
]);
return json_decode(curl_exec($ch), true);
}{
"ok": true,
"tasks": [
{
"task_id": "t_Qx3kW2",
"type": "channel",
"link": "https://t.me/+AbCdEf",
"title": "Persian News",
"price": "0.01955",
"photo": "https://api.brizahub.com/photo/3f9c2a1b7d4e8f0a6c5b.jpg"
}
]
}POST/v1/tasks/check
Checks tasks when the user presses “Check”.
Parameters
user_idintegerrequiredfrom.idtask_idsarrayrequired1–20
task_ids.
Response fields
resultsarrayOne per
task_id.statusstringincomplete,pending,completed,unavailable— see statuses.reasonstringFor
unavailable:expired,order_inactive,member,left,not_paid,suspicious,removed,unconfirmed,check_failed,not_found.
Example
# user_id — from the Telegram user; task_ids — the tasks you showed
curl -s -X POST "https://api.brizahub.com/v1/tasks/check" \
-H "Authorization: Bearer your_key_here" \
-H "Content-Type: application/json" \
-d '{"user_id": 123456789, "task_ids": ["t_Qx3kW2", "t_Lm9pR4"]}'import aiohttp
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
HEADERS = {"Authorization": f"Bearer {BRIZA_KEY}"}
# user — call.from_user; task_ids — the tasks you showed
async def briza_check_tasks(user, task_ids: list[str]) -> dict:
async with aiohttp.ClientSession() as s:
async with s.post("https://api.brizahub.com/v1/tasks/check", headers=HEADERS,
json={"user_id": user.id, "task_ids": task_ids}) as r:
return await r.json()const BRIZA_KEY = "your_key_here"; // your key from @BrizaHubBot
// user — ctx.from; taskIds — the tasks you showed
async function brizaCheckTasks(user, taskIds) {
const r = await fetch("https://api.brizahub.com/v1/tasks/check", {
method: "POST",
headers: { Authorization: `Bearer ${BRIZA_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ user_id: user.id, task_ids: taskIds }),
});
return r.json();
}<?php
const BRIZA_KEY = 'your_key_here'; // your key from @BrizaHubBot
// $user — $update['callback_query']['from']; $taskIds — the tasks you showed
function briza_check_tasks(array $user, array $taskIds): ?array {
$ch = curl_init('https://api.brizahub.com/v1/tasks/check');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . BRIZA_KEY, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode(['user_id' => $user['id'], 'task_ids' => $taskIds]),
CURLOPT_RETURNTRANSFER => true,
]);
return json_decode(curl_exec($ch), true);
}{
"ok": true,
"results": [
{
"task_id": "t_Qx3kW2",
"status": "pending"
},
{
"task_id": "t_Lm9pR4",
"status": "incomplete"
}
]
}POST/v1/check
Checks the user and, if needed, shows the force-sub block as your bot.
Parameters
user_idintegerrequiredfrom.idchat_idintegeroptionalDefault —
user_id.limitintegeroptional1–10, more is cut to 10. Default — your bot's setting (5).
language_codestringoptionalWhich language to show the force-sub block in (
from.language_code, 30 Telegram languages). Omitted — we detect it by user_id; unknown — English.is_premiumbooleanoptionalfrom.is_premiumhas_photobooleanoptionalWhether the user has a profile photo (your bot sees it via
getUserProfilePhotos). Gives “photo only” orders; we check it after the subscription.first_namestringoptionalfrom.first_name— we compare it with Telegram after the subscription.messageobjectoptionaltextup to 4096: HTML,parse_modeMarkdownV2orentitiescopied from a message; premium emoji,$name— the user's name.rows(1–3),button_join,button_channel,button_bot,button_url; iconsbutton_icon(custom emoji id), colorbutton_style. Premium emoji show if your bot's owner has Telegram Premium.min_pricestringoptionalMinimum payout per task, USDT, e.g.
"0.015".smart_linksbooleanoptionalWhether to take tasks with smart links. We recommend
true: more advertisers.
Response fields
skipbooleantrue— let through,false— hold.tasksarrayTasks in the block.
message_idintegerThe block message.
Example
# user_id, language_code, is_premium, first_name — from the Telegram user; has_photo — getUserProfilePhotos
curl -s -X POST "https://api.brizahub.com/v1/check" \
-H "Authorization: Bearer your_key_here" \
-H "Content-Type: application/json" \
-d '{
"user_id": 123456789,
"language_code": "fa",
"is_premium": false,
"has_photo": true,
"first_name": "Ali",
"smart_links": true
}'import aiohttp
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
HEADERS = {"Authorization": f"Bearer {BRIZA_KEY}"}
# user — message.from_user; has_photo — getUserProfilePhotos(user.id).total_count > 0
async def briza_check(user, has_photo: bool) -> dict:
async with aiohttp.ClientSession() as s:
async with s.post("https://api.brizahub.com/v1/check", headers=HEADERS, json={
"user_id": user.id,
"language_code": user.language_code,
"is_premium": bool(user.is_premium),
"has_photo": has_photo,
"first_name": user.first_name,
"smart_links": True,
}) as r:
return await r.json()const BRIZA_KEY = "your_key_here"; // your key from @BrizaHubBot
// user — ctx.from; hasPhoto — getUserProfilePhotos(user.id).total_count > 0
async function brizaCheck(user, hasPhoto) {
const r = await fetch("https://api.brizahub.com/v1/check", {
method: "POST",
headers: { Authorization: `Bearer ${BRIZA_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
user_id: user.id,
language_code: user.language_code,
is_premium: !!user.is_premium,
has_photo: hasPhoto,
first_name: user.first_name,
smart_links: true,
}),
});
return r.json();
}<?php
const BRIZA_KEY = 'your_key_here'; // your key from @BrizaHubBot
// $user — $update['message']['from']; $hasPhoto — getUserProfilePhotos: total_count > 0
function briza_check(array $user, bool $hasPhoto): ?array {
$ch = curl_init('https://api.brizahub.com/v1/check');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . BRIZA_KEY, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'user_id' => $user['id'],
'language_code' => $user['language_code'] ?? null,
'is_premium' => !empty($user['is_premium']),
'has_photo' => $hasPhoto,
'first_name' => $user['first_name'],
'smart_links' => true,
]),
CURLOPT_RETURNTRANSFER => true,
]);
return json_decode(curl_exec($ch), true);
}{
"ok": true,
"skip": false,
"tasks": [
{
"task_id": "t_Qx3kW2",
"type": "channel",
"link": "https://t.me/+AbCdEf",
"title": "Persian News",
"price": "0.01955",
"photo": "https://api.brizahub.com/photo/3f9c2a1b7d4e8f0a6c5b.jpg"
}
],
"message_id": 4521
}GET/v1/me
Your platform and today's counters.
No parameters.
Response fields
platformobjectName, status, webhook, bot token.
statsobjectToday and all time.
Example
curl -s "https://api.brizahub.com/v1/me" \
-H "Authorization: Bearer your_key_here"import asyncio
import aiohttp
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
HEADERS = {"Authorization": f"Bearer {BRIZA_KEY}"}
async def main():
async with aiohttp.ClientSession() as s:
async with s.get("https://api.brizahub.com/v1/me", headers=HEADERS) as r:
print(await r.json())
asyncio.run(main())const BRIZA_KEY = "your_key_here"; // your key from @BrizaHubBot
const r = await fetch("https://api.brizahub.com/v1/me", { headers: { Authorization: `Bearer ${BRIZA_KEY}` } });
console.log(await r.json());<?php
$BRIZA_KEY = 'your_key_here'; // your key from @BrizaHubBot
$ch = curl_init('https://api.brizahub.com/v1/me');
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $BRIZA_KEY],
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
print_r($data);{
"ok": true,
"platform": {
"id": 3,
"name": "@MySaver_bot",
"bot": "MySaver_bot",
"status": "active",
"webhook": null,
"token": false
},
"stats": {
"issued_today": 120,
"done_today": 41,
"done_total": 3050,
"left_total": 72
}
}GET/v1/stats
Daily stats (UTC).
Parameters
daysintegeroptional1–90 (more is cut to 90), 7 by default.
Response fields
daysarrayOne row per day.
Example
curl -s "https://api.brizahub.com/v1/stats?days=7" \
-H "Authorization: Bearer your_key_here"import asyncio
import aiohttp
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
HEADERS = {"Authorization": f"Bearer {BRIZA_KEY}"}
async def main():
async with aiohttp.ClientSession() as s:
async with s.get("https://api.brizahub.com/v1/stats?days=7", headers=HEADERS) as r:
print(await r.json())
asyncio.run(main())const BRIZA_KEY = "your_key_here"; // your key from @BrizaHubBot
const r = await fetch("https://api.brizahub.com/v1/stats?days=7", { headers: { Authorization: `Bearer ${BRIZA_KEY}` } });
console.log(await r.json());<?php
$BRIZA_KEY = 'your_key_here'; // your key from @BrizaHubBot
$ch = curl_init('https://api.brizahub.com/v1/stats?days=7');
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $BRIZA_KEY],
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
print_r($data);{
"ok": true,
"days": [
{
"date": "2026-11-08",
"issued": 412,
"completed": 97,
"left": 6,
"earned": "1.55"
}
]
}GET/v1/balance
Earnings, USDT.
No parameters.
Response fields
balanceobjectavailable— withdrawable,pending— waiting 24 h,paid— paid out,requested— requested.min_payoutstringMinimum withdrawal, USDT.
Example
curl -s "https://api.brizahub.com/v1/balance" \
-H "Authorization: Bearer your_key_here"import asyncio
import aiohttp
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
HEADERS = {"Authorization": f"Bearer {BRIZA_KEY}"}
async def main():
async with aiohttp.ClientSession() as s:
async with s.get("https://api.brizahub.com/v1/balance", headers=HEADERS) as r:
print(await r.json())
asyncio.run(main())const BRIZA_KEY = "your_key_here"; // your key from @BrizaHubBot
const r = await fetch("https://api.brizahub.com/v1/balance", { headers: { Authorization: `Bearer ${BRIZA_KEY}` } });
console.log(await r.json());<?php
$BRIZA_KEY = 'your_key_here'; // your key from @BrizaHubBot
$ch = curl_init('https://api.brizahub.com/v1/balance');
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $BRIZA_KEY],
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
print_r($data);{
"ok": true,
"balance": {
"available": "12.4",
"pending": "1.06",
"total": "40.2",
"paid": "27.8",
"requested": "0"
},
"min_payout": "5"
}Try it
“Send” makes a real request with your key.
Request code
curl -s -X POST "https://api.brizahub.com/v1/tasks" \
-H "Authorization: Bearer your_key_here" \
-H "Content-Type: application/json" \
-d '{
"user_id": 123456789,
"smart_links": true,
"mini_apps": true
}'import asyncio
import aiohttp
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
HEADERS = {"Authorization": f"Bearer {BRIZA_KEY}"}
async def main():
async with aiohttp.ClientSession() as s:
async with s.post("https://api.brizahub.com/v1/tasks", headers=HEADERS, json={
"user_id": 123456789,
"smart_links": True,
"mini_apps": True,
}) as r:
print(await r.json())
asyncio.run(main())const BRIZA_KEY = "your_key_here"; // your key from @BrizaHubBot
const r = await fetch("https://api.brizahub.com/v1/tasks", {
method: "POST",
headers: { Authorization: `Bearer ${BRIZA_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
user_id: 123456789,
smart_links: true,
mini_apps: true,
}),
});
console.log(await r.json());<?php
$BRIZA_KEY = 'your_key_here'; // your key from @BrizaHubBot
$ch = curl_init('https://api.brizahub.com/v1/tasks');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $BRIZA_KEY, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'user_id' => 123456789,
'smart_links' => true,
'mini_apps' => true,
]),
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
print_r($data);POST /v1/tasks HTTP/1.1
Host: api.brizahub.com
Authorization: Bearer your_key_here
Content-Type: application/json
{
"user_id": 123456789,
"smart_links": true,
"mini_apps": true
}Smart links and clicks
- A smart link is a task link through our mini-app in Telegram (
t.me/BrizaAI?startapp=s_…): the user stays in Telegram, sees the channel card with a Join button and joins, and we learn their device and country. Once we know them, their tasks come with direct links for 30 days; for some bots smart links are always on. Clicks to websites also go through the mini-app (t.me/BrizaAI?startapp=c_…): the click counts when the user taps “Open” — Telegram confirms it's a real account. Old…/s/<code>links keep working. Showlinkas is. - We recommend turning it on —
"smart_links": true: you also get clicks to websites (typelink, paid at once) and device-targeted orders. More advertisers — more earnings. Without it — only direct links to channels, groups and bots. - Label click buttons generically, like “🎁 Offer”, not with the site's name.
Webhook instead of polling
- Set a public
https://address in @BrizaHubBot → Sell traffic → your bot → API → Webhook. The signing secret is under Copy secret; Reissue secret replaces it. task.pending— subscribed, paid in 24 h;task.completed— paid;task.left— left early, not paid. Fields:event_id(same on retries),task_id,user_id,via(check,join,infer,click),at.- Signature —
X-Briza-Signature: sha256=<hex>: HMAC-SHA256 of<X-Briza-Timestamp>.<body>(the raw body bytes as received), keyed with your whole secret,whsec_included. Compare the full string,sha256=included; reject timestamps older than 5 minutes. - Delivery: reply with any
2xxwithin 5 seconds — we don't read the body; anything else (3xx, 4xx, 5xx, a timeout) is a failure. We retry up to 8 times: after 30 s, 2, 10, 30 min, 2, 6 and 12 h — the last attempt about 21 h after the event, then it is dropped (the status stays in/v1/tasks/check). Every retry has the sameevent_id— process it once. Events of one bot go in order, but a failed one can arrive after newer ones. While the bot is paused or banned we don't send; events older than 24 h are dropped. Up to 20 events per bot every 5 s; the test button — once a minute.
import hashlib
import hmac
import time
WEBHOOK_SECRET = "whsec_your_secret" # @BrizaHubBot → your bot → API → Webhook → Copy secret
def briza_signature_ok(headers, raw_body: bytes) -> bool:
"""raw_body — the request body exactly as received (bytes), not re-serialized JSON."""
ts = headers.get("X-Briza-Timestamp", "")
expected = "sha256=" + hmac.new(WEBHOOK_SECRET.encode(), ts.encode() + b"." + raw_body,
hashlib.sha256).hexdigest()
fresh = ts.isdigit() and abs(time.time() - int(ts)) < 300 # older than 5 minutes — reject
return fresh and hmac.compare_digest(expected, headers.get("X-Briza-Signature", ""))import crypto from "node:crypto";
const WEBHOOK_SECRET = "whsec_your_secret"; // @BrizaHubBot → your bot → API → Webhook → Copy secret
// rawBody — the request body exactly as received (Buffer), not re-serialized JSON
export function brizaSignatureOk(headers, rawBody) {
const ts = String(headers["x-briza-timestamp"] ?? "");
const expected = "sha256=" + crypto.createHmac("sha256", WEBHOOK_SECRET)
.update(`${ts}.`).update(rawBody).digest("hex");
const got = String(headers["x-briza-signature"] ?? "");
const fresh = /^\d+$/.test(ts) && Math.abs(Date.now() / 1000 - Number(ts)) < 300; // older than 5 minutes — reject
return fresh && got.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(got), Buffer.from(expected));
}<?php
const WEBHOOK_SECRET = 'whsec_your_secret'; // @BrizaHubBot → your bot → API → Webhook → Copy secret
// $rawBody = file_get_contents('php://input') — the body exactly as received
function briza_signature_ok(string $rawBody): bool {
$ts = $_SERVER['HTTP_X_BRIZA_TIMESTAMP'] ?? '';
$expected = 'sha256=' . hash_hmac('sha256', $ts . '.' . $rawBody, WEBHOOK_SECRET);
$fresh = ctype_digit($ts) && abs(time() - (int)$ts) < 300; // older than 5 minutes — reject
return $fresh && hash_equals($expected, $_SERVER['HTTP_X_BRIZA_SIGNATURE'] ?? '');
}Task statuses
| Status | Meaning | Your bot |
|---|---|---|
incomplete | not subscribed yet | hold |
pending | subscribed or sent a join request — paid later (a subscriber — in 24 h) | let through |
completed | paid | let through |
unavailable | the task is gone, see reason | let through |
Errors and timeouts
Errors: {"ok": false, "error": "…"} with an HTTP code; on 429 retry after Retry-After seconds. Timeout: 3 s — no answer, don't hold the user.
| HTTP | error |
|---|---|
| 400 | bad_json, bad_user_id, bad_task_ids, bad_is_premium, bad_has_photo, bad_first_name, bad_smart_links, bad_mini_apps, bad_min_price, bad_chat_id, bad_message |
| 401 | no_key — no key; bad_key — wrong key — copy it in @BrizaHubBot |
| 403 | paused — the bot is paused: no tasks; banned — the bot or account is banned; read_only — read-only key: no tasks; on_review — the bot is on moderation — the key starts working by itself after approval; rejected — the bot was not approved |
| 409 | no_token |
| 413 | too_large |
| 429 | rate_limited |
| 500 | internal |
Complete bot
Fill in BRIZA_KEY and BOT_TOKEN.
# pip install aiogram brizahub — a bot with force-sub from Briza Hub
import asyncio
from aiogram import Bot, Dispatcher, F
from aiogram.filters import CommandStart
from aiogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, Message
from brizahub import Briza
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
BOT_TOKEN = "your_bot_token_here" # your bot's token from @BotFather
bot = Bot(BOT_TOKEN)
dp = Dispatcher()
briza = Briza(BRIZA_KEY, smart_links=True, mini_apps=True) # more advertisers: device-targeted orders, visits, mini apps
def block(sponsors) -> InlineKeyboardMarkup:
# a visit may go to another offer for this device — label it generically, not with the site's name
rows = [[InlineKeyboardButton(text="🎁 Offer" if s.type == "link" else s.title or "Subscribe", url=s.link)]
for s in sponsors]
rows.append([InlineKeyboardButton(text="✅ Check", callback_data="briza:check")])
return InlineKeyboardMarkup(inline_keyboard=rows)
@dp.message(CommandStart())
async def start(message: Message) -> None:
await message.answer("Hi! Send me a link and I will download the video.")
@dp.message(F.text)
async def work(message: Message) -> None:
photos = await bot.get_user_profile_photos(message.from_user.id, limit=1) # «photo only» orders pay more
sponsors = await briza.get_sponsors(message.from_user, has_photo=photos.total_count > 0)
if sponsors: # force-sub first; [] — let the user in
await message.answer("Join our sponsors to use the bot:", reply_markup=block(sponsors))
return
await message.answer("⏳ Downloading…") # your bot's real work
@dp.callback_query(F.data == "briza:check")
async def check(call: CallbackQuery) -> None:
if await briza.check_sponsors(call.from_user): # not joined yet
await call.answer("Please join all the channels first", show_alert=True)
return
await call.answer()
await call.message.edit_text("✅ Thank you! Now send me a link.")
if __name__ == "__main__":
dp.shutdown.register(briza.close)
asyncio.run(dp.start_polling(bot))# pip install aiogram aiohttp — a bot with force-sub from Briza Hub
import asyncio
import aiohttp
from aiogram import Bot, Dispatcher, F
from aiogram.filters import CommandStart
from aiogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, Message
BRIZA_KEY = "your_key_here" # your key from @BrizaHubBot
BOT_TOKEN = "your_bot_token_here" # your bot's token from @BotFather
BRIZA = "https://api.brizahub.com"
bot = Bot(BOT_TOKEN)
dp = Dispatcher()
shown: dict[int, list[str]] = {} # user_id → task_ids of the shown block (use Redis/DB in production)
photos: dict[int, bool] = {} # user_id → has a profile photo (asked once per user)
async def briza(path: str, payload: dict) -> dict | None:
try:
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=3)) as s:
async with s.post(BRIZA + path, json=payload, headers={"Authorization": f"Bearer {BRIZA_KEY}"}) as r:
return await r.json() if r.status == 200 else None
except (aiohttp.ClientError, TimeoutError):
return None # Briza did not answer: never hold the user because of us
async def has_photo(user_id: int) -> bool | None:
"""«Photo only» orders pay more. None — unknown, not sent."""
if user_id not in photos:
try:
photos[user_id] = (await bot.get_user_profile_photos(user_id, limit=1)).total_count > 0
except Exception:
return None
return photos[user_id]
async def sponsors_needed(message: Message) -> bool:
"""True — the force-sub block is shown."""
user = message.from_user
data = await briza("/v1/tasks", {
"user_id": user.id,
"language_code": user.language_code,
"is_premium": bool(user.is_premium),
"first_name": user.first_name,
"has_photo": await has_photo(user.id),
"smart_links": True, # more advertisers: device-targeted orders and visits
"mini_apps": True, # mini app tasks too
})
tasks = (data or {}).get("tasks", [])
if not tasks:
return False
shown[user.id] = [t["task_id"] for t in tasks]
# a visit may go to another offer for this device — label it generically, not with the site's name
rows = [[InlineKeyboardButton(text="🎁 Offer" if t["type"] == "link" else t["title"], url=t["link"])]
for t in tasks]
rows.append([InlineKeyboardButton(text="✅ Check", callback_data="briza:check")])
await message.answer("Join our sponsors to use the bot:", reply_markup=InlineKeyboardMarkup(inline_keyboard=rows))
return True
@dp.message(CommandStart())
async def start(message: Message) -> None:
await message.answer("Hi! Send me a link and I will download the video.")
@dp.message(F.text)
async def work(message: Message) -> None:
if await sponsors_needed(message): # force-sub first
return
await message.answer("⏳ Downloading…") # your bot's real work
@dp.callback_query(F.data == "briza:check")
async def check(call: CallbackQuery) -> None:
ids = shown.get(call.from_user.id, [])
data = await briza("/v1/tasks/check", {"user_id": call.from_user.id, "task_ids": ids}) if ids else None
if any(x["status"] == "incomplete" for x in (data or {}).get("results", [])):
await call.answer("Please join all the channels first", show_alert=True)
return
shown.pop(call.from_user.id, None)
await call.answer()
await call.message.edit_text("✅ Thank you! Now send me a link.")
if __name__ == "__main__":
asyncio.run(dp.start_polling(bot))// npm i grammy — a bot with force-sub from Briza Hub (Node.js 18+)
import { Bot, InlineKeyboard } from "grammy";
const BRIZA_KEY = "your_key_here"; // your key from @BrizaHubBot
const BOT_TOKEN = "your_bot_token_here"; // your bot's token from @BotFather
const BRIZA = "https://api.brizahub.com";
const bot = new Bot(BOT_TOKEN);
const shown = new Map(); // userId → task_ids of the shown block (use Redis/DB in production)
const photos = new Map(); // userId → has a profile photo (asked once per user)
async function briza(path, payload) {
try {
const r = await fetch(BRIZA + path, {
method: "POST",
headers: { Authorization: `Bearer ${BRIZA_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify(payload),
signal: AbortSignal.timeout(3000),
});
return r.ok ? await r.json() : null;
} catch {
return null; // Briza did not answer: never hold the user because of us
}
}
// «Photo only» orders pay more; undefined — unknown, not sent
async function hasPhoto(userId) {
if (!photos.has(userId)) {
try {
photos.set(userId, (await bot.api.getUserProfilePhotos(userId, { limit: 1 })).total_count > 0);
} catch {
return undefined;
}
}
return photos.get(userId);
}
async function sponsorsNeeded(ctx) {
const u = ctx.from;
const data = await briza("/v1/tasks", {
user_id: u.id,
language_code: u.language_code,
is_premium: !!u.is_premium,
first_name: u.first_name,
has_photo: await hasPhoto(u.id),
smart_links: true, // more advertisers: device-targeted orders and visits
mini_apps: true, // mini app tasks too
});
const tasks = data?.tasks ?? [];
if (tasks.length === 0) return false;
shown.set(u.id, tasks.map((t) => t.task_id));
const kb = new InlineKeyboard();
// a visit may go to another offer for this device — label it generically, not with the site's name
for (const t of tasks) kb.url(t.type === "link" ? "🎁 Offer" : t.title, t.link).row();
kb.text("✅ Check", "briza:check");
await ctx.reply("Join our sponsors to use the bot:", { reply_markup: kb });
return true;
}
bot.command("start", (ctx) => ctx.reply("Hi! Send me a link and I will download the video."));
bot.on("message:text", async (ctx) => {
if (await sponsorsNeeded(ctx)) return; // force-sub first
await ctx.reply("⏳ Downloading…"); // your bot's real work
});
bot.callbackQuery("briza:check", async (ctx) => {
const ids = shown.get(ctx.from.id) ?? [];
const data = ids.length ? await briza("/v1/tasks/check", { user_id: ctx.from.id, task_ids: ids }) : null;
if ((data?.results ?? []).some((x) => x.status === "incomplete")) {
return ctx.answerCallbackQuery({ text: "Please join all the channels first", show_alert: true });
}
shown.delete(ctx.from.id);
await ctx.answerCallbackQuery();
await ctx.editMessageText("✅ Thank you! Now send me a link.");
});
bot.start();<?php
// A Telegram bot on a webhook, no libraries: Telegram → this file → Briza Hub
const BRIZA_KEY = 'your_key_here'; // your key from @BrizaHubBot
const BOT_TOKEN = 'your_bot_token_here'; // your bot's token from @BotFather
const BRIZA = 'https://api.brizahub.com';
function briza(string $path, array $payload): ?array {
$ch = curl_init(BRIZA . $path);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . BRIZA_KEY, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 3,
]);
$body = curl_exec($ch);
$ok = $body !== false && curl_getinfo($ch, CURLINFO_RESPONSE_CODE) === 200;
curl_close($ch);
return $ok ? json_decode($body, true) : null; // null: Briza did not answer — never hold the user
}
function tg(string $method, array $params): ?array {
$url = 'https://api.telegram.org/bot' . BOT_TOKEN . '/' . $method;
$r = @file_get_contents($url, false, stream_context_create(['http' => [
'method' => 'POST', 'header' => 'Content-Type: application/json', 'content' => json_encode($params),
]]));
return $r === false ? null : (json_decode($r, true)['result'] ?? null);
}
// «Photo only» orders pay more (cache it per user in production); null — unknown
function has_photo(int $userId): ?bool {
$r = tg('getUserProfilePhotos', ['user_id' => $userId, 'limit' => 1]);
return $r === null ? null : $r['total_count'] > 0;
}
$update = json_decode(file_get_contents('php://input'), true);
$msg = $update['message'] ?? null;
if ($msg && ($msg['text'] ?? '') === '/start') {
tg('sendMessage', ['chat_id' => $msg['chat']['id'], 'text' => 'Hi! Send me a link and I will download the video.']);
} elseif ($msg && isset($msg['text'])) {
$u = $msg['from'];
$data = briza('/v1/tasks', [
'user_id' => $u['id'],
'language_code' => $u['language_code'] ?? null,
'is_premium' => !empty($u['is_premium']),
'first_name' => $u['first_name'],
'has_photo' => has_photo($u['id']),
'smart_links' => true, // more advertisers: device-targeted orders and visits
'mini_apps' => true, // mini app tasks too
]);
$tasks = $data['tasks'] ?? [];
if ($tasks) { // force-sub first
file_put_contents(sys_get_temp_dir() . "/briza_{$u['id']}.json", json_encode(array_column($tasks, 'task_id')));
// a visit may go to another offer for this device — label it generically, not with the site's name
$rows = array_map(fn($t) => [['text' => $t['type'] === 'link' ? '🎁 Offer' : $t['title'], 'url' => $t['link']]],
$tasks);
$rows[] = [['text' => '✅ Check', 'callback_data' => 'briza:check']];
tg('sendMessage', ['chat_id' => $u['id'], 'text' => 'Join our sponsors to use the bot:',
'reply_markup' => ['inline_keyboard' => $rows]]);
} else {
tg('sendMessage', ['chat_id' => $u['id'], 'text' => '⏳ Downloading…']); // your bot's real work
}
} elseif (($update['callback_query']['data'] ?? '') === 'briza:check') {
$q = $update['callback_query'];
$file = sys_get_temp_dir() . "/briza_{$q['from']['id']}.json";
$ids = is_file($file) ? json_decode(file_get_contents($file), true) : [];
$data = $ids ? briza('/v1/tasks/check', ['user_id' => $q['from']['id'], 'task_ids' => $ids]) : null;
$left = array_filter($data['results'] ?? [], fn($x) => $x['status'] === 'incomplete');
if ($left) {
tg('answerCallbackQuery', ['callback_query_id' => $q['id'], 'show_alert' => true,
'text' => 'Please join all the channels first']);
} else {
@unlink($file);
tg('answerCallbackQuery', ['callback_query_id' => $q['id']]);
tg('editMessageText', ['chat_id' => $q['message']['chat']['id'], 'message_id' => $q['message']['message_id'],
'text' => '✅ Thank you! Now send me a link.']);
}
}# Your key from @BrizaHubBot
BRIZA_KEY="your_key_here"
# 1. Tasks for the force-sub block
curl -s https://api.brizahub.com/v1/tasks \
-H "Authorization: Bearer $BRIZA_KEY" -H "Content-Type: application/json" \
-d '{
"user_id": 123456789,
"language_code": "fa",
"is_premium": false,
"has_photo": true,
"first_name": "Ali",
"smart_links": true,
"mini_apps": true
}'
# smart_links, mini_apps — more advertisers: device-targeted orders, visits and mini apps
# → {"ok": true, "tasks": [{"task_id": "t_Qx3…", "type": "channel", "link": "https://t.me/+AbCdEf",
# "title": "Channel title", "price": "0.01955",
# "photo": "https://api.brizahub.com/photo/3f9c2a1b7d4e8f0a6c5b.jpg"}]} # photo — JPEG 320×320
# Empty — let the user in; otherwise show the tasks as buttons plus «✅ Check»
# 2. «Check» pressed: hold while any task is "incomplete"
curl -s https://api.brizahub.com/v1/tasks/check \
-H "Authorization: Bearer $BRIZA_KEY" -H "Content-Type: application/json" \
-d '{"user_id": 123456789, "task_ids": ["t_Qx3…"]}'
# → {"ok": true, "results": [{"task_id": "t_Qx3…", "status": "pending"}]} # pending — paid in 24 h, completed — paid
# 3. Your earnings
curl -s https://api.brizahub.com/v1/balance -H "Authorization: Bearer $BRIZA_KEY"API changelog
/v1 is stable since 09.11.2026: only compatible additions — new optional fields and parameters. Breaking changes go to /v2, announced here and in @BrizaHub 14 days ahead.
- 26.11.2026 — every task has
photo: the picture of the channel, group or bot as our link (https://api.brizahub.com/photo/…jpg, JPEG 320×320). No photo, a website or a folder — a Telegram-style placeholder and"photo_placeholder": true. Python packagebrizahub0.1.3:Sponsor.photo,Sponsor.photo_placeholder. - 23.11.2026 — smart links to a channel, group, bot or folder are now our mini-app in Telegram (
t.me/BrizaAI?startapp=s_…) instead of the…/s/…page: a resource card with a Join button, the user stays in Telegram; counted on joining as usual. For some bots — always. Showlinkas is. Also:limitabove 10 is cut to 10 instead of400 bad_limit;daysin /v1/stats — likewise, to 1–90. - 17.11.2026 —
"suspicious": truein/v1/tasksand/v1/checkresponses — the user is flagged by our anti-fraud; reasonsuspiciousin/v1/tasks/check— not paid. - 13.11.2026 — new task type
app, a bot's mini app (t.me/bot/app?startapp=…ort.me/bot?startapp=…): without check only, counted together with the checked task next to it. In/v1/tasks— only with the new optional"mini_apps": true. The default button title is “Open”; in the turnkey block it takesbutton_url. Don't want mini apps — exclude the “Mini apps” sponsor topic. - 11.11.2026 — new task type
folder, a chat folder (t.me/addlist/…): the person adds it with one tap, and we count it by one of its channels. The default button title is “Add folder”; show any unknown type likechannel. Don't want folders — exclude the “Folders” sponsor topic. - 10.11.2026 —
messageof/v1/check: text up to 4096, HTML, MarkdownV2 orentities, premium emoji,$name, premium-emoji icons and colors of buttons. Python packagepip install brizahub. - 10.11.2026 — click tasks (
type: link) now open our mini-app in Telegram (t.me/BrizaAI?startapp=c_…); the click counts when the user taps “Open”. Show thelinkas is. - 10.11.2026 — the API key comes right with the request:
403 on_reviewuntil approval,rejectedif declined. Connect by a link to the bot, without a token: everything except/v1/check. New fieldshas_photo,first_name;language_code,is_premiumandhas_photoare checked after the subscription. - 09.11.2026 — read-only key (
bzr_…), errorread_only, fieldread_onlyin/v1/me. - 09.11.2026 — statuses with payment:
incomplete(hold),pending(subscribed, paid in 24 h),completed(paid), reasonnot_paid; webhookstask.pending,task.completed,task.left.smart_links— whether to take tasks with smart links./v1/check: block without “Check”, in thelanguage_codelanguage, sent within 2.5 s. Later: reasonremoved— the channel banned the user, they can't join. - 09.11.2026 — key errors
no_key,bad_key,paused,banned;limitand the list reset time default to your bot settings; removedverified,expires_at,repeat_hours. - 08.11.2026 — first version of the API.
Ready to earn on your traffic?
Connect your bot in @BrizaHubBot — it takes a minute.