WhatsApp a few years ago had published APIs that allowed to send messages to a specific number. For some time, those methods no longer work and new methods appear on the official website.
(see: https://faq.whatsapp.com/en/android/28000012)
You can now open a conversation with a phone number but not preset the message. Or, in the opposite direction, determine which message but not specify who should receive it.
Yet with Google+ (and all Browser) you can select the user and the message with the entry. So there is an official method and is not documented. Or these bees are paid for commercial use.
The only documentation that is found and how to send a message set to a specific user across the Web. (https://faq.whatsapp.com/en/android/26000030/?category=5245251)
By using this I created a small code that allows an App to send a specific message to a specific user. Anyway, you have to confirm by WhatsApp .... but it is already something ... I attach the code
There is a second alternative. I have seen on sale APIs from third-party distributors that allow you to send messages with WhatsApp to specific numbers ... But I did not test if they are valid.
(see: https://faq.whatsapp.com/en/android/28000012)
You can now open a conversation with a phone number but not preset the message. Or, in the opposite direction, determine which message but not specify who should receive it.
Yet with Google+ (and all Browser) you can select the user and the message with the entry. So there is an official method and is not documented. Or these bees are paid for commercial use.
The only documentation that is found and how to send a message set to a specific user across the Web. (https://faq.whatsapp.com/en/android/26000030/?category=5245251)
By using this I created a small code that allows an App to send a specific message to a specific user. Anyway, you have to confirm by WhatsApp .... but it is already something ... I attach the code
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private EditTextNumber As EditText
Private EditTextMessange As EditText
'Private WebView1 As WebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Activity.LoadLayout("main")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ButtonSend_Click
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, $"https://api.whatsapp.com/send?phone=${EditTextNumber.Text}&text=${EditTextMessange.Text}"$)
StartActivity(Intent1)
' Dim HtmlCode As String = $"<html><center><a href="https://api.whatsapp.com/send?phone=${EditTextNumber.Text}&text=${EditTextMessange.Text}">SEND </a></center></html>"$
' Log(HtmlCode)
' If File.Exists(File.DirRootExternal,"wa.html") Then File.Delete(File.DirRootExternal,"wa.html")
' File.WriteString(File.DirRootExternal,"wa.html",HtmlCode)
' WebView1.LoadHtml(File.ReadString(File.DirRootExternal,"wa.html"))
End Sub
There is a second alternative. I have seen on sale APIs from third-party distributors that allow you to send messages with WhatsApp to specific numbers ... But I did not test if they are valid.
Last edited: