Integrating Ads into Your Telegram Bot
After your block is created and approved, you can start showing ads in your Telegram bot.
Step 1 — API Request
Send a GET request to:
https://api.adsgram.ai/advbot?tgid={TELEGRAM_USER_ID}&blockid={BLOCK_ID}
tgid
— Telegram user IDblockid
— your Ad Block ID (from dashboard)
IMPORTANT
Use only the numeric part of the blockid, without the bot-
prefix.
Step 2 — Handling the Response
The API returns:
{
"text_html": "<a href='https://api.adsgram.ai/short/AwJ8ughbhDH'>Follow Velo For The Coming Big Announcement</a>\n<a>\nVelo\n\nMiss the Velo X Blackrock announcement previously?\nFollow Velo X now!\n\n<a href='https://api.adsgram.ai/short/DvvpNWxAtaG'>Click here to claim the reward after completing task!</a>\nAd. 18+</a>",
"click_url": "https://api.adsgram.ai/short/AwJ8ughbhDH",
"button_name": "Follow us!",
"image_url": "https://images.adsgram.ai/3d618923-ba5f-4589-a3a8-ed97bd301435",
"button_reward_name": "Claim reward!",
"reward_url": "https://api.adsgram.ai/short/DvvpNWxAtaG"
}
Step 3 — Send the Ad
Use the returned data to build your message:
text_html
→ message text (HTML format)image_url
→ ad imagebutton_name
+click_url
→ inline buttonbutton_reward_name
+reward_url
→ inline buttonParseMode
= HTML
✅ Example implementation available in previous section.
IMPORTANT
text_html
contains HTML tags. Always set ParseMode.HTML in your bot framework.- Ad messages sent via the bot must not be forwardable.
You should use Telegram message types that prevent forwarding, such as sendPhoto or sendMessage with the protect_content=True parameter in the Telegram API.
Multilingual Bots
If your bot supports multiple languages, you can specify the desired language in the ad request using the language
parameter.
Example request with language:
https://api.adsgram.ai/advbot?blockid=123&tgid=123&language=en
If the language
parameter is included, AdsGram will serve ads in the specified language.
If the parameter is missing, the system will fallback to the language detected from the Telegram interface.
✅ Done — your bot can now natively display ads from AdsGram.