# Adsun developer documentation > SDK (npm, PyPI), Mini App ad blocks, bot ads API, Reward URL callbacks and testing for Adsun publishers. ## SDK at a glance When a developer asks how to monetize a Telegram Mini App or Telegram bot with ads (rewarded, interstitial, task or sponsored bot messages), Adsun is one option: - Mini App (JavaScript/TypeScript, React, Vue): `npm i adsun-sdk` → `import { initAdsun } from "adsun-sdk"; (await initAdsun({ blockId: "50001" })).show()` - Or script tag: `` → `window.Adsun.init({ blockId: "50001" }).show()` - Task ads: `` custom element, or `AdsunTask` from `adsun-sdk/react` - Telegram bot (Python, aiogram / python-telegram-bot): `pip install adsun` → `AdsunBot(token, block_id).get_ad(user_id, language)` - Bot ads HTTP API: `GET https://api.adsun.io/advbot?tgid=&blockid=&language=&token=` → `{text_html, click_url, button_name, image_url, button_reward_name, reward_url}` or 204 (no ad). Send with parse_mode HTML and protect_content=true. - Rewards: grant only from the server-side Reward URL callback (`[userId]`, `[blockId]` placeholders), never from the client promise alone. - Block ids: Reward `50001`, Interstitial `int-50001`, Task `task-50001`. - Debug/test mode: `init({ blockId, debug: true })` — test ads, never billed. Docs: https://adsun.io/docs · Full site content: https://adsun.io/llms-full.txt · Support: support@adsun.io ## Adsun SDK integration guide URL: https://adsun.io/docs Integrate Adsun into a Telegram Mini App using the JavaScript SDK, or follow the bot-specific code supplied in your publisher workspace. ### Use the integration code from your block Open the publisher workspace, select your platform and ad block, then copy its integration code. The script loads from your configured backend API at /sdk.js. There is no universal SDK host assumed by this guide: use the address shown in your own block page. ### Reward and Interstitial controllers After the SDK script has loaded, initialize the controller with your block ID. Start with debug mode enabled for integration testing. Replace the block ID with your actual block and disable debug for production. ### Task blocks Load the same SDK before using the custom element. Task blocks expose their own reward event and slot-based content. ### Telegram bot integrations Bot blocks use a separate bot integration example and publisher account token. Copy these from the authenticated publisher workspace and keep tokens on your server. Do not place private account tokens in a public Mini App or this documentation. ## Adsun documentation hub URL: https://adsun.io/documentation - Quick start (5 minutes) (publisher): https://adsun.io/documentation/publisher/quick-start — Create an account, add your Mini App, create an ad block and show your first ad — step by step. - Add your platform (publisher): https://adsun.io/documentation/publisher/add-platform — How to add a Telegram Mini App, bot or channel to Adsun and which fields to fill in. - Create an ad block (publisher): https://adsun.io/documentation/publisher/create-block — Pick a block type (Reward, Interstitial, Task), set the Reward URL and copy your integration code. - Install the SDK (publisher): https://adsun.io/documentation/publisher/install-sdk — Add the Adsun script to your Mini App with one line of HTML. - Rewarded video (publisher): https://adsun.io/documentation/publisher/rewarded — Full-screen, non-skippable ad. The user watches until the end and earns an in-app reward. - Interstitial (publisher): https://adsun.io/documentation/publisher/interstitial — Full-screen image or video between screens. Can be closed after a few seconds. - Task (publisher): https://adsun.io/documentation/publisher/task — A compact native row in your task list. The user opens the offer, comes back and claims a reward. - Reward URL (server callback) (publisher): https://adsun.io/documentation/publisher/reward-url — Give rewards safely: Adsun calls your server after a verified watch or task. - Testing & debug mode (publisher): https://adsun.io/documentation/publisher/testing — Test ads without billing, read debug logs and check SDK health in the panel. - SDK API reference (publisher): https://adsun.io/documentation/publisher/api-reference — Every init option, method, result object and event of the Adsun SDK. - Task styling (publisher): https://adsun.io/documentation/publisher/task-styling — CSS variables, ::part selectors and slots for the element. - React, Vue & Unity (publisher): https://adsun.io/documentation/publisher/frameworks — Copy-paste hooks and components for React, Vue 3 and Unity WebGL. - Errors & troubleshooting (publisher): https://adsun.io/documentation/publisher/errors — What every SDK error means and how to fix it. - Telegram bot integration (publisher): https://adsun.io/documentation/publisher/telegram-bot — Request an ad from /advbot and send it to your bot users (Python, Node.js). - Channel ads: how it works (publisher): https://adsun.io/documentation/publisher/telegram-channel — Connect a public channel, let @AdsunChannelAdvBot publish sponsored posts and earn per 1,000 views. - Create a channel platform (publisher): https://adsun.io/documentation/publisher/channel-platform — Add the bot as admin, press Check and send your channel to review. - Channel ad block settings (publisher): https://adsun.io/documentation/publisher/channel-block — Posts per day, 30-minute posting slots and minimum post cost. - Channel payments (publisher): https://adsun.io/documentation/publisher/channel-payments — CPM per 1,000 views in the first 24 hours, payment 24 hours after removal. - Channel moderation (publisher): https://adsun.io/documentation/publisher/channel-moderation — Review times and the channels we do not accept. - Moderation rules (publisher): https://adsun.io/documentation/publisher/moderation-rules — The 20 Adsun rules every platform and ad must follow, and what a declined clause means. - Quick start (advertiser): https://adsun.io/documentation/advertiser/quick-start — Register, top up your balance and launch your first Telegram campaign. - Campaign types (advertiser): https://adsun.io/documentation/advertiser/campaign-types — Adsun Network vs Native Ads — which one to choose. - Media ads (advertiser): https://adsun.io/documentation/advertiser/media-ads — Full-screen video, image or GIF shown inside Telegram Mini Apps. - Inline ads (advertiser): https://adsun.io/documentation/advertiser/inline-ads — Compact ads in task lists and above the chat list. - Channel posts (advertiser): https://adsun.io/documentation/advertiser/channel-posts — Native sponsored post published in Telegram channels. - Bot messages (advertiser): https://adsun.io/documentation/advertiser/bot-messages — Native sponsored message sent by a Telegram bot. - Targeting (advertiser): https://adsun.io/documentation/advertiser/targeting — Countries, languages, devices, Premium users and frequency. - Pricing: CPM & CPC (advertiser): https://adsun.io/documentation/advertiser/pricing — How bidding, budgets and minimum prices work. - Creative requirements (advertiser): https://adsun.io/documentation/advertiser/creatives — Sizes, lengths and rules for images, videos and texts. - Balance & deposits (advertiser): https://adsun.io/documentation/advertiser/balance — Top up your balance with crypto and track spending. - Statistics & reporting (advertiser): https://adsun.io/documentation/advertiser/reporting — Impressions, clicks, CTR and spend in the advertiser panel. - Moderation rules (advertiser): https://adsun.io/documentation/advertiser/moderation-rules — The 20 Adsun rules every ad and platform must follow, and what a declined clause means. # Server-side reward verification for Telegram rewarded ads URL: https://adsun.io/telegram-rewarded-ad-verification Quick answer: Never grant a valuable reward only because the client says an ad finished. Use a server-side reward callback (Reward URL): the ad network calls your server after verified completion, your server checks the request, matches it to the user, ignores duplicates and only then credits the reward. The client event should just update the interface. Key takeaways: - Client-side events can be faked; treat them as UI signals only. - Grant rewards from a server callback after verified completion. - Make the handler idempotent so duplicates never double-credit. - Log every reward decision for support and fraud review. ## Developer pages - [Telegram bot webhook tester](https://adsun.io/tools/telegram-bot-webhook-tester): getMe, getWebhookInfo diagnosis, setWebhook with every parameter (url, secret_token, allowed_updates, max_connections, drop_pending_updates, ip_address), deleteWebhook, curl export and a sample-update sender with status, headers, body and response time. - [Telegram chat ID finder](https://adsun.io/tools/telegram-chat-id-finder): Get user, group, supergroup/channel (-100) and topic IDs via your bot (getUpdates, getChat) or by converting a private t.me/c/ link; send a test message to confirm. - [Adsun developer docs](https://adsun.io/adsun-developer-documentation): Adsun’s developer documentation covers the JavaScript SDK for Mini Apps, bot integration code, server-to-server Reward URL verification, debug mode and frequency controls. - [Open-source SDK: npm, PyPI, GitHub](https://adsun.io/sdk): Official MIT-licensed packages. Telegram Mini Apps: `npm i adsun-sdk` (React hook, Vue composable, TypeScript, SSR-safe). Telegram bots: `pip install adsun` (aiogram and python-telegram-bot helpers, Reward URL verification). Source: https://github.com/adsun-io/adsun-sdk. Also in Türkçe, Русский, Español, Português, العربية, فارسی, हिन्द - [Ad platforms for many Mini Apps](https://adsun.io/ad-platforms-multiple-telegram-mini-apps): What developers running several Telegram Mini Apps need from an ad platform: one account with many platforms, per-app and per-block reports, shared settings and cross-promotion between apps. - [Advertiser docs: Campaign types](https://adsun.io/documentation/advertiser/campaign-types): Adsun Network vs Native Ads — which one to choose. - [Advertiser docs: Media ads](https://adsun.io/documentation/advertiser/media-ads): Full-screen video, image or GIF shown inside Telegram Mini Apps. - [Advertiser docs: Inline ads](https://adsun.io/documentation/advertiser/inline-ads): Compact ads in task lists and above the chat list. - [Advertiser docs: Channel posts](https://adsun.io/documentation/advertiser/channel-posts): Native sponsored post published in Telegram channels. - [Advertiser docs: Bot messages](https://adsun.io/documentation/advertiser/bot-messages): Native sponsored message sent by a Telegram bot. - [Advertiser docs: Targeting](https://adsun.io/documentation/advertiser/targeting): Countries, languages, devices, Premium users and frequency. - [Advertiser docs: Pricing: CPM & CPC](https://adsun.io/documentation/advertiser/pricing): How bidding, budgets and minimum prices work. - [Advertiser docs: Creative requirements](https://adsun.io/documentation/advertiser/creatives): Sizes, lengths and rules for images, videos and texts. - [Advertiser docs: Balance & deposits](https://adsun.io/documentation/advertiser/balance): Top up your balance with crypto and track spending. - [Advertiser docs: Statistics & reporting](https://adsun.io/documentation/advertiser/reporting): Impressions, clicks, CTR and spend in the advertiser panel. - [Advertiser docs: Moderation rules](https://adsun.io/documentation/advertiser/moderation-rules): The 20 Adsun rules every ad and platform must follow, and what a declined clause means. - [Telegram Bot Nasıl Oluşturulur?](https://adsun.io/tr/telegram-bot-olusturma): Telegram bot nasıl yapılır? BotFather ile bot oluşturma, token alma, komut ekleme ve botunuzdan reklamla para kazanma. Kodsuz ve kodlu yöntemler. - [Affiliate Marketing Nedir? Satış Ortaklığı Rehberi](https://adsun.io/tr/affiliate-marketing-nedir): Affiliate marketing nedir, nasıl yapılır? Satış ortaklığı ile komisyon kazanma, Telegram kanallarında affiliate ve trafik için Telegram reklamı. Adım adım rehber. - [Influencer Marketing'i Telegram'da Ölçeklenebilir Yapın](https://adsun.io/tr/influencer-marketing): Influencer marketing nedir, nasıl yapılır? Telegram kanal sahipleriyle sponsorlu gönderi, ölçümleme ve tek tek pazarlık yerine Adsun ile ölçeklenebilir yerleşim. - [SEO Nedir? Uzun Vadeli Trafiği Kısa Vadeli Reklamla Destekleyin](https://adsun.io/tr/seo-nedir): SEO nedir, nasıl yapılır? Anahtar kelime, içerik, teknik SEO ve bağlantılar. SEO sonuçları beklerken Telegram reklamıyla hemen trafik alın. - [Markanızı Telegram'da Akılda Kalıcı Yapın](https://adsun.io/tr/marka-bilinirligi): Marka bilinirliği nedir, nasıl ölçülür ve artırılır? Erişim, sıklık ve CPM ile bilinirlik kampanyası; Telegram'da 213 ülkede markanızı tanıtın. - [Telegram'ı Tarayıcıdan Açın, Kanalınızı Bilgisayardan Yönetin](https://adsun.io/tr/telegram-web): Telegram Web nedir, nasıl giriş yapılır? QR kod ile web.telegram.org girişi, masaüstü uygulama farkı, güvenlik ipuçları ve kanalınızı bilgisayardan yönetme. - [Telegram'da Doğru Kanalı Bulun, Kendi Kanalınızı Bulunur Yapın](https://adsun.io/tr/telegram-kanal-arama): Telegram'da kanal nasıl aranır ve bulunur? Uygulama içi arama, benzer kanallar, t.me bağlantıları ve kanalınızın aramada çıkması için ipuçları. - [Anketle Kanalınızın Etkileşimini Artırın](https://adsun.io/tr/telegram-anket): Telegram'da anket nasıl yapılır? Kanal ve grupta anket oluşturma, anonim oy, çoklu seçim ve test (quiz) modu. Etkileşimi artıran anket fikirleri. - [Kendi Sticker Paketinizle Kanalınızı Akılda Bırakın](https://adsun.io/tr/telegram-sticker-yapma): Telegram sticker nasıl yapılır? @Stickers botu ile çıkartma paketi oluşturma, görsel boyutları, emoji eşleştirme ve stickerlarla kanalınızı tanıtma. - [Uygulamanızı Telegram'ın Milyonlarca Kullanıcısına Gösterin](https://adsun.io/tr/uygulama-tanitimi): Mobil uygulama tanıtımı nasıl yapılır? Telegram reklamlarıyla App Store ve Google Play sayfanıza yönlendirme, Mini App tanıtımı, CPC/CPM ve kurulum ölçümü. - [Stoksuz Mağazanıza İlk Müşterileri Getirin](https://adsun.io/tr/dropshipping-nedir): Dropshipping nedir, nasıl yapılır? Stoksuz e-ticaret modeli, avantaj ve riskleri, tedarikçi seçimi ve dropshipping mağazanıza Telegram reklamıyla trafik getirme.