-
Notifications
You must be signed in to change notification settings - Fork 306
Sending WhatsApp Messages
sendwhatmsg(phone_no: str, message: str, time_hour: int, time_min: int, wait_time: int = 15, tab_close: bool = False, close_time: int = 3) -> None
This function is used to send WhatsApp messages to a particular number at a time given by the user. The time should be given in 24 hour format.
The tab_close
parameter specifies whether the tab should we closed after sending the message or not. You can control the time after which the tab should be closed by specifying the close_time
parameter (in seconds).
Example: pywhatkit.sendwhatmsg("+910123456789", "Hello", 12, 12, 30)
sendwhatmsg_to_group(group_id: str, message: str, time_hour: int, time_min: int, wait_time: int = 15, tab_close: bool = False, close_time: int = 3) -> 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 in https://chat.whatsapp.com/AB123CDEFGHijklmn
, 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. You can control the time after which the tab is closed by specifying the close_time
parameter (in seconds).
Example: pywhatkit.sendwhatmsg_to_group("AB123CDEFGHijklmn", "hello", 12, 12, 30, True, 5)
In the above example, the tab will be closed in 5 seconds after the message has been delivered.
sendwhatmsg_instantly(phone_no: str, message: str, wait_time: int = 15, tab_close: bool = False, close_time: int = 3) -> 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, 4)
(Closes the tab in 4 seconds after the message has been delivered)
pywhatkit.sendwhatmsg_instantly("+911234567890", "hello", 15)
(Doesn't close the tab after the message has been delivered)
sendwhats_image(receiver: str, img_path: str, caption: str = "", wait_time: int = 15, tab_close: bool = False, close_time: int = 3) -> None
This function is used to send Images and GIF's to WhatsApp users. For Linux based distributions you need copyq installed on your system. 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 Images (all formats) and GIF's. For Linux based distributions, only
JPEG
andPNG
are supported. For MacOS users, onlyJPEG
is supported currently.
Example: pywhatkit.sendwhats_image("+911234567890", "C:\\Image.png", "Here is the image", 10, True, 5)
In the above example, the tab will be closed in 5 seconds after the image has been delivered.
You can use it to send Images to Group also.
Example: pywhatkit.sendwhats_image("AB123CDEFGHijklmn", "C:\\Image.png", "Here is the image", 10)
PyWhatKit Version 5.2