Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send media files on whatsapp programmatically using click to chat feature?

I have to use whatsapp's click to chat feature for automating the process of sending messages to unsaved numbers. I am currently using selenium to automate the process. I am able to send text messages only for now. I was wondering that it might be possible to send other media files as well like images and videos.

There are 2 unused parameters in my url of click to chat feature, "source" and "data". I thought using these might enable me to send media files but I Haven't been able to do it yet. Example URL for one of my click to chat messages:

https://web.whatsapp.com/send?phone=phoneNumHere&text=Hi&source=&data=

Can anyone confirm that either its possible or not. If its possible what would be the right way to do it?

Thanks

like image 256
Mukarram Pasha Avatar asked Aug 20 '18 14:08

Mukarram Pasha


People also ask

How can I send message to WhatsApp API?

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 .


1 Answers

Similar question: Whatsapp Automated Bot not able to search in WhatsApp Contact List

Send images, videos and docs using Selenium:

//To send attachments
//click to add
driver.findElement(By.cssSelector("span[data-icon='clip']")).click();

//add file path
driver.findElement(By.cssSelector("input[type='file']")).sendKeys("FilePath");

//click to send
driver.findElement(By.cssSelector("span[data-icon='send-light']")).click();
like image 122
Sers Avatar answered Nov 15 '22 11:11

Sers