Postbacks

Overview #

Monetag SDK for Telegram Mini Apps allows you to monetize your app by displaying ads — but showing an ad is only half the story.

To complete the monetization cycle, you need to know when an ad was actually shown or clicked, and optionally reward the user. This is where two mechanisms come into play:

  • Frontend Callbacks — triggered inside your app via the SDK
  • Server-Side Postbacks — triggered from Monetag’s backend when an event is confirmed

Frontend Callback #

When you use the Monetag SDK and call show_XXX(), it returns a Promise. This mechanism is known as a Frontend Callback.

By default, the Promise resolves after the SDK attempts to show the ad — regardless of whether the ad was ultimately shown or monetized.

show_XXX().then(() => {
  // Frontend Callback triggered
  // You can reward the user here (if applicable)
});

However, Monetag supports an optional mode in which the Promise resolves only after backend confirmation that the ad event (e.g., impression or click) was successfully processed. This feature can be enabled per SDK zone on request.

When to use Frontend Callback

Frontend Callbacks are useful when:

  • You want to update the UI (e.g., show “Reward granted!”)
  • You’re working with simple or non-critical logic
  • You’re using non-rewarded or optional ads

⚠️ Important: By default, Frontend Callbacks do not guarantee monetization. They only confirm that the SDK executed the ad logic.

Server-Side Postbacks #

Server-side postbacks are HTTP requests sent from Monetag to your backend when a monetized event is confirmed in our system — such as:

  • A user viewed an ad (impression)
  • A user clicked an ad (click)

They are essential when:

  • You want to grant reliable rewards from your backend
  • You need trusted data for analytics or billing
  • You need protection from fraud or client-side manipulation

Example request:

GET https://your-backend.com/postback?ymid=user123&event=click&zone_id=xxxxxx&request_var=start_button&telegram_id=123324&estimated_price=0.0023

You can configure postback URLs directly in the Monetag SSP interface:

Postback configuration example

Each SDK zone has its own postback URL.
If you use multiple formats inside the same Mini App, you can use the {sub_zone_id} macro to distinguish between them.

Postback macro example

See the Macro Reference for full details.

Which should I use? #

Use CaseFrontend CallbackServer-Side Postback
Show success messageOptional
Track exact monetization
Reward user with coins⚠️ Risky
Trigger analytics event
Fraud protection
Offline reliability

Summary #

  • Use Frontend Callbacks for UI and simple reward logic
  • Use Server-Side Postbacks for verified monetization and backend-driven rewards
  • You can use both in parallel — UI via callback, accounting via postback
  • Postbacks can now be configured directly in your SSP dashboard