Skip to content

Sending WhatsApp Messages

aryan edited this page Jun 11, 2021 · 23 revisions

Function: sendwhatmsg(phone_no: str, message: str, time_hour: int, time_min: int, wait_time: int = 20, print_wait_time: bool = True, browser: str = None, tab_close: bool = False) -> NoReturn

This function is used to send WhatsApp messages to a particular number after a time given by the user. If you are facing issues with this function like the message is being copied to the Chat Box but not being send, you can set the browser parameter as the name of the browser you are using. The accepted values are chrome, firefox, brave, opera. You can see the Exceptions page for the common errors you might face using it. 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) -> NoReturn

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 previous tab should be closed or not after sending the message.

Example: pywhatkit.sendwhatmsg_to_group("AB123CDEFGHijklmn", "hello", 12, 12, 30)

The print_wait_time parameter is used to show the wait time after which the message will be sent.

Function: check_window() -> NoReturn

This function is used to Maximise the browser Window so that the messages can be sent.

Function: def sendwhatmsg_instantly(phone_no: str, message: str, wait_time: int = 20, browser: str = None, tab_close: bool = False) -> NoReturn

This function is used to send the message instantly. The tab_close parameter specifies that whether the previous tab should be closed or not after sending the message.

Clone this wiki locally