3

Is it possible to open Telegram or Viber programmatically through a specific contact with message body? I found "how to open whatsapp": whatsapp. A similar solution may exist for Viber and Telegram!

Cœur
  • 37,241
  • 25
  • 195
  • 267
Vadim Fedchuk
  • 168
  • 10

1 Answers1

1

Regarding Telegram, you can do three things:

String user = "Telegram username";
Intent browserIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("https://t.me/"+user));
startActivity(browserIntent);

Relating Viber you are also able to do so. And, as with Telegram, you can't search by number. The needed uri can be found here (according to Viber):

Find your URI on your account's edit screen.

String user = "Viber public account uri";
String message = "Prefilled message"; // Not mandatory
Intent browserIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("viber://pa?chatURI="+user+"&text="+message));
startActivity(browserIntent);
miquelvir
  • 1,748
  • 1
  • 7
  • 21