-
Notifications
You must be signed in to change notification settings - Fork 337
Sending WhatsApp Messages
Function: sendwhatmsg(phone_no: str, message: str, time_hour: int, time_min: int, wait_time: int = 20, print_wait_time: bool = True, tab_close: bool = False) -> None
This function is used to send WhatsApp messages to a particular number after a time given by the user.
The tab_close parameter specifies that whether the previous tab should be closed or not after sending the message.
Example: pywhatkit.sendwhatmsg("+910123456789", "Hello", 12, 12, 30)
Function: sendwhatmsg_to_group(group_id: str, message: str, time_hour: int, time_min: int, wait_time: int = 20, print_wait_time: bool = True, tab_close: bool = False) -> None
This function is used to WhatsApp messages to a group. The Group ID here is something that you can find in the group invite link.
For example https://chat.whatsapp.com/AB123CDEFGHijklmn, here AB123CDEFGHijklmn is the Group ID. Please note the only the group admin can provide you with the Group Invite Link. The tab_close parameter specifies that whether the tab should be closed or not after sending the message.
Example: pywhatkit.sendwhatmsg_to_group("AB123CDEFGHijklmn", "hello", 12, 12, 30, tab_close = True)
The print_wait_time parameter is used to show the wait time after which the message will be sent.
Function: check_window() -> None
This function is used to Maximise the browser Window so that the messages can be sent.
Function: sendwhatmsg_instantly(phone_no: str, message: str, wait_time: int = 20, tab_close: bool = False) -> None
This function is used to send the message instantly. The tab_close parameter specifies that whether the tab should be closed or not after sending the message.
Example: pywhatkit.sendwhatmsg_instantly("+911234567890", "hello", 15, True) (Closes the tab after the message is sent)
pywhatkit.sendwhatmsg_instantly("+911234567890", "hello", 15) (Doesn't close the tab after the message is sent)
Function: sendwhats_image(phone_no: str, img_path: str, caption: str = " ", wait_time: int = 15) -> None
This function is used to send Images, GIF, Videos to WhatsApp users. For Linux based distributions you need xclip installed on your system. You can search for install instructions on Google. The caption parameter is used to specify the text that is to be sent with the Image. You can also leave it to its default value.
NOTE: Windows users can send all types of media formats. For Linux based distributions, only
JPEGandPNGare supported. For MacOS users, onlyJPEGis supported currently.
Example: sendwhats_image("+911234567890", "C:\\Image.png", "Here is the image", 10)
PyWhatKit Version 5.2