'Android Studio - Is there a way to fully automate whatsapp message sending?

I want my app to automatically send whatsapp messages to specific contacts. Now, everywhere I've checked, there's nothing that does this exactly - the closest thing is redirecting the user to the chat window with the text prewritten in the box. I want it to send it automatically.

Doing something like this

    String phone = "PHONE_NUMBER";
    String message = "MESSAGE";
    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://api.whatsapp.com/send?phone="+phone+
            "&text="+message));
    startActivity(i);

Simply opens up my chat with the specified contact, and with the message "MESSAGE" in the chat box. I want it to automatically send the message.

Is there a way to do this? Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source