Skip to content

Telegram Bot Integration Guide ​

How to send Adexium ads to the users of your Telegram bot.

Create a placement ​

In the publisher cabinet choose New placement → Telegram Bot and fill in:

  • Bot link — the public t.me link of your bot. Our team reviews it; it cannot be changed after creation.
  • Bot ID — the part before : in your bot token from @BotFather (token 1234567890:AAH… → ID 1234567890). Enter the number only, never the token. It must be the bot from your link.
  • Blocked ad categories — categories you don't want to show to your users.

The placement page then shows your Placement ID (WID) — the wid in the requests below.

Request an ad ​

Send a POST request to https://bid.tgads.live/bot-request. wid is your Placement ID (WID).

shell
curl --location 'https://bid.tgads.live/bot-request' \
     --header 'Content-Type: application/json' \
     --data '{
        "wid": "99220c34-31b8-45f6-bff5-8bd896fd5e09",
        "language": "en",
        "isPremium": true,
        "firstName": "Andrew",
        "telegramId": "123456789"
     }'

Ad response ​

The response is a JSON list with one ad:

json
[
    {
        "id": "3422b8e8-2461-4fd2-9183-80a0de6f8343",
        "image": "https://go.tgads.live/image.png",
        "clickUrl": "https://go.tgads.live/click",
        "buttonText": "Go!",
        "text": "Current news and market analysis!"
    }
]

When there is no ad for this user, the response is an empty list [] — send nothing. An unknown wid returns 404.

Send the ad to the user ​

Send the ad to the user once via the Telegram Bot API, using image, text, buttonText and clickUrl from the response:

shell
curl --location 'https://api.telegram.org/bot<YOUR_BOT_TOKEN>/sendPhoto' \
     --form 'chat_id="123456789"' \
     --form 'photo="https://go.tgads.live/image"' \
     --form 'caption="Current news and market analysis!"' \
     --form 'reply_markup="{\"inline_keyboard\":[[{\"text\":\"GO\!\",\"url\":\"https://go.tgads.live/click\"}]]}"'