HOW TO SEND BULK WHATSAPP MESSAGE.
- Swetha Selvam
- Feb 8, 2021
- 1 min read
In this post i have mentioned the coding for how to send bulk whatsapp message.
Source Code:
Sub WebWhatsAppBot()
'###
'WhatsApp BOT to send bulk message by using VBA Selenium
'###
'Activate Selenium Type Library: Tool > References
Dim bot As New WebDriver
Dim ks As New Keys
'Init New Chrome instance & navigate to WebWhatsApp
bot.Start "chrome", "https://web.whatsapp.com/"
bot.Get "/"
'Ask user to scan the QR code. Once logged it, continue with the macro
MsgBox "Please scan the QR code. After you are logged in, please confirm this message box by clicking 'ok'"
'Get the number of last row in column A
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
'Go to each link, paste text into WebWhatsApp and press enter to send the message
For i = 2 To lastrow
'Get search text (phone number / or name) from worksheet
searchtext = ActiveSheet.Range("A" & i).Value
'Get message from worksheet
textmessage = ActiveSheet.Range("B" & i).Value
'click in searchbox
bot.FindElementByXPath("//*[@id='side']/div[1]/div/label/div/div[2]").Click
'Wait 500 ms
bot.Wait (500)
'Insert searchtext (phone number / or name)
bot.SendKeys (searchtext)
'Wait 1500 ms
bot.Wait (1500)
'Press Enter to send message
bot.SendKeys (ks.Enter)
'Wait 500 ms
bot.Wait (500)
'Load message into Webwhatsapp
bot.SendKeys (textmessage)
'Wait 500 ms
bot.Wait (500)
'Press Enter to send message
bot.SendKeys (ks.Enter)
Next i
'Get notification once done
MsgBox "Done :)"
End Sub
Comments