Publishers · Bots & channels
Telegram bot integration
Request an ad from /advbot and send it to your bot users (Python, Node.js).
Telegram bot
bot
/start
Image or GIF · 1:1
Your headline
Your brand
Up to 764 characters about your product.
Ad · 18+
Go!
Message
What your user sees
A normal bot message with an image, text and two buttons: one opens the advertiser, one gives the reward. Messages are protected — they cannot be forwarded.
Step 1 — Get your token
Look at the bottom of the sidebar in the publisher panel, under your account name: there is a Token row with a masked value. Press the copy button next to it. You can regenerate it from the same place — the old token stops working immediately.
Step 2 — Request an ad
https://api.adsun.io/advbot?tgid={TELEGRAM_USER_ID}&blockid=50001&language={LANGUAGE}&token={your_token}| Param | Description |
|---|---|
tgid | Telegram user ID |
blockid | Block number only (without prefix) |
language | Ad language, e.g. en |
token | Your account token |
Response 200 = an ad, 204 = no ad right now.
{
"text_html": "<a href='…/short/AwJ8ughbhDH'>Follow Velo</a>\nAd. 18+",
"click_url": "…/short/AwJ8ughbhDH",
"button_name": "Follow us!",
"image_url": "https://…/image.jpg",
"button_reward_name": "Claim reward!",
"reward_url": "…/short/DvvpNWxAtaG"
}Step 3 — Send it
import aiohttp
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from aiogram.enums import ParseMode
TOKEN = "your_token"
BLOCK_ID = "50001"
async def show_ad(bot, chat_id: int, user_id: int, language: str = "en"):
params = {"tgid": user_id, "blockid": BLOCK_ID, "language": language, "token": TOKEN}
async with aiohttp.ClientSession() as s:
async with s.get("https://api.adsun.io/advbot", params=params) as r:
if r.status != 200:
return # 204 = no ad right now
ad = await r.json()
kb = InlineKeyboardMarkup(inline_keyboard=[
[InlineKeyboardButton(text=ad["button_name"], url=ad["click_url"])],
[InlineKeyboardButton(text=ad["button_reward_name"], url=ad["reward_url"])],
])
if ad.get("image_url"):
await bot.send_photo(chat_id, photo=ad["image_url"], caption=ad["text_html"],
parse_mode=ParseMode.HTML, reply_markup=kb, protect_content=True)
else:
await bot.send_message(chat_id, ad["text_html"], parse_mode=ParseMode.HTML,
reply_markup=kb, protect_content=True)
# IMPORTANT:
# - text_html contains HTML tags. Always set ParseMode.HTML in your bot framework.
# - Ad messages sent via the bot must not be forwardable — use sendPhoto or
# sendMessage with the protect_content=True parameter.IMPORTANT
text_htmlcontains HTML — always useparse_mode: HTML.- Always send with
protect_content: true.
Still stuck? Write to support@adsun.io or our Telegram support — we answer fast.