SW AdFlow

Documentation

Integrate ads into your Telegram Mini App

Basic Integration: Rewarded Ads

Show a rewarded ad and handle the result.

Display a rewarded ad and give the user their reward only after the ad completes.

window.showAdFlow()
  .then(() => {
    // ✅ Grant the user reward (e.g. coins, points)
    console.log('Ad completed! Reward granted.');
  })
  .catch(e => {
    // ❌ Handle errors (e.g. no ad available)
    console.error('Ad failed:', e);
  });

Good practice

  • Call it from a user action (a button tap) — not in a loop.
  • Show a short message if no ad is available instead of retrying many times.
  • For valuable rewards, record the reward on your own server — anything done only in the browser can be faked.

Still stuck? Our team is happy to help.

Contact Support