Flutter 패키지로, Telegram 웹 앱 및 미니 앱 API의 표현과 구현을 제공하여 Telegram의 웹 기반 애플리케이션과 원활하게 통합할 수 있게 해줍니다. 개발자가 Flutter 웹 앱 내에서 사용자 데이터, 테마 설정, 딥링크와 같은 Telegram 전용 기능에 접근할 수 있도록 합니다. 이 패키지는 웹 환경용으로 설계되었으며 Dart 인터페이스를 통해 Telegram 미니 앱의 모든 기능을 지원합니다.
사용 사례
Flutter 웹 앱을 Telegram과 통합하기
Telegram 미니 앱 만들기
Telegram 사용자 및 테마 데이터에 액세스
텔레그램에서 딥 링크 활성화
텔레그램 내에서 상호작용 웹 경험 만들기
주요 기능
텔레그램 웹 앱 API 바인딩
테마 및 사용자 데이터 액세스
딥 링크 지원
웹 플랫폼 전용
간단한 Dart 인터페이스
적합한 대상
텔레그램 미니 앱을 개발하는 플러터 개발자
텔레그램 사용자를 대상으로 하는 웹 앱 제작자
텔레그램 전용 통합이 필요한 앱
고려 사항
웹 플랫폼에 제한됨
텔레그램 환경이 필요합니다
모바일 또는 데스크톱 지원 없음
Telegram 웹 앱 컨텍스트에 따라 다릅니다
독립형 웹 앱에는 적합하지 않습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Telegram Web App
Build telegram web apps in flutter using telegram_web_app library
Checkout details of available telegram_web apis here
You can also find detailed examples in example project.
Setup for development
Enable debugging in telegram web app. Checkout this post for more details
Then navigate to \example folder
Deploy the example app via firebase or any other hosting service. You can find firebase hosting documentation here
Create web app in telegram
Use the website url to load the webapp in telegram
You can also inspect the app with Javascript logs via debugging as described here
For more info and support, you can join telegram group flutter_telegram
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 versionText(TelegramWebApp.instance.version)
// telegram colors associated with the user's appText(TelegramWebApp.instance.themeParams)
// Object containing user details and user validation hashText(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.
In Android, Web App is sometimes not loading (only grey/white screen showing up). If this happens to you, there is a 'hacky' workaround. You can also find it in example app:
voidmain() async {
try {
if (TelegramWebApp.instance.isSupported) {
TelegramWebApp.instance.ready();
Future.delayed(constDuration(seconds: 1), TelegramWebApp.instance.expand);
}
} catch (e) {
print("Error happened in Flutter while loading Telegram $e");
// add delay for 'Telegram seldom not loading' bugawaitFuture.delayed(constDuration(milliseconds: 200));
main();
return;
}
FlutterError.onError = (details) {
print("Flutter error happened: $details");
};
runApp(constMyApp());
}