Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/twa-dev/sdk

npm package for TWA SDK
https://github.com/twa-dev/sdk

react sdk telegram telegram-bot twa-dev

Last synced: 1 day ago
JSON representation

npm package for TWA SDK

Awesome Lists containing this project

README

        

## SDK
[![npm version](https://img.shields.io/npm/v/@twa-dev/sdk)](https://www.npmjs.com/package/@twa-dev/sdk)

npm package for [Telegram Web Apps (TWA)](https://core.telegram.org/bots/webapps) SDK.

```
npm i @twa-dev/sdk
```

### Motivation
Telegram distributes SDK via [link](https://core.telegram.org/bots/webapps#initializing-web-apps). It's kinda old fashion way to work with a library:

```html

TWA



window.Telegram.WebApp.showAlert('Hey there!');

```

This package allows to work with SDK as with a npm package:

```js
import WebApp from '@twa-dev/sdk'

WebApp.showAlert('Hey there!');
```

And yes, it supports TS.

### Demo
[Codesandbox](https://codesandbox.io/s/sdk-kj5961)

### React
If you use React in your project, check out components that we have prepared for you.
- [MainButton](src/react/MainButton/Readme.md)
- [SecondaryButton](src/react/SecondaryButton/Readme.md)
- [BottomBar](src/react/BottomBar/Readme.md)
- [BackButton](src/react/BackButton/Readme.md)

These components significantly simplify developer experience.