From sgcWebSockets 2022.3.0, Sponsored Messages are supported. Sponsored Messages requires Telegram 1.8.0+, so the Telegram libraries have been updated to support this feature.
Sponsored messages on Telegram are displayed in large public one-to-many channels with 1000+ subscribers and are limited to 160 characters. Sponsored Messages are based solely on the topic of the public channels in which they are shown.
This means that no user data is mined or analyzed to display ads, and every user viewing a particular channel on Telegram sees the same sponsored messages.
Getting sponsored messages
Each time the user opens a channel, channels.getSponsoredMessages
must be called to receive sponsored messages available for this channel. The result must be cached for 5 minutes.
Displaying sponsored messages
Sponsored messages must be displayed below all other posts in the channel, after the user scrolls futher down, past the last message. The promoted channel or bot specified in the from_id
field must be displayed as the author of the message. The message should also contain one of the following buttons at the bottom:
- View Bot — if a bot is being promoted. Tapping the button must open the chat with the bot. If
start_param
is specified, the app must use the deep linking mechanism to open the bot. - View Channel — if a channel is being promoted. Tapping the button must open the channel.
- View Post — if a channel is being promoted and
channel_post
is specified. Tapping the button must open the particular channel post.
Example
Find below an example to request and show Sponsored Messages using sgcWebSockets library.