From b7a4ccbf34fe4e66b9f7a1418505dd272f110278 Mon Sep 17 00:00:00 2001 From: Coalus Date: Thu, 19 Mar 2026 10:30:53 +0300 Subject: [PATCH 1/4] feat(tma): enhance tma overview page, add page describing apps communication --- docs.json | 1 + ecosystem/tma/apps-communication.mdx | 116 +++++++++++++++++++++++++++ ecosystem/tma/overview.mdx | 43 ++++++++-- resources/dictionaries/custom.txt | 2 + 4 files changed, 156 insertions(+), 6 deletions(-) create mode 100644 ecosystem/tma/apps-communication.mdx diff --git a/docs.json b/docs.json index 96339f2c9..91741a2b5 100644 --- a/docs.json +++ b/docs.json @@ -226,6 +226,7 @@ "group": "TMA: Telegram Mini Apps", "pages": [ "ecosystem/tma/overview", + "ecosystem/tma/apps-communication", "ecosystem/tma/create-mini-app", { "group": "Telegram UI", diff --git a/ecosystem/tma/apps-communication.mdx b/ecosystem/tma/apps-communication.mdx new file mode 100644 index 000000000..c5fc2a603 --- /dev/null +++ b/ecosystem/tma/apps-communication.mdx @@ -0,0 +1,116 @@ +--- +title: "Apps communication" +--- + +The Telegram client and a Mini App communicate through a message-passing interface. The exact transport depends on the platform, but the protocol is the same: the Mini App sends **methods** to the Telegram client, and the Telegram client sends **events** back to the Mini App. + +## Methods and events + +Two terms describe the communication directions: + +- **Methods** — calls sent from the Mini App to the Telegram client. A method triggers an action in the native app (for example, showing a popup or expanding the viewport). +- **Events** — signals sent from the Telegram client to the Mini App. An event notifies the Mini App that something happened (for example, the viewport changed or a button was pressed). + +Internally both are messages, but "methods" and "events" distinguish the direction throughout the Mini Apps platform. + +## Transport by platform + +The transport mechanism varies by Telegram client: + +| Platform | Transport | Details | +|----------|-----------|---------| +| Web (Telegram Web A, Web K) | `window.parent.postMessage` | The Mini App runs in an `