Gem: Telegram How To

Sharing from a Mini App

What it is

A Mini App can prepare something and open Telegram's own window to pass it on: a message for any chat, a picture or video for the person's story, an icon on their phone's home screen. Each time, the person confirms.

How to do it

  1. Message: your bot prepares it for this person with `savePreparedInlineMessage`… Message: your bot prepares it for this person with `savePreparedInlineMessage` and chooses where it may go: chats with users, bots, groups, channels. The app calls `shareMessage` with its id, and Telegram opens the share dialog.
  2. Link: the app opens `t.me/share?url=<link>&text=<text>` with… Link: the app opens `t.me/share?url=<link>&text=<text>` with `openTelegramLink`. The person picks a chat, and the link and text land in the message field.
  3. Story: the app calls `shareToStory` with the HTTPS address of a picture or… Story: the app calls `shareToStory` with the HTTPS address of a picture or video and a caption, and Telegram's story editor opens with it.
  4. Home screen: `checkHomeScreenStatus` tells you whether an icon can be added, and `addToHomeScreen` offers it.

Watch out

With Gem

Everyone in your project gets an invite link, `gem.bot/<name>?i=<code>`, and Telegram's share box with a ready card; the first invite counts. Anyone can post your project to their story from its Mini App with "Share to your story" (only Premium users' stories get the link). Gem doesn't add home screen icons.

Sources

Open in Telegram ↗