Giter Site home page Giter Site logo

flutter_telegram_web_app's Introduction

Telegram Web App

telegram_web_app version

Build telegram web apps in flutter using telegram_web_app library

Getting Started

  1. Import Library in your pubspec.yaml
  2. And add this line in web/index.html
<head>
    <script src="https://telegram.org/js/telegram-web-app.js" defer=""></script>
</head>

Checkout details of available telegram_web apis here You can also find detailed examples in example project.

Setup for development

  1. Enable debugging in telegram web app. Checkout this post for more details
  2. Then navigate to \example folder
  3. Deploy the example app via firebase or any other hosting service. You can find firebase hosting documentation here
  4. Create web app in telegram
  5. Use the website url to load the webapp in telegram
  6. You can also inspect the app with Javascript logs via debugging as described here

Here is an article on how to deploy web to Firebase and link to Telegram web app ๐Ÿ‘‰ Telegram Mini Apps

How to use

There is a class TelegramWebApp which contains all the telegram web apis. You can call the methods via TelegramWebApp.instance You can also mock TelegramWebApp by extending it if you are trying to test outside telegram platform. Alternatively, TelegramWebAppFake object can also be used for the same purpose.

Example

// current telegram version
Text(TelegramWebApp.instance.version)

// telegram colors associated with the user's app
Text(TelegramWebApp.instance.themeParams)

// Object containing user details and user validation hash
Text(TelegramWebApp.instance.initData.toString())

You can find full list of api examples in example folder. Please feel free to contribute for improvements and any updates.

Note

All the apis are only available inside telegram web app. You can't use the apis outside the platform.

flutter_telegram_web_app's People

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.