Socket
Book a DemoInstallSign in
Socket

telegram-sdk

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

telegram-sdk

Telegram Web App - (Uses July 7, 2024, Bot API 7.7)

0.0.7
latest
Source
npmnpm
Version published
Weekly downloads
5
-16.67%
Maintainers
0
Weekly downloads
 
Created
Source

logo

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.

NPM Version NPM Downloads Minizip Contributors License

Installation

pnpm add telegram-sdk

you don't need to install the Telegram JS module separately, as it is included in this package.

Setup

  • Import core module in root file of your project.
import 'telegram-sdk/core';

Usage

  • Use the API provided by the Telegram JS module.
import { WebApp, WebView } from 'telegram-sdk';

// 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');

// Display a swipe vertical by event
WebView.postEvent('web_app_setup_swipe_behavior', false, {
  allow_vertical_swipe: false,
});

// ready method must come last
WebApp.ready();

disableVerticalSwipes

import { WebApp, WebView } from 'telegram-sdk';

// Config something...
WebApp.expand(); // Expand app
WebApp.disableClosingConfirmation();
WebApp.disableVerticalSwipes(); // Disable Vertical Swiper

// ready method must come last
WebApp.ready();

Documentation

Keywords

telegram-web-app

FAQs

Package last updated on 29 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.