TMA Launch Tutorial
Telegram Mini Apps (TMA) are web applications that run inside the Telegram messenger. They are built using web technologies — HTML, CSS, and JavaScript. Telegram Mini Apps can be used to create DApps, games, and other types of apps that can be run inside Telegram.
Create your App
- To connect your Mini App to Telegram, place the SDK script
telegram-web-app.js
using this code:
<script src="https://telegram.org/js/telegram-web-app.js"></script>
подсказка
It's preferable to switch off cache in the HTML. To ensure your cache is switched off, specify headers in your request according to the following:
Cache-Control: no-store, must-revalidate
Pragma: no-cache
Expires: 0
-
Once the script is connected, a window.Telegram.WebApp object becomes available. You can read more about creating Mini App utilizing
telegram-web-app.js
here. -
The modern way to connect SDK is an NPM package for Telegram Mini Apps SDK:
- npm
- Yarn
- pnpm
npm i @twa-dev/sdk
yarn add @twa-dev/sdk
pnpm add @twa-dev/sdk
You can find a guide for @twa-dev/sdk
here.
- When your Mini App is ready and deployed to the web server, follow to the next step.