API for Android to interact with WhatsApp


The initial idea is to connect or have an application Android so you can interact with WhatsApp (for example, send text to WhatsApp, activate or deactivate functions for a specific user ect).

I searched for some API for this task but I could not find any, and the one I found was perhaps abandoned ( link ) and it is not official.

Is there an official API for this?

On the other hand, the alternative that I am using is the following one (for sending text):

After looking this link (in English)

Intent sendIntent = new Intent();

sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");


More or less it would be something like this:

public void enviarMsgApp(View view) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent .setType("text/plain");
    String texto = "Mensaje para enviar aqui";
    intent .setPackage("com.whatsapp");
    if (intent != null) {
        intent .putExtra(Intent.EXTRA_TEXT, texto);
        startActivity(Intent.createChooser(intent, texto));
    } else {
        Toast.makeText(this,"Nooo whatsapp, whatsapp man",  

There is an alternative to be able to modify the "behavior" of WhatsApp on a user.

For example, something like telling the application (which is being created) the name of the user, and this application can make changes to that user. for example change the photo shown, mute etc, although for this have to request permissions from the user or that the same WhatsApp alert the user that it is trying to make an adjustment and this has to authorize it or something like that.

Pseudo code:

public void cambiarFotoApp(View view, String nombreUsuario) {
        Intent intent = new Intent(Intent.ACTION_SEND);

        intent .setPackage("com.whatsapp"); 
        //cambiarFoto(nombreUsuario, jpgNuevaFoto); 
asked by Angel Angel 11.01.2016 в 18:37

4 answers


At the moment there is no official API to interact with the application beyond the example you show to send a message.

For a time, a viable option was WhatsAPI but the author had legal problems with this repository and abandoned the development.

answered by 11.01.2016 в 19:01

You could also use the following URL that allows you to open the application directly to send to the destination phone number:


The country code must be included in the number.

  • 591 country code
  • 77242524 phone number

It could be very useful for example when you are creating a contact screen in the application and with a "Contact me" button open direct WhatsApp to write.

answered by 24.02.2017 в 21:58

This could be done in a certain way using an accessibility service on Android but you should have the official application installed, I can not explain it further because it would be mega long my answer So I suggest you enter the accessibility section of Android developers.
Basically the principle would be based on extracting information from the notifications using the accessibility service in addition to interacting through explicit intents directly with the WhatsApp application

answered by 24.02.2017 в 23:10

The best solution you can use is through the link:

"whatsapp: // send? phone = 59165868685 & text = This is the message to change"

        Intent intent = new Intent(Intent.ACTION_VIEW);
        String uri = "whatsapp://send?phone=" + "codigo pais + tu numero ej: 59165868685" + "&text=" + "Este es el mensaje para enviar";


answered by 06.01.2018 в 00:15