flutter_telegram_bot 0.0.24
flutter_telegram_bot: ^0.0.24 copied to clipboard
Telegram API package
A Flutter/Dart package to send error reports via a Telegram bot.
Send detailed messages including server info, device info, and request data directly to your Telegram channel or user.
Features #
- Send error reports to Telegram with detailed formatting.
- Include device information and request payloads.
- Simple and easy to integrate with Flutter projects.
- Fully customizable message templates.
Getting Started #
Add this package to your pubspec.yaml:
dependencies:
flutter_telegram_bot.dart: ^0.0.1
With Dart:
dart pub add flutter_telegram_bot
Example #
import 'package:flutter/material.dart';
import 'package:flutter_telegram_bot.dart/flutter_telegram_bot.dart.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
final TelegramService telegram = TelegramService(
botToken: "YOUR_BOT_TOKEN",
chatId: "@your_channel_or_user",
);
MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Telegram Service Example',
home: Scaffold(
appBar: AppBar(title: const Text('Telegram Example')),
body: Center(
child: ElevatedButton(
child: const Text('Send Error Report'),
onPressed: () async {
await telegram.sendErrorReport(
username: "Alice",
serverName: "Server-1",
deviceInfo: {
"Brand": "Samsung",
"Model": "Galaxy S24",
"OS": "Android 14",
},
requestData: {
"endpoint": "/api/login",
"method": "POST",
"body": {"username": "test"},
"messages": "Invalid credentials",
},
);
},
),
),
),
);
}
}