How to create messaging module using telegram api in flutter

Viewed 1901

I want to create a messaging module using telegram api in my flutter application. What I want to do is, I want to create a UI like messaging and I want to message telegram users using my module in my application. Is it possible? Any help or links will be appreciated.

1 Answers

Yes, it is possible. There is a TeleDart package. You can use it. You will need a Telegram API token. And then you can use it like this:

import 'package:teledart/teledart.dart';
import 'package:teledart/telegram.dart';
import 'package:teledart/model.dart';

void main() {
  var teledart = TeleDart(Telegram('YOUR_BOT_TOKEN'), Event());

  teledart.start().then((me) => print('${me.username} is initialised'));

  teledart
      .onMessage(keyword: 'Fight for freedom')
      .listen((message) => message.reply('Stand with Hong Kong'));
  
}
Related