SW AdFlow

Documentation

Integrate ads into your Telegram Mini App

Where to Put the Ad Code

Plain HTML, React and Vue examples plus a testing checklist.

Plain HTML

Put the SDK <script> inside <head>, then call window.showAdFlow() from your own script (see Installation).

React

Add the SDK line to index.html, then:

function WatchAdButton({ onReward }) {
  const watch = () => {
    window.showAdFlow()
      .then(() => onReward())
      .catch(() => alert('No ad available right now'));
  };

  return <button onClick={watch}>Watch ad</button>;
}

Vue

const watchAd = () => {
  window.showAdFlow()
    .then(() => rewardUser())
    .catch(() => showMessage('No ad available right now'));
};

Testing checklist

  • Open the Mini App from your bot in Telegram (not only in a desktop browser)
  • The SDK line is in <head> and the App ID matches your dashboard
  • Your app is Approved — before approval showAdFlow() returns an error
  • Don't click your own ads repeatedly while testing — it can be flagged as invalid traffic

Still stuck? Our team is happy to help.

Contact Support