tma-sdk
v7.4.1
Published
[![npm version](https://img.shields.io/npm/v/tma-sdk)](https://www.npmjs.com/package/tma-sdk)
Downloads
21
Maintainers
Readme
SDK
npm package for Telegram Web Apps (TWA) SDK.
npm i tma-sdk
Motivation
Telegram distributes SDK via link. It's kinda old fashion way to work with a library:
<html lang="en">
<head>
<title>TWA</title>
<meta charset="UTF-8" />
<script src="https://telegram.org/js/telegram-web-app.js"></script>
<script>
window.Telegram.WebApp.showAlert("Hey there!");
</script>
</head>
<body></body>
</html>
This package allows to work with SDK as with a npm package:
import WebApp from "tma-sdk";
WebApp.showAlert("Hey there!");
And yes, it supports TS.
Demo
React
If you use React in your project, check out MainButton and BackButton components that we have prepared for you. These components significantly simplify developer experience.