npm package for Telegram Web Apps (TWA) SDK.
npm i @twa-dev/sdk
Telegram distributes SDK via link. It's kinda old fashion way to work with a library:
<htmllang="en"><head><title>TWA</title><metacharset="UTF-8"><scriptsrc="https://telegram.org/js/telegram-web-app.js?56"></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:
importWebAppfrom'@twa-dev/sdk'WebApp.showAlert('Hey there!');And yes, it supports TS.
If you use React in your project, check out components that we have prepared for you.
These components significantly simplify developer experience.