How do I open a Telegram chat from my flutter app?

Issue

I am working on a flutter app that has a ‘Contact me’ section. I have already provided a direct mailto link in the app using the url_launcher plugin.

Now I plan to open a Telegram chat with my telegram account in the user’s phone. How do I do it?

Solution

Use url_launcher

here is the code


import 'package:url_launcher/url_launcher.dart';

void launchTelegram() async{
String url =
        "https://telegram.me/<telegram_username>";
    print("launchingUrl: $url");
    if (await canLaunch(url)) {
      await launch(url);
    }

}

Answered By – Sami Kanafani

Answer Checked By – Cary Denson (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.