title: Send message via whatsapp programmatically
body: <p>I'm trying to send messages via <strong>Whatsapp</strong> programmatically, the code works except the user needs to click the send button. I need the app to do everything (all user interactions). One way to do to it as follows .</p>
  
  <blockquote>
    <p>Go to Menu Button > Settings > Chats. and check the "Enter is send option"</p>
  </blockquote>
  
  <p>Here's the code I'm using:</p>
  
  <pre><code>protected void sendwts(){
      String smsNumber = "2126123456789"; // E164 format without '+' sign
      Intent sendIntent = new Intent(Intent.ACTION_SEND);
      //  Intent sendIntent = new Intent(Intent.ACTION_SENDTO);
      sendIntent.setType("text/plain");
      sendIntent.putExtra(Intent.EXTRA_TEXT, "test \n");
      sendIntent.putExtra("jid", smsNumber + "@s.whatsapp.net"); //phone number without "+" prefix
      sendIntent.setPackage("com.whatsapp");
  
      startActivity(sendIntent);
  }
  </code></pre>
  
  <p>Thank you</p>