Skip to content

twa-dev/SDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6bab68c · Feb 5, 2025

History

90 Commits
Sep 7, 2024
Nov 27, 2024
Aug 16, 2022
Sep 7, 2024
Aug 16, 2022
Sep 10, 2024
Aug 16, 2022
Aug 16, 2022
Dec 11, 2024
Feb 5, 2025
Feb 5, 2025
Oct 22, 2023

Repository files navigation

SDK

npm version

npm package for Telegram Web Apps (TWA) SDK.

npm i @twa-dev/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?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:

import WebApp from '@twa-dev/sdk'

WebApp.showAlert('Hey there!');

And yes, it supports TS.

Demo

Codesandbox

React

If you use React in your project, check out components that we have prepared for you.

These components significantly simplify developer experience.