SW AdFlow

Documentation

Integrate ads into your Telegram Mini App

Installation: Add the SDK

Load the SW AdFlow SDK in your Mini App.

Add the SDK inside the <head> of the HTML page your bot opens. It creates the function window.showAdFlow() that you call to display ads.

<script src="https://shohojworldit.my.id/ads/sdk.js?id=YOUR_APP_ID"></script>

Complete example page

<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <script src="https://telegram.org/js/telegram-web-app.js"></script>
  <script src="https://shohojworldit.my.id/ads/sdk.js?id=YOUR_APP_ID"></script>
</head>
<body>
  <button id="watch">Watch ad &amp; get 10 coins</button>

  <script>
    Telegram.WebApp.ready();

    document.getElementById('watch').addEventListener('click', () => {
      window.showAdFlow()
        .then(() => {
          // ✅ give 10 coins
        })
        .catch(() => {
          // ❌ no ad right now — try again later
        });
    });
  </script>
</body>
</html>

Your App ID is already filled in when you copy the code from Publisher → Apps → Code.

Still stuck? Our team is happy to help.

Contact Support