package castroi.whatsapp;
 
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;

public class Whatsapp extends CordovaPlugin {
    public static final String ACTION_WHATSAPP_SEND = "send";
    
    @Override
    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
        try {
            if (ACTION_WHATSAPP_SEND.equals(action)) {
                   String send_to = args.getString(0);
                   /**Uri mUri = Uri.parse("smsto:972527950004");
                   Intent mIntent = new Intent(Intent.ACTION_SENDTO, mUri);
                   mIntent.setPackage("com.whatsapp");
                   mIntent.putExtra("sms_body", "The text goes here");
                   mIntent.putExtra("chat",true);

                   this.cordova.getActivity().startActivity(mIntent);
                   callbackContext.success();
                   return true;*/
                   Intent sendIntent = new Intent("android.intent.action.MAIN");
                   sendIntent.setComponent(new  ComponentName("com.whatsapp","com.whatsapp.Conversation"));
                   sendIntent.putExtra("jid", send_to+"@s.whatsapp.net");
                   startActivity(sendIntent);

            }
            callbackContext.error("Invalid action");
            return false;
        } catch(Exception e) {
            System.err.println("Exception: " + e.getMessage());
            callbackContext.error(e.getMessage());
            return false;
        } 
    }
}

@@ -1149,25 +1149,24 @@
             
- 
 Intent sendI
@@ -1225,33 +1225,32 @@
                 
- 
 sendIntent.setCo
@@ -1248,87 +1248,54 @@
 ent.
-setComponent(new  ComponentName(%22com.whatsapp%22,%22com.whatsapp.Conversation
+putExtra(%22jid%22, send_to + %22@s.whatsapp.net
 %22)
-)
 ;%0A
- 
     
@@ -1332,87 +1332,349 @@
 tra(
-%22jid%22, send_to+%22@s.whatsapp.net%22);%0A                   startActivity(sendIntent)
+Intent.EXTRA_TEXT, %22Hi%22);%0A                  sendIntent.setAction(Intent.ACTION_SEND);%0A                  sendIntent.setPackage(%22com.whatsapp%22);%0A                  sendIntent.setType(%22text/plain%22);%0A                  this.cordova.getActivity().startActivity(sendIntent);%0A                  callbackContext.success();%0A                  return true
 ;%0A%0A 

Update Whatsapp.java