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!
Asked
Active
Viewed 539 times
1 Answers
1
Regarding Telegram, you can do three things:
- Open contact by url (https://t.me/usernameurl)
String user = "Telegram username";
Intent browserIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("https://t.me/"+user));
startActivity(browserIntent);
- The same but with the number doesn't work.
- Use Telegram's bots api (if it solved your question, but I don't think so).
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