Coder Social home page Coder Social logo

web-app's Introduction

grammY Web App Utils


Building Blocks for Telegram Web Apps

This repo provides an npm package for building Web App for your Telegram bot. It simply re-exports the API provided by Telegram's JS module which you must still script-tag include.

The advantage of this package is that is bundles up TypeScript types, which may make it easier to set up the project. In addition, it will allow you to properly scope access to window.Telegram, rather than relying on the global scope.

Installation

You need to include the CDN script from Telegram. Add this to your main HTML file in the <head> tag:

<script src="https://telegram.org/js/telegram-web-app.js"></script>

You can then use this package in your application by running

npm install @grammyjs/web-app

In turn, you can import from it:

import { WebApp } from "@grammyjs/web-app";

console.log(WebApp.initData);
// same as
console.log(window.Telegram.WebApp.initData);

Once your application is ready to be displayed, you should call ready().

WebApp.ready();

Consult the offical Telegram docs for Web Apps to see what else is available through WebApp.

web-app's People

Contributors

knorpelsenf avatar daniharo avatar roj1512 avatar roziscoding avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.