How to create messaging module using telegram api in flutter

1,508

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'));
  
}
Share:
1,508
Saif chaudhry
Author by

Saif chaudhry

I'm a hands-on technical leader who has built software products from the ground up, run small engineering teams, and provided guidance at the basic and board level. I'm motivated by product success and business growth, not technology for technology's sake.

Updated on December 26, 2022

Comments

  • Saif chaudhry
    Saif chaudhry over 1 year

    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.

  • Saif chaudhry
    Saif chaudhry over 3 years
    Hi Akif, just to be sure, it's a bot or it's like simple messaging app? like we have whatsapp in which we can send/receive message from users.