How can I send a text directly to a specific phone number on Viber? or to a specific person on Facebook messenger?

with whatsapp I'm using url_launcher with whatsapp with below code, and it is working fine.

var whatsapp_url = "whatsapp://send?phone=" + whatsapp_number + "&text=hellooo";
try {
await launchUrl(Uri.parse(whatsapp_url));
} catch (e) {
print('could not launch whatsapp');

I tried using the same package with Viber using ("viber://chat?number=") and Facebook messenger using ('') but both are just opening a web site and not opening the mobile App and not finding the phone number or the messenger chat.

I need to do a similar thing by clicking an IconButton to open a specific chat on Viber and another IconButton to open a specific Facebook messenger chat.

Solution 1: Salar Azad

I found a solution in case someone needed - I used the same url_launcher library.

  • Viber:

    var viber_link = "viber://chat/?number=$Country_Code$Mobile_Number&draft=$Message_to_be_sen” 

    Viber doesn’t need ‘+’ sign when writing the country code

  • Facebook Messenger:

    var facebook_messenger_link = '$FaceBook_Name?text=$Message_to_be_sent;

    Facebook Name can be found by clicking on the profile picture on Facebook and checking the URL, it comes after ‘{FB_Name}’

  • Telegram:

    var telegram_link = '$Country_Code$Mobile_Number&draft=$Message_to_be_sen';

    Telegram needs the ‘+’ sign when writing the country code

Then used this code for launching it:

final Uri app_link_uri = Uri.parse(app_link);
  try {
    await launchUrl(
      mode: LaunchMode.externalApplication,
  } catch (error) {
    print(‘error’ catching: $error);