Send WhatsApp message using Excel the right way!!!
Research about WhatsApp automated messages
Checkout the WhatsApp link Unauthorized use of automated or bulk messaging on WhatsApp
Takeaway
- Using any unauthorized request like
https://wa.me/send...
orhttps://web.whatsapp.com/send...
orhttps://api.whatsapp.com/send...
might lead to account bans. - Choose a solution approved by Whatsapp (mentioned above), for bulk message solutions or 3rd party Omnichannel CRM solutions like Mekari Qontak
Then is it not possible to send WhatsApp message via Excel ?
A quick internet research revealed that there are many solution proposing that messages could be sent via Excel formula or Selenium based approaches. Today I would like to discuss with you an Excel VBA approach.
- Excel formula based approach accesses the WhatsApp api
- Selenium based approach requires installation of additional software I guess, however these approach may not lead to account ban.
Solution
So I propose a solution to feed the data in WhatsApp Desktop application via AppActivate and SendKeys functions.
Requirements
The following softwares are required
- MS Excel (obvisously)
- WhatsApp Deskop
Sample solution
' Column 1 = contains phone including country code, sample format: 009172---' Column 2 = contains the message to be sent
Sub WhatsAppMsg()
Dim LastRow As LongDim i As Integer
Dim strPhoneNumber As StringDim strMessage As String
LastRow = Range("A" & Rows. Count). End(xlUp). Row
For i = 2 To LastRow
strPhoneNumber = Sheets("Data").Cells(i, 1).Value
AppActivate "WhatsApp"
'create new chat Application.Wait (Now + TimeValue("00:00:01")) SendKeys "^n", True
'send phone number Application.Wait (Now + TimeValue("00:00:01")) SendKeys strPhoneNumber, True
'tab to select phone number Application.Wait (Now + TimeValue("00:00:01")) SendKeys "{Tab}", True
'hit enter to select the number Application.Wait (Now + TimeValue("00:00:01")) SendKeys "{Enter}", True
'skip the numpad Application.Wait (Now + TimeValue("00:00:01")) SendKeys "{Tab}", True
'hit enter to switch to input box Application.Wait (Now + TimeValue("00:00:01")) SendKeys "{Enter}", True
'paste the message Application.Wait (Now + TimeValue("00:00:01")) SendKeys strMessage, True
'hit enter to send the message Application.Wait (Now + TimeValue("00:00:01")) SendKeys "{Enter}", True
'To clear the input and go back to app start, if the number is not found Application.Wait (Now + TimeValue("00:00:02")) SendKeys "{Esc}", True
Next
End Sub