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

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

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();

I know it's too late, I just have to add that Whatsapp Web and Whatsapp Desktop accept paste inputs, thus if you can get your picture to the memory (I did it with VB.net took 5 mins to accomplish after a bit of googling) you can just send a paste order and it'll load it in and require and ENTER send key from you.

Part1: Sending messages to unsaved contacts
Sending media to unsaved numbers is quite a difficult task but not impossible. You can surely find XPath by text.
Part2: Yes media can be sent to contacts. I have done that in my project link : https://github.com/shauryauppal/PyWhatsapp. By using PyAutoIt you can send Pictures, PDF, Videos to the selected contacts.
Since uploading part is not the automation of web browser we auto windows using AutoIt and select the path of image/video/file to send to the user.
autoit.control_focus("Open","Edit1")
autoit.control_set_text("Open","Edit1",(PATH_OF_IMAGE_TO_SEND) )
autoit.control_click("Open","Button1")
This is just the crux of the implementation. Do refer my repo in case of more understanding.
PS: Don't forget to star repo or give credits.
Check answer Link for more info, where to download AutoIt from.

Coding Working Fine.
//To send attachments
//click to add
driver.findElement(By.cssSelector("span[data-icon='clip']")).click();
//add file to send by file path
driver.findElement(By.cssSelector("input[type='file']")).sendKeys("FilePath");
//click to send
driver.findElement(By.cssSelector("span[data-icon='send-light']")).click();

I was having the same issue but right after fixing it, I made a python wrapper so that it helps more people having the same issue.
In case you're interested to explore more about the wrapper, here is a link
https://github.com/Kalebu/alright
Here is how to send a message to media files and message to unsaved contacts
>>> from alright import WhatsApp
>>> messenger = WhatsApp()
>>> messenger.find_user('255-74848xxxx')
>>> messenger.send_message("I wish you a Merry X-mass and Happy new year ")
>>> messenger.send_picture('path-to-image',"Text to accompany image")
Sending to Multiple unsaved contacts
>>> numbers = ['2557xxxxxx', '2557xxxxxx', '....']
>>> for number in numbers:
messenger.find_user(number)
messenger.send_message("I wish you a Merry X-mass and Happy new year "

Related

twilio whats app bot select one option from list

i'm doing this whatsApp bot auto response using twilio apis,
i want user to select one option from list as shown in this pics, i check this link :
https://developers.facebook.com/docs/whatsapp/guides/interactive-messages/
it's called List Messages, so i want exactly what is shown in the pics using twilio apis,
as i check this document (Creating templates with buttons) from twilio link : https://www.twilio.com/docs/whatsapp/buttons#additional-information,
i want button shows popup select one option please help, i'm trying my best to ask this question the best i can i hope u understand after editing
click on it then this popup shows
thanks advanced
These messages are called Interactive Messages and according to Meta's docs "users cannot select more than one option at the same time from a list or button message, but they can go back and re-open a previous message."
Please have a look at the Twilio Doc to see which message types are currently supported.

Open specific conversation on whatsapp from ionic 4

I have tried to call whatsapp from InAppBrowser plugin by passing url "https://api.whatsapp.com/send?phone=+91123456890&text=test".
I have also added config.xml changes as suggested
(access launch-external="yes" origin="whatsapp:*" /)
It opens the browser (when I run this on device) with send button on it to send the message to Whatsapp.
But I am unable to tap the Send button. It is not redirecting me to whatsapp application with given number.
Please can you show me some sample code or the way to achieve this.
Thanks,
i also face this problem. following code fixed my problem
window.open('whatsapp://send?phone=923130601266', '_system');
You should try to call below api in InAppBrowser.
The direct conversation will open with the number you set below the link.
Don't forget to add country code before number.
https://wa.me/your-mobile-number

Telegram Bot: How to delete/remove userpic of bot?

I'm trying to remove the user picture of my telegram bot but there seems to be no option. Is it possible to delete/remove the userpic of a bot?
I know that I could upload any other photo via botfathers /setuserpic command but I want to simply remove the pic without any replacement.
Currently there seems to be no way to remove the pic completely.
Open BotFather
/mybots
Select your bot
Click Edit
Click Edit Botpic
Send a new picture to Bot Father
Bot father will add the latest photo as Display Picture.
Note: Bot father does remove the old picture. After changing the profile picture... open your bot... and check dp from there... you'll see only the last updated one.
Remember, if you check dp from the chat list(or Rows) you'll see earlier picture too. But that too gets removed once you open your bot and check dp from chat window!

How to view/Open dropbox file

I am developing and android app, where i want to get all files from drop box. Now i can retrieve all files from drop box and display it in List View. Now i want to open/display the file when i click on the List View. I don't know how to open Dropbox file, with which manager or which method??? please help
I was using this method to open/display Google Drive file, but i don't know how to use the same method here for Dropbox.
String ur = "https://docs.google.com/file/d/"+fileID;
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(ur));
startActivity(i);
Unfortunately this is not possible.
I posted in their forums and got a negative response. Hopefully it'll be functionality they look to support soon.

iOS 6 send email without user interaction

First of all, I'm working on an in-house app, so I don't need approval at App Store. I know it wouldn't ever be accepted, but it's a business rule our users share some content of the application, but with a default message and subject, so they can't edit these fields..
Until iOS 5 I was able to navigate by the view hierarchy and let the fields unneditable. But with iOS 6, and the mail on another proccess, I can't do it anymore.
I need to block the views for editing (I put a view over all the mail view, except the title bar, and it works, but when the user try to cancel the e-mail, my view is blocking the popover to delete or save draft too) or send e-mails without the UI (I was able to do it with Stealth Messenger based code (https://github.com/0xced/Stealth-Messenger/) at iOS 4 or 5, but now it doesn't work).
I tryed everything I could with private APIs and Objective-C runtime.. I can dismiss the view with sending e-mail ok, but the e-mail itself isn't sent.
Can anybody help me? Does anybody did it?
Thanks in advance..
Take a look at this: Send Email in Background from iOS
IOS doesn't support to mail in background. [...] As an alternate you
should implement the WebService for this[...]
Probably the best option is to utilise some server code and call that with NSURLRequest.
Hope that helps.
I do this in an app of mine. I have a simple PHP script on a webserver that uses the PearPHP mail modules to send SMTP mail. The PHP script takes a few incoming variables, like $toAddress, $subject, $message and then connects to the SMTP server and sends the mail out.
Unfortunately, you're not allowed to subclass the MFMailComposeViewController, and if you were using some sort of Invisible UIView to block fields, that was just a workaround that's probably been broken. (They did the same thing with being able to insert a "." on the NumberPad keyboard)