Nanfeng

Notes on software development, code, and curious ideas

Sharing and Opening a Telegram Mini App

Suppose a game should open Telegram’s chat list so the player can share it without leaving the game:

Share example

Two approaches are available:

  1. Open a URL such as https://t.me/share/url?url=https://lengmo714.top. In Cocos Creator, call sys.openURL(url). On desktop, this can close the current Mini App.
  2. Prefer Telegram’s Web App API:
1
window.Telegram?.WebApp.openTelegramLink(url);

This keeps the Mini App open on desktop.

Open a Mini App directly

A bot can launch the app, but requiring users to open the bot and press Start adds friction. A BotFather short link can launch the Mini App directly.

In @BotFather:

1
2
3
4
5
6
7
8
1. Select /newapp
2. Choose the bot
3. Enter the app or game name
4. Enter a description
5. Upload a 640×360 image
6. Send /empty when appropriate
7. Enter the Web App URL
8. Choose a short name

BotFather returns a Web App link. A recipient can use that shared link to enter the game directly.

BotFather setup

Generated link

+