Related TL schema:
sponsoredMessage#4d93a990 flags:# recommended:flags.5?true can_report:flags.12?true random_id:bytes url:string title:string message:string entities:flags.1?Vector<MessageEntity> photo:flags.6?Photo media:flags.14?MessageMedia color:flags.13?PeerColor button_text:string sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage;
messages.sponsoredMessages#c9ee1d87 flags:# posts_between:flags.0?int messages:Vector<SponsoredMessage> chats:Vector<Chat> users:Vector<User> = messages.SponsoredMessages;
---functions---
messages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessages;
Each time the user opens a channel or a chat with a bot, messages.getSponsoredMessages must be called to receive sponsored messages available for the channel or bot. The result must be cached for 5 minutes.
Sponsored messages must be displayed as follows:
In channels, they must be displayed below all other posts in the channel, after the user scrolls further down, past the last message.
Sponsored channel messages have:
title
)message
+entities
)button_text
) that when clicked, opens the URL in url
.(^|\\.)(telegram\.(org|me|dog)|t\.me|te\.?legra\.ph|graph\.org|fragment\.com|telesco\.pe)$
, in which case the URL should be opened without confirmation (and if it's a deep link », it should be opened directly in-app, without passing through the browser). The message should be marked as "Recommended" instead of "Sponsored" if the recommended
flag is set.
If the photo
flag is set, it should be used to display a profile photo bubble for the sponsored message, like for messages sent in groups.
If the sponsor_info
or additional_info
flags are set, an additional "Sponsor info" menu item must be present in the message context menu (the menu that pops up when clicking on a button), that when clicked, displays the contents of the flags.
In bots, they must be displayed above the chat, akin to an action bar Bot ads have:
title
): must be locally prepended with a blue-colored "Ad" prefix, or a "Recommended" prefix if the recommended
flag is set. message
+entities
)url
.(^|\\.)(telegram\.(org|me|dog)|t\.me|te\.?legra\.ph|graph\.org|fragment\.com|telesco\.pe)$
, in which case the URL should be opened without confirmation (and if it's a deep link », it should be opened directly in-app, without passing through the browser). If the photo
flag is set, a thumbnail-sized version of it should be displayed in the right section of the action bar.
If set, the sponsored message/action bar should use the message accent color » specified in color
.
---functions---
messages.viewSponsoredMessage#673ad8f1 peer:InputPeer random_id:bytes = Bool;
Once the entire text of the ad is shown on the screen (excluding the button for channel ads), messages.viewSponsoredMessage must be called with the random_id
of the sponsored message.
---functions---
messages.clickSponsoredMessage#f093465 flags:# media:flags.0?true fullscreen:flags.1?true peer:InputPeer random_id:bytes = Bool;
If the user either:
messages.clickSponsoredMessage must be called with the random_id
of the sponsored message.
sponsoredMessage#4d93a990 flags:# recommended:flags.5?true can_report:flags.12?true random_id:bytes url:string title:string message:string entities:flags.1?Vector<MessageEntity> photo:flags.6?Photo media:flags.14?MessageMedia color:flags.13?PeerColor button_text:string sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage;
sponsoredMessageReportOption#430d3150 text:string option:bytes = SponsoredMessageReportOption;
channels.sponsoredMessageReportResultChooseOption#846f9e42 title:string options:Vector<SponsoredMessageReportOption> = channels.SponsoredMessageReportResult;
channels.sponsoredMessageReportResultAdsHidden#3e3bcf2f = channels.SponsoredMessageReportResult;
channels.sponsoredMessageReportResultReported#ad798849 = channels.SponsoredMessageReportResult;
---functions---
messages.reportSponsoredMessage#1af3dbb8 peer:InputPeer random_id:bytes option:bytes = channels.SponsoredMessageReportResult;
To report a sponsored message to Telegram's moderators, invoke messages.reportSponsoredMessage, passing the channel/bot ID, the random_id
of the sponsored message and an empty option
field.
Note that only sponsored messages with the sponsoredMessage.can_report
flag set may be reported.
Then, if the result is:
options
, and after selection, the method must be invoked again, passing the option's option
field to the option
parameter of channels.reportSponsoredMessage.title
field of channels.sponsoredMessageReportResultChooseOption must be used as title of the option selection popup. The method may also return:
AD_EXPIRED
RPC error, for expired (too old or not found) adsPREMIUM_ACCOUNT_REQUIRED
RPC error, if the user asked to hide sponsored messages in the chosen option, but Telegram Premium is required for this action. For the channel https://t.me/SecretAdTestChannel the system will always return a sponsored message: promoting either a channel, a particular message in a channel, or a bot with a start parameter.
Telegram has one of the most generous reward systems in the history of social media. Telegram channel/bot owners can now receive 50% of the revenue from ads displayed in their channels.
See here » for more info on how to withdraw channel/bot ad revenue, as well as view detailed revenue stats.
Telegram continues to grow worldwide, in part thanks to third-party apps using the Telegram API. To cover the increasing costs that come with this growth, Telegram added sponsored messages – a paid privacy-friendly way to promote bots and channels.
If their app allows its users to access content from Telegram channels, third-party developers using the Telegram API are required to support and properly display official sponsored messages in their apps by January 1, 2022. Unfortunately, Telegram cannot financially sustain third-party apps that do not display sponsored messages and they will have to be disconnected.
Telegram's API usage will continue to be free of charge for all developers. The rules regarding monetization in third-party apps remain the same: developers are allowed to monetize their coding efforts through advertising of their own or other legitimate means, provided that all the methods of monetization used in their apps are prominently mentioned in their app store descriptions.