How to open specific contact chat screen in various popular chat/social-networks apps?

Viewed 10395

Background

I've found that there is a way to open a specific contact conversation screen on WhatsApp, here .

Not only that, but I've found that an app called "Drupe" does the same, and maybe even more :

https://lh3.googleusercontent.com/EQrs1jplMlP8SkOTdpqT4NzmgzGa5Wz2qageG1Pkjc6rKg0HBb-rwlOVW07_G7bAWgo=h900

The problem

I can't find any official API of opening it this way, so I'm not sure how safe it is.

I've found SDKs, but not intents instructions.

The questions

I'd like to know more about what's available for various social-networks and chatting apps :

  • WhatsApp
  • Facebook Messenger
  • Viber
  • Line
  • Telegram
  • Hangouts

Possible features may be:

  • open the conversation of a contact, when input is his phone number
  • have a new text that will be ready to be sent in the new screen
  • for Facebook, maybe also be able to open using the Facebook-ID of the person (meaning this is the input), instead of a phone number.

Are such features available for each of those social networks and chatting apps?

3 Answers

it works for me

 try {

            String toNumber = "+91 8*******36"; // contains spaces.
            toNumber = toNumber.replace("+", "").replace(" ", "");

 Intent sendIntent = new Intent(Intent.ACTION_SENDTO,Uri.parse("smsto:" + "" + toNumber + "?body=" + ""));
 sendIntent.putExtra(Intent.EXTRA_TEXT, "hello");
 sendIntent.setPackage("com.whatsapp");
 startActivity(sendIntent);

        }
        catch (Exception e){
            Toast.makeText(getActivity(),"it may be you dont have whats app",Toast.LENGTH_LONG).show();

        }

Other posts here have good information. I wanted to add for LINE because the information is lacking in many places.

String userId = findUserId();
String sendText = "line://ti/p/~" + userId;
Intent intent = null;
try {
    intent = Intent.parseUri(sendText, Intent.URI_INTENT_SCHEME);
} catch (URISyntaxException e) {
    e.printStackTrace();
}
startActivity(intent);
Related