Package Exports
- telegram-mini-app
- telegram-mini-app/dist/index.js
- telegram-mini-app/dist/index.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (telegram-mini-app) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Telegram-Mini-App
This repository offers an npm package for developing web applications for your Telegram bot. It re-exports the API provided by Telegram's JS module.
The benefit of this package is that it includes TypeScript types, simplifying project setup.
Installation
npm install telegram-mini-appyou don't need to install the Telegram JS module separately, as it is included in this package.
Usage
import WebApp from 'telegram-mini-app';
// to display the initData
console.log(WebApp.initData);
// to show the main button
WebApp.MainButton.show();
// to set the app background color
WebApp.setBackgroundColor('#f60000')
// to set the app header color
WebApp.setHeaderColor('bg_color');Refer to the official Telegram documentation for Web Apps to explore additional features available through WebApp.