رابط API برای صاحبان ربات
جایگاههای بلوک جوین اجباری ربات خود را بفروشید: Briza Hub کانالهای تبلیغدهندگان را میدهد و برای هر عضو پرداخت میکند.
چطور درآمد کسب میکنید
- سهم شما 85٪ از قیمت تسک است. قیمتها به سفارش بستگی دارد؛ با قیمت پایه 0.01955 USDT برای هر عضو.
- عضویت دارای بررسی پس از 24 ساعت ماندن کاربر پرداخت میشود.
- تسویه — در @BrizaHubBot ← «فروش ترافیک»، از 3 USDT، ظرف ۲۴ ساعت.
- ترافیک از هر کشور و به هر زبان.
- تسکهای بدون بررسی، درخواستهای عضویت، استارت ربات و کلیکها همان لحظه پرداخت میشوند.
- @CryptoBot و @xRocket — بدون کارمزد؛ کیف پول USDT (TRC-20، BEP-20، TON) — بهزودی.
- ترافیک جعلی یعنی مسدود شدن و توقف تسویه.
- تبلیغدهنده سفارش را متوقف یا حذف کرد، کانال را عوض کرد یا ربات ما را برداشت — تسکهایی که پیش از آن داده شده باز هم حساب میشوند.
شروع سریع
پایتون در ۲ دقیقه، زبانهای دیگر در ۵ دقیقه
ربات شما از Briza برای کاربر تسک میگیرد، آنها را به شکل دکمه نشان میدهد و عضویت را بررسی میکند.
مرحله ۱ · کلید را بگیرید
@BrizaHubBot ← «فروش ترافیک» ← «اتصال ربات» ← «با توکن». پس از بررسی (معمولاً تا یک روز) ربات کلید API را میفرستد — آن را به جای your_key_here بگذارید.
مرحله ۲ · پایتون: پکیج را نصب کنید سریعتر
درخواستها، تایماوت و خطاها داخل پکیج است: اگر ظرف ۳ ثانیه پاسخی نیاید یا خطایی رخ دهد، کاربر عبور میکند.
pip install brizahub
pip install "brizahub[aiogram]" # + middleware for aiogram 3مرحله ۳ · یک خط در هندلر
- آماده —
check: Briza بلوک را از طرف ربات شما نشان میدهد (توکن ربات لازم است). - بلوک خودتان —
get_sponsorsوcheck_sponsors: دکمهها را خودتان میسازید، توکن لازم نیست. - aiogram — میدلویر: بررسی پیش از همه هندلرها با هم.
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)تمام. طراحی بلوک خودتان و همه پارامترها — در توضیحات پکیج.
زبانهای دیگر: HTTP API
بدون پکیج — دو درخواست به API با هر زبانی.
آدرس: https://api.brizahub.com. کلید: Authorization: Bearer ….
۱ · اولین درخواست: تسکهای یک کاربر
وقتی کاربر به ربات پیام میدهد، برایش تسک بگیرید:
# 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"
}
]
}۲ · پاسخ را پردازش کنید
همهچیز به فهرست tasks بستگی دارد:
| پاسخ Briza | ربات شما |
|---|---|
tasks خالی است | کاربر را عبور دهید. "suspicious": true — ضدتقلب ما این کاربر را علامت زده است؛ تصمیم با شماست. |
tasks تسک دارد | دکمهها با link و «بررسی» ← POST /v1/tasks/check. تا وقتی تسکی incomplete است نگه دارید. |
| خطا، یا پاسخی در ۳ ثانیه نیامد | کاربر را عبور دهید. |
یک هندلر ساده:
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;
}یا کلید در دست: بلوک را Briza نشان میدهد، برای شما یک خط میماند — if not await briza_check(user): return.
برنامهنویس ندارید؟ لینک هوشمند بگیرید: @BrizaHubBot ← «فروش ترافیک» ← «اتصال ربات» ← «بدون کد». آن را در جوین اجباری یا منو بگذارید — تسکها را خودمان نشان میدهیم و عضویتها را بررسی میکنیم.
کلید در دست: بلوک جوین اجباری را Briza نشان میدهد
یک خط در هندلرها: if not await briza.check(message.from_user): return.
- توکن ربات را هنگام اتصال میفرستید؛ آپدیتهای ربات پیش خودتان میماند.
skip: true— عبور دهید،false— بلوک نشان داده شد، نگه دارید. ظرف ۳ ثانیه پاسخی نیامد — عبور دهید: بلوک بعداً نمیرسد.- دکمه «بررسی» نیست: کاربر عضو شد — دکمه خودش از بلوک حذف میشود؛ دوباره به ربات پیام داد —
/v1/checkرا صدا بزنید: عبورش میدهیم یا باقیمانده را نشان میدهیم. - ظاهر دلخواه — در
message.
ربات کامل:
# 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 leftمرجع API
https://api.brizahub.com، کلید در Authorization: Bearer …، JSON. محدودیت: ۶۵ درخواست در ثانیه.
کلید فقطخواندنی (bzr_…) — برای داشبورد آمار یا حسابدار: /v1/me، /v1/stats و /v1/balance را باز میکند و تسک نمیدهد. ساختن آن — در @BrizaHubBot: کارت ربات ← «👁 کلید فقطخواندنی».
POST/v1/tasks
تسکهای بلوک جوین اجباری. تا کاربر انجامشان ندهد، همانها برمیگردند. از بلوک که رد شد، تا بازنشانی فهرست تسک تازه نمیگیرد (تنظیمات ربات در @BrizaHubBot، پیشفرض ۶ ساعت).
پارامترها
user_idintegerالزامیfrom.idlimitintegerاختیاری۱ تا ۱۰، بیشتر — ۱۰. پیشفرض — تنظیمات ربات (۵).
language_codestringاختیاریfrom.language_code. اگر نفرستید — از روی user_id تشخیص میدهیم.is_premiumbooleanاختیاریfrom.is_premiumhas_photobooleanاختیاریآیا کاربر عکس پروفایل دارد (ربات شما با
getUserProfilePhotosآن را میبیند). سفارشهای «فقط با عکس» را میدهد؛ بعد از عضویت خودمان بررسی میکنیم.first_namestringاختیاریfrom.first_name— بعد از عضویت با تلگرام مقایسه میکنیم.min_pricestringاختیاریحداقل پرداخت برای هر تسک، USDT، مثلاً
"0.015".smart_linksbooleanاختیاریآیا تسکهای دارای اسمارتلینک را بگیرید. توصیه میکنیم
true: تبلیغدهندگان بیشتر.mini_appsbooleanاختیاریآیا تسکهای مینیاپ (
type: app) را بگیرید. بدونtrueنمیآیند.
فیلدهای پاسخ
tasksarrayخالی — کاربر را عبور دهید.
task_idstringبرای
/v1/tasks/check.typestringchannel،group،bot،link،folder(پوشه —t.me/addlist/…؛ مثل کانال نمایش دهید)،app(مینیاپ ربات؛ دکمهٔ «باز کردن»).linkstringلینک دکمه.
titlestringمتن دکمه.
pricestringپرداخت به شما، USDT.
photostringعکس کانال، گروه یا ربات (برای مینیاپ — عکس ربات آن): لینک یک JPEG دقیقاً 320×320 پیکسل روی
api.brizahub.com، برای همهٔ تسکها یک اندازه. اگر عکس نباشد، یا سایت یا پوشه باشد — تصویر جایگزین به سبک تلگرام با همین اندازه.photo_placeholderbooleantrue— درphotoتصویر جایگزین است (گرادیان و حروف اول): همان را نشان دهید یا تصویر خودتان را بکشید. برای عکس واقعی این فیلد نیست.
نمونه
# 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
بررسی تسکها با دکمه «بررسی».
پارامترها
user_idintegerالزامیfrom.idtask_idsarrayالزامی۱ تا ۲۰
task_id.
فیلدهای پاسخ
resultsarrayیکی برای هر
task_id.statusstringincomplete،pending،completed،unavailable— وضعیتها.reasonstringبرای
unavailable:expired،order_inactive،member،left،not_paid,suspicious،removed،unconfirmed،check_failed،not_found.
نمونه
# 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
کاربر را بررسی میکند و در صورت نیاز بلوک جوین اجباری را از طرف ربات شما نشان میدهد.
پارامترها
user_idintegerالزامیfrom.idchat_idintegerاختیاریپیشفرض —
user_id.limitintegerاختیاری۱ تا ۱۰، بیشتر — ۱۰. پیشفرض — تنظیمات ربات (۵).
language_codestringاختیاریبلوک جوین اجباری به چه زبانی نشان داده شود (
from.language_code، ۳۰ زبان تلگرام). اگر نفرستید — از روی user_id تشخیص میدهیم؛ اگر ندانیم — انگلیسی.is_premiumbooleanاختیاریfrom.is_premiumhas_photobooleanاختیاریآیا کاربر عکس پروفایل دارد (ربات شما با
getUserProfilePhotosآن را میبیند). سفارشهای «فقط با عکس» را میدهد؛ بعد از عضویت خودمان بررسی میکنیم.first_namestringاختیاریfrom.first_name— بعد از عضویت با تلگرام مقایسه میکنیم.messageobjectاختیاریtextتا ۴۰۹۶ نویسه: HTML،parse_modeMarkdownV2یاentitiesاز یک پیام آماده؛ ایموجی پریمیوم،$name— نام کاربر.rows(۱ تا ۳)،button_join،button_channel،button_bot،button_url؛ آیکونbutton_icon(شناسه ایموجی پریمیوم)، رنگbutton_style. ایموجی پریمیوم فقط وقتی دیده میشود که صاحب ربات تلگرام پریمیوم داشته باشد.min_pricestringاختیاریحداقل پرداخت برای هر تسک، USDT، مثلاً
"0.015".smart_linksbooleanاختیاریآیا تسکهای دارای اسمارتلینک را بگیرید. توصیه میکنیم
true: تبلیغدهندگان بیشتر.
فیلدهای پاسخ
skipbooleantrue— عبور دهید،false— نگه دارید.tasksarrayتسکهای بلوک.
message_idintegerپیام بلوک.
نمونه
# 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
پلتفرم شما و شمارندههای امروز.
بدون پارامتر.
فیلدهای پاسخ
platformobjectنام، وضعیت، وبهوک، توکن ربات.
statsobjectامروز و کل.
نمونه
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
آمار روزانه (UTC).
پارامترها
daysintegerاختیاری۱ تا ۹۰ (بیشتر — ۹۰)، پیشفرض ۷.
فیلدهای پاسخ
daysarrayیک ردیف برای هر روز.
نمونه
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
درآمد، USDT.
بدون پارامتر.
فیلدهای پاسخ
balanceobjectavailable— قابل برداشت،pending— در انتظار 24 ساعت،paid— پرداختشده،requested— در درخواست.min_payoutstringحداقل برداشت، USDT.
نمونه
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"
}امتحان کنید
«ارسال» یک درخواست واقعی با کلید شماست.
کد درخواست
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
}اسمارتلینک و کلیک
- اسمارتلینک لینک تسک از طریق مینیاپ ما در تلگرام است (
t.me/BrizaAI?startapp=s_…): کاربر از تلگرام بیرون نمیرود، کارت کانال را با دکمهٔ «عضویت» میبیند و عضو میشود، و ما دستگاه و کشورش را میشناسیم. وقتی شناختیم، ۳۰ روز تسکهایش با لینک مستقیم میآیند؛ برای برخی رباتها اسمارتلینک همیشه هست. کلیک به سایتها هم از طریق مینیاپ است (t.me/BrizaAI?startapp=c_…): کلیک وقتی حساب میشود که کاربر «باز کردن» را بزند — تلگرام تأیید میکند که حساب واقعی است. لینکهای قدیمی…/s/<کد>کار میکنند.linkرا همانطور که هست نشان دهید. - توصیه میکنیم روشن کنید —
"smart_links": true: کلیک روی سایتها (نوعlink، پرداخت فوری) و سفارشهای هدفمند بر اساس دستگاه هم به شما میرسد. تبلیغدهنده بیشتر — درآمد بیشتر. بدون آن — فقط لینک مستقیم کانال، گروه و ربات. - روی دکمههای کلیک یک عنوان عمومی بنویسید، مثلاً «🎁 پیشنهاد»، نه نام سایت.
وبهوک بهجای پرسیدن مداوم
- یک آدرس عمومی
https://در @BrizaHubBot ← «فروش ترافیک» ← ربات شما ← «API» ← «وبهوک» تعیین کنید. کلید مخفی امضا با دکمهٔ «کپی کلید مخفی» کپی میشود و «صدور دوبارهٔ کلید مخفی» آن را عوض میکند. task.pending— عضو شد، پرداخت پس از 24 ساعت؛task.completed— پرداخت شد؛task.left— زودتر خارج شد، پرداخت نمیشود. فیلدها:event_id(در تکرار همان)،task_id،user_id،via(check،join،infer،click)،at.- امضا —
X-Briza-Signature: sha256=<hex>: HMAC-SHA256 روی<X-Briza-Timestamp>.<body>(بایتهای خام بدنه، همانطور که رسیده)، با کل کلید مخفی شما همراهwhsec_. کل رشته را همراهsha256=مقایسه کنید؛ timestamp قدیمیتر از ۵ دقیقه را رد کنید. - تحویل: ظرف ۵ ثانیه با هر پاسخ
2xxجواب دهید — بدنه پاسخ را نمیخوانیم؛ هر چیز دیگر (3xx، 4xx، 5xx، تایماوت) شکست است. تا ۸ بار دوباره میفرستیم: بعد از ۳۰ ثانیه، ۲، ۱۰، ۳۰ دقیقه، ۲، ۶ و ۱۲ ساعت — آخرین تلاش حدود ۲۱ ساعت پس از رویداد، سپس رویداد کنار گذاشته میشود (وضعیت در/v1/tasks/checkمیماند). همه تکرارها همانevent_idرا دارند — یک بار پردازش کنید. رویدادهای یک ربات به ترتیب میآیند، اما رویداد ناموفق ممکن است بعد از رویدادهای جدیدتر برسد. وقتی ربات متوقف یا مسدود است نمیفرستیم؛ رویدادهای قدیمیتر از ۲۴ ساعت کنار گذاشته میشوند. تا ۲۰ رویداد هر ربات در هر ۵ ثانیه؛ دکمه آزمایش — هر دقیقه یک بار.
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'] ?? '');
}وضعیت تسکها
| وضعیت | معنی | ربات شما |
|---|---|---|
incomplete | هنوز عضو نشده | نگه دارید |
pending | عضو شد یا درخواست عضویت داد — پرداخت بعداً (عضو — پس از 24 ساعت) | عبور دهید |
completed | پرداخت شد | عبور دهید |
unavailable | تسک دیگر معتبر نیست، دلیل در reason | عبور دهید |
خطاها و تایماوتها
خطا: {"ok": false, "error": "…"} با کد HTTP؛ در 429 پس از Retry-After ثانیه دوباره بفرستید. مهلت: ۳ ثانیه — پاسخی نیامد، کاربر را نگه ندارید.
| 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 — کلید نیست; bad_key — کلید اشتباه است — آن را در @BrizaHubBot کپی کنید |
| 403 | paused — ربات متوقف است: تسکی نیست; banned — ربات یا حساب مسدود است; read_only — کلید فقطخواندنی: تسکی نیست; on_review — ربات در حال بررسی است — کلید پس از تأیید خودش فعال میشود; rejected — ربات تأیید نشد |
| 409 | no_token |
| 413 | too_large |
| 429 | rate_limited |
| 500 | internal |
ربات کامل
BRIZA_KEY و 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
/v1 از ۰۹.۱۱.۲۰۲۶ پایدار است: فقط افزودههای سازگار — فیلدها و پارامترهای اختیاری تازه. تغییرات ناسازگار در /v2 میآید و ۱۴ روز زودتر اینجا و در @BrizaHub اعلام میشود.
- 26.11.2026 — هر تسک اکنون
photoدارد: عکس کانال، گروه یا ربات با لینک ما (https://api.brizahub.com/photo/…jpg، JPEG 320×320). اگر عکس نباشد، یا سایت یا پوشه باشد — تصویر جایگزین به سبک تلگرام و"photo_placeholder": true. پکیج پایتونbrizahub0.1.3:Sponsor.photo،Sponsor.photo_placeholder. - 23.11.2026 — اسمارتلینک کانال، گروه، ربات یا پوشه اکنون مینیاپ ما در تلگرام است (
t.me/BrizaAI?startapp=s_…) به جای صفحهٔ…/s/…: کارت منبع با دکمهٔ «عضویت»، کاربر از تلگرام بیرون نمیرود؛ مثل همیشه با عضویت حساب میشود. برای برخی رباتها — همیشه.linkرا همانطور که هست نشان دهید. همچنین:limitبیشتر از ۱۰ به ۱۰ کاهش مییابد، به جای400 bad_limit؛daysدر /v1/stats هم همینطور، به ۱ تا ۹۰. - 17.11.2026 —
"suspicious": trueدر پاسخ/v1/tasksو/v1/check— ضدتقلب ما این کاربر را علامت زده است؛ دلیلsuspiciousدر/v1/tasks/check— پرداخت نمیشود. - 13.11.2026 — نوع جدید تسک
app، مینیاپ ربات (t.me/bot/app?startapp=…یاt.me/bot?startapp=…): فقط بدون بررسی؛ همراه با تسک بررسیشدهٔ کناری حساب میشود. عنوان پیشفرض دکمه «باز کردن» است؛ در بلوک آماده ازbutton_urlاستفاده میشود. مینیاپ نمیخواهید — موضوع اسپانسر «مینیاپها» را حذف کنید. در/v1/tasks— فقط با فیلد اختیاری جدید"mini_apps": true. - 11.11.2026 — نوع جدید تسک
folder، پوشه (t.me/addlist/…): کاربر آن را با یک دکمه اضافه میکند و ما با یکی از کانالهایش حساب میکنیم. عنوان پیشفرض دکمه «افزودن پوشه» است؛ نوع ناشناخته را مثلchannelنمایش دهید. پوشه نمیخواهید — موضوع اسپانسر «پوشهها» را حذف کنید. - 10.11.2026 —
messageدر/v1/check: متن تا ۴۰۹۶ نویسه، HTML، MarkdownV2 یاentities، ایموجی پریمیوم،$name، آیکون پریمیوم و رنگ دکمهها. پکیج پایتونpip install brizahub. - 10.11.2026 — تسکهای کلیک (
type: link) اکنون مینیاپ ما را در تلگرام باز میکنند (t.me/BrizaAI?startapp=c_…)؛ کلیک وقتی شمرده میشود که کاربر «باز کردن» را بزند.linkرا همانطور که هست نشان دهید. - ۱۰.۱۱.۲۰۲۶ — کلید API همراه درخواست داده میشود: تا تأیید
403 on_review، در صورت ردrejected. اتصال با لینک ربات، بدون توکن: همهچیز جز/v1/check. فیلدهای جدیدhas_photoوfirst_name؛language_code،is_premiumوhas_photoرا بعد از عضویت بررسی میکنیم. - ۰۹.۱۱.۲۰۲۶ — کلید فقطخواندنی (
bzr_…)، خطایread_only، فیلدread_onlyدر/v1/me. - ۰۹.۱۱.۲۰۲۶ — وضعیتها با پرداخت:
incomplete(نگه دارید)،pending(عضو شد، پرداخت پس از ۲۴ ساعت)،completed(پرداخت شد)، دلیلnot_paid؛ وبهوکهایtask.pending،task.completed،task.left.smart_links— گرفتن تسکهای دارای اسمارتلینک./v1/check: بلوک بدون «بررسی»، به زبانlanguage_code، حداکثر ۲٫۵ ثانیه. بعدتر: دلیلremoved— کانال کاربر را مسدود کرده و نمیتواند عضو شود. - ۰۹.۱۱.۲۰۲۶ — خطاهای کلید
no_key،bad_key،paused،banned؛limitو «زمان بازنشانی فهرست» — پیشفرض از تنظیمات ربات؛ حذفverified،expires_at،repeat_hours. - ۰۸.۱۱.۲۰۲۶ — نخستین نسخه API.
آمادهاید از ترافیک خود درآمد بگیرید؟
ربات خود را در @BrizaHubBot وصل کنید — فقط یک دقیقه طول میکشد.