Android intent system Simply create an intent to share text, for example, and WhatsApp will be displayed by the system picker: Intent sendIntent = new Intent(); sendIntent. setAction(Intent. ACTION_SEND); sendIntent.
Install the WhatsApp Business API Client — Install your API client. Once your client is working, you can update your application settings. Start using the client — Register your phone number with an API call to /account and send a test message with a call to /messages .
WhatsApp is introducing free cloud-based API services in a push to get more businesses using the app, Meta Platforms CEO Mark Zuckerberg announced at the company's messaging event on Thursday.
I'm trying to send messages via Whatsapp 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 .
Go to Menu Button > Settings > Chats. and check the "Enter is send option"
Here's the code I'm using:
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); }
Thank you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With