### Install PyWhatKit Library Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Command to install the PyWhatKit package via pip. ```bash pip install pywhatkit ``` -------------------------------- ### Install PyWhatKit via Pip Source: https://github.com/ankit404butfound/pywhatkit/blob/master/README.md Commands to install the PyWhatKit library using Python's package manager. ```bash python3 -m pip install pywhatkit ``` ```bash pip3 install pywhatkit ``` -------------------------------- ### Start Remote Control Server Source: https://github.com/ankit404butfound/pywhatkit/blob/master/README.md Initializes the remote control server to allow PC control via a mobile device on the same network. ```python import pywhatkit pywhatkit.start_server() ``` -------------------------------- ### Automate WhatsApp and Media Tasks Source: https://github.com/ankit404butfound/pywhatkit/blob/master/README.md Examples of using PyWhatKit to send WhatsApp messages, images, play YouTube videos, and convert images to ASCII art. ```python import pywhatkit # Send a WhatsApp Message to a Contact at 1:30 PM pywhatkit.sendwhatmsg("+910123456789", "Hi", 13, 30) # Send an Image to a Group with the Caption as Hello pywhatkit.sendwhats_image("AB123CDEFGHijklmn", "Images/Hello.png", "Hello") # Send a WhatsApp Message to a Group instantly pywhatkit.sendwhatmsg_to_group_instantly("AB123CDEFGHijklmn", "Hey All!") # Play a Video on YouTube pywhatkit.playonyt("PyWhatKit") # Converting image to ASCII Art ascii_art = pywhatkit.image_to_ascii_art("image path") print(ascii_art) ``` -------------------------------- ### Remote Control Server Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Function to start a remote control server for PC control from a mobile device. ```APIDOC ## start_server - Start Remote Control Server ### Description Starts a web server that allows remote control of the PC from a mobile phone on the same network. This is a Windows-only feature. ### Method ```python start_server(port: int = 8000, print_msg: bool = False) ``` ### Endpoint N/A (Local function) ### Parameters - **port** (int) - Optional - The port number to start the server on. Defaults to 8000. - **print_msg** (bool) - Optional - If True, prints connection messages. Defaults to False. ### Request Example ```python import pywhatkit # Start on default port 8000 pywhatkit.start_server() # Start on a custom port with messages printed pywhatkit.start_server(port=5000, print_msg=True) ``` ### Usage Instructions 1. Find your PC's IP address using `ipconfig` in the command prompt. 2. On your phone's browser, navigate to: `http://YOUR_IP:PORT` (replace YOUR_IP and PORT with your PC's IP and the server port). 3. Use the touch interface to control the mouse, type text, and scroll. ``` -------------------------------- ### GET /info Source: https://github.com/ankit404butfound/pywhatkit/wiki/Miscellaneous-Functions Retrieves information about a specific topic from Wikipedia. ```APIDOC ## GET /info ### Description Fetches details about a given topic using the Wikipedia API. ### Method GET ### Parameters #### Query Parameters - **topic** (str) - Required - The subject to search on Wikipedia. - **lines** (int) - Optional - Number of lines to return (default: 3). - **return_value** (bool) - Optional - Whether to return the string or print it (default: False). ### Request Example pywhatkit.info("Python Language", 10) ### Response #### Success Response (200) - **data** (str) - The fetched Wikipedia summary. ``` -------------------------------- ### GET /search Source: https://github.com/ankit404butfound/pywhatkit/wiki/Miscellaneous-Functions Performs a Google search for a specific topic. ```APIDOC ## GET /search ### Description Opens a new browser tab with Google search results for the provided topic. ### Method GET ### Parameters #### Query Parameters - **topic** (str) - Required - The search term. ### Request Example pywhatkit.search("Python") ``` -------------------------------- ### Get Wikipedia Information with PyWhatKit Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Retrieves and displays information about a specified topic from Wikipedia. Users can control the number of lines returned and choose to get the data as a string instead of printing it directly. ```python import pywhatkit # Get 3 lines of information (default) pywhatkit.info("Python programming language") # Get 5 lines of information pywhatkit.info("Machine Learning", lines=5) # Get information and return as string data = pywhatkit.info( topic="Artificial Intelligence", lines=4, return_value=True ) print(f"Retrieved: {data}") ``` -------------------------------- ### YouTube and System Automation Source: https://github.com/ankit404butfound/pywhatkit/blob/master/README.md Methods for playing YouTube videos and initiating remote server control. ```APIDOC ## GET /playonyt ### Description Searches and plays a video on YouTube. ### Method GET ### Parameters #### Query Parameters - **topic** (string) - Required - The search query for the YouTube video. ## POST /start_server ### Description Starts a local server to enable remote control of the PC via a web browser. ### Method POST ### Parameters None ``` -------------------------------- ### Clone PyWhatKit Repository Source: https://github.com/ankit404butfound/pywhatkit/blob/master/README.md Command to clone the source code from GitHub. ```bash git clone https://github.com/Ankit404butfound/PyWhatKit.git ``` -------------------------------- ### Open WhatsApp Web Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Utility function to initialize a WhatsApp Web session in the default browser. ```python import pywhatkit # Open WhatsApp Web success = pywhatkit.open_web() if success: print("WhatsApp Web opened successfully") else: print("Failed to open WhatsApp Web") ``` -------------------------------- ### Handle PyWhatKit Exceptions Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Demonstrates how to catch and handle specific custom exceptions raised by PyWhatKit during automation tasks like messaging or email sending. ```python import pywhatkit from pywhatkit.core.exceptions import ( CountryCodeException, CallTimeException, InternetException, InvalidPhoneNumber, UnsupportedEmailProvider, UnableToAccessApi ) try: pywhatkit.sendwhatmsg_instantly("1234567890", "Hello") except CountryCodeException: print("Please include country code (e.g., +1)") try: pywhatkit.sendwhatmsg("+1234567890", "Hi", 12, 30, wait_time=60) except CallTimeException: print("Scheduled time must be greater than wait time") ``` -------------------------------- ### Perform Google Search with PyWhatKit Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Opens the default web browser to perform a Google search for a given topic. This is a straightforward way to automate web searches. ```python import pywhatkit # Search for a topic on Google pywhatkit.search("PyWhatKit documentation") pywhatkit.search("Python automation libraries") ``` -------------------------------- ### Schedule System Shutdown with PyWhatKit Source: https://github.com/ankit404butfound/pywhatkit/wiki/Shutdown-and-CancelShutdown Schedules the host machine to shut down after a specified duration. Note that Windows requires time in seconds, while MacOS and Linux require time in minutes. ```python import pywhatkit # Shutdown after 5 units (Seconds for Windows, Minutes for Linux/MacOS) pywhatkit.shutdown(5) ``` -------------------------------- ### Capture System Screenshot Source: https://github.com/ankit404butfound/pywhatkit/wiki/Miscellaneous-Functions Captures a screenshot on Windows or MacOS and saves it as a PNG file. Includes parameters for custom filenames and a delay before capture. ```python import pywhatkit pywhatkit.take_screenshot("myscreenshot", delay=2) ``` -------------------------------- ### POST /playonyt Source: https://github.com/ankit404butfound/pywhatkit/wiki/Miscellaneous-Functions Plays a YouTube video based on a search topic. ```APIDOC ## POST /playonyt ### Description Searches and plays the most relevant YouTube video for a given topic. ### Method POST ### Parameters #### Request Body - **topic** (str) - Required - The search query for YouTube. - **use_api** (bool) - Optional - Use PyWhatKit API to fetch URL (default: False). - **open_video** (bool) - Optional - Automatically open the video in the browser (default: True). ### Request Example pywhatkit.playonyt("Python", True) ### Response #### Success Response (200) - **url** (str) - The URL of the video found. ``` -------------------------------- ### POST /take_screenshot Source: https://github.com/ankit404butfound/pywhatkit/wiki/Miscellaneous-Functions Captures a screenshot of the current screen. ```APIDOC ## POST /take_screenshot ### Description Takes a screenshot and saves it as a PNG file. Supported on MacOS and Windows. ### Method POST ### Parameters #### Request Body - **file_name** (str) - Optional - The name of the output file (default: "pywhatkit_screenshot"). - **delay** (int) - Optional - Delay in seconds before capture (default: 2). ### Request Example pywhatkit.take_screenshot("myscreenshot") ``` -------------------------------- ### Play YouTube Video on PyWhatKit Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Plays the first search result for a given topic on YouTube. It can optionally return the video URL without opening the browser or use an API for searching. ```python import pywhatkit # Play a video by search query url = pywhatkit.playonyt("Python tutorial for beginners") print(f"Playing video: {url}") # Get URL without opening browser url = pywhatkit.playonyt( topic="Machine Learning basics", open_video=False # Don't open in browser ) print(f"Video URL: {url}") # Use the API for search (alternative method) url = pywhatkit.playonyt( topic="Django REST framework", use_api=True ) ``` -------------------------------- ### Convert Image to ASCII Art with PyWhatKit Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Converts an image file into ASCII art text. The output is saved to a text file and also returned as a string. The default output filename is 'pywhatkit_asciiart.txt'. ```python import pywhatkit # Convert image to ASCII art ascii_art = pywhatkit.image_to_ascii_art( img_path="path/to/image.png", output_file="my_ascii_art" # Saves to my_ascii_art.txt ) print(ascii_art) # Default output filename is "pywhatkit_asciiart.txt" ascii_art = pywhatkit.image_to_ascii_art("profile_photo.jpg") ``` -------------------------------- ### Take Screenshot with PyWhatKit Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Captures a screenshot of the current screen. This functionality is available on Windows and macOS. Options include specifying a filename, a delay before capture, and whether to display the screenshot immediately. ```python import pywhatkit # Take a screenshot with default settings pywhatkit.take_screenshot( file_name="my_screenshot", # Saves as my_screenshot.png delay=2, # Wait 2 seconds before capture show=True # Show the screenshot after capture ) # Take a quick screenshot without preview pywhatkit.take_screenshot( file_name="quick_capture", delay=0, show=False ) ``` -------------------------------- ### Open WhatsApp Web Source: https://github.com/ankit404butfound/pywhatkit/wiki/Miscellaneous-Functions Opens the WhatsApp Web interface in the default browser. Returns a boolean indicating if the operation was successful. ```python import pywhatkit pywhatkit.open_web() ``` -------------------------------- ### Convert Image to ASCII Art using PyWhatKit Source: https://github.com/ankit404butfound/pywhatkit/wiki/ASCII-Art This function converts an image file to an ASCII art text file. It accepts the image path as a required argument and an optional output filename, defaulting to 'pywhatkit_asciiart.txt'. ```python import pywhatkit # Convert image in the same directory pywhatkit.image_to_ascii_art("Example.png") # Convert image using an absolute path pywhatkit.image_to_ascii_art("C:\\Example\\Example.png") # Convert image with a custom output filename pywhatkit.image_to_ascii_art("Example.png", "my_ascii_art") ``` -------------------------------- ### Exception Handling Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Custom exceptions provided by PyWhatKit for robust error handling. ```APIDOC ## Exception Handling PyWhatKit defines several custom exceptions for error handling. It is recommended to catch these exceptions to gracefully handle potential issues. ### Available Exceptions - **CountryCodeException**: Raised when a phone number is missing the country code. - **CallTimeException**: Raised when the scheduled call time is invalid (e.g., before the current time or too close to the wait time). - **InternetException**: Raised when there is no internet connection. - **InvalidPhoneNumber**: Raised when a phone number is not in a valid format. - **UnsupportedEmailProvider**: Raised when an unsupported email provider is used for sending emails. - **UnableToAccessApi**: Raised when there is an issue accessing an external API. ### Example Usage ```python import pywhatkit from pywhatkit.core.exceptions import ( CountryCodeException, CallTimeException, InternetException, InvalidPhoneNumber, UnsupportedEmailProvider, UnableToAccessApi ) try: # Example: Sending a message instantly with an invalid phone number pywhatkit.sendwhatmsg_instantly("+1abc", "Test message") except InvalidPhoneNumber: print("Error: The provided phone number format is invalid.") try: # Example: Scheduling a message with an invalid time pywhatkit.sendwhatmsg("+11234567890", "Hello", 12, 30, wait_time=60) except CallTimeException: print("Error: The scheduled time must be greater than the current time and wait time.") try: # Example: Sending an email with an unsupported provider pywhatkit.send_mail("user@unsupported.com", "password", "Subject", "Body", "recipient@email.com") except UnsupportedEmailProvider: print("Error: Email provider not supported. Please use Gmail, Yahoo, Outlook, or AOL.") try: # Example: Function that might require API access pywhatkit.text_to_handwriting("Some text") except UnableToAccessApi: print("Error: Could not connect to the required API. Check your internet connection.") ``` ``` -------------------------------- ### Convert Text to Handwriting Image with PyWhatKit Source: https://github.com/ankit404butfound/pywhatkit/wiki/Text-to-Handwriting This function converts a string into an image file that mimics handwriting. Users can customize the output filename and the RGB color of the text. ```python import pywhatkit # Basic usage pywhatkit.text_to_handwriting("Hello") # Usage with custom filename pywhatkit.text_to_handwriting("Hello", "filename.png") # Usage with custom filename and RGB color pywhatkit.text_to_handwriting("Hello", "filename.png", (0, 0, 138)) ``` -------------------------------- ### Perform Google Search Source: https://github.com/ankit404butfound/pywhatkit/wiki/Miscellaneous-Functions Opens a new browser tab and performs a Google search for the specified topic. ```python import pywhatkit pywhatkit.search("Python") ``` -------------------------------- ### Send Media and Documents via WhatsApp Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Functions to send images, videos, and documents to contacts or groups. ```python import pywhatkit # Send image to a contact with caption pywhatkit.sendwhats_image( receiver="+1234567890", img_path="path/to/image.png", time_hour=15, time_min=45, caption="Check out this photo!", wait_time=15, tab_close=True, close_time=3 ) # Send video instantly pywhatkit.sendimg_or_video_immediately( phone_no="+1234567890", path="path/to/video.mp4", wait_time=15, tab_close=True, close_time=3 ) # Send a PDF document pywhatkit.sendwhatdoc_immediately( phone_no="+1234567890", path="path/to/document.pdf", wait_time=15, tab_close=True, close_time=3 ) ``` -------------------------------- ### Manage PyWhatKit Message Logs Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Functions to display the history of sent messages and configure the directory where the log file is stored. ```python import pywhatkit # Show all logged messages pywhatkit.show_history() # Set custom log directory pywhatkit.set_log_path("C:\\Users\\Username\\Documents\\Logs") ``` -------------------------------- ### WhatsApp Automation Methods Source: https://github.com/ankit404butfound/pywhatkit/blob/master/README.md Methods for sending messages and images to WhatsApp contacts and groups. ```APIDOC ## POST /sendwhatmsg ### Description Sends a WhatsApp message to a specific contact at a scheduled time. ### Method POST ### Parameters #### Request Body - **phone_no** (string) - Required - The recipient's phone number with country code. - **message** (string) - Required - The content of the message. - **time_hour** (int) - Required - The hour in 24-hour format. - **time_min** (int) - Required - The minute of the hour. ### Request Example { "phone_no": "+910123456789", "message": "Hi", "time_hour": 13, "time_min": 30 } ## POST /sendwhats_image ### Description Sends an image to a WhatsApp contact or group with an optional caption. ### Method POST ### Parameters #### Request Body - **receiver** (string) - Required - Phone number or Group ID. - **img_path** (string) - Required - Local path to the image file. - **caption** (string) - Optional - Caption text for the image. ### Request Example { "receiver": "+910123456789", "img_path": "Images/Hello.png", "caption": "Hello" } ``` -------------------------------- ### Image to ASCII Art Conversion Source: https://github.com/ankit404butfound/pywhatkit/wiki/ASCII-Art Converts an image file into ASCII art and saves it to a text file. Supports relative and absolute paths for input images and allows customization of the output filename. ```APIDOC ## image_to_ascii_art ### Description Converts an image to ASCII art and saves it to a text file. The output file defaults to `pywhatkit_asciiart.txt` but can be customized. ### Method ```python image_to_ascii_art(img_path: str, output_file: str = "pywhatkit_asciiart") -> str ``` ### Parameters #### Path Parameters - **img_path** (str) - Required - The path to the input image file. Can be a relative or absolute path. - **output_file** (str) - Optional - The desired filename for the output ASCII art text file (without extension). Defaults to `pywhatkit_asciiart`. ### Request Example **Using default output file:** ```python import pywhatkit pywhatkit.image_to_ascii_art("Example.png") ``` **Using a specific output file:** ```python import pywhatkit pywhatkit.image_to_ascii_art("Example.png", "my_ascii_art") ``` **Using an absolute path for the image:** ```python import pywhatkit pywhatkit.image_to_ascii_art("C:\\Users\\User\\Pictures\\Example.png", "my_ascii_art") ``` ### Response #### Success Response (str) - Returns the path to the generated ASCII art file. ``` -------------------------------- ### Cancel Scheduled System Shutdown with PyWhatKit Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Cancels any system shutdown that has been previously scheduled using the `pywhatkit.shutdown()` function. ```python import pywhatkit # Cancel the scheduled shutdown pywhatkit.cancel_shutdown() ``` -------------------------------- ### Send Standard Email with PyWhatKit Source: https://github.com/ankit404butfound/pywhatkit/wiki/Sending-a-Mail Sends a plain text email using the send_mail function. It automatically detects the SMTP server based on the sender's email domain and requires an App Password for authentication. ```python import pywhatkit pywhatkit.send_mail("test@test.com", "password", "Test Mail", "This is a test email", "testrecv@test.com") ``` -------------------------------- ### Send Instant WhatsApp Messages Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Functions to send messages immediately without scheduling. Supports emoji syntax using colons. ```python import pywhatkit # Send a message immediately pywhatkit.sendwhatmsg_instantly( phone_no="+1234567890", message="Hello! Sending this message right now.", wait_time=15, tab_close=True, close_time=3 ) # Send with emoji support using colons pywhatkit.sendwhatmsg_instantly( phone_no="+1234567890", message="Great work! :thumbsup: Keep it up!" ) ``` -------------------------------- ### Send HTML Email with PyWhatKit Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Sends an email containing HTML content, allowing for rich formatting and links. Similar to sending plain text emails, it uses SMTP and supports various email providers. ```python import pywhatkit # Send an HTML email html_content = ""

Welcome!

Thank you for signing up for our newsletter.

Visit our website

" pywhatkit.send_hmail( email_sender="your.email@gmail.com", password="your_app_password", subject="Welcome to Our Service", html_code=html_content, email_receiver="recipient@example.com" ) ``` -------------------------------- ### Send Image or GIF via WhatsApp Source: https://github.com/ankit404butfound/pywhatkit/wiki/Sending-WhatsApp-Messages Sends an image or GIF to a WhatsApp user or group. Supports various image formats depending on the OS (JPEG, PNG on Linux/MacOS, all on Windows). A caption can be included. The browser tab can be optionally closed. ```python sendwhats_image(receiver: str, img_path: str, caption: str = "", wait_time: int = 15, tab_close: bool = False, close_time: int = 3) -> None ``` -------------------------------- ### Message Logging Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Functions to display and manage message logs. ```APIDOC ## show_history - Display Message Log ### Description Displays the history of all messages sent using PyWhatKit from the log file. ### Method ```python show_history() ``` ### Endpoint N/A (Local function) ### Parameters None ### Request Example ```python import pywhatkit pywhatkit.show_history() ``` ### Response None (Outputs to console or log file) ## set_log_path - Set Custom Log Location ### Description Sets a custom directory path for storing the PyWhatKit log file. ### Method ```python set_log_path(path: str) ``` ### Endpoint N/A (Local function) ### Parameters - **path** (str) - Required - The custom directory path for the log file. ### Request Example ```python import pywhatkit pywhatkit.set_log_path("C:\\Users\\Username\\Documents\\Logs") ``` ### Response None (Sets the log path configuration) ``` -------------------------------- ### Send Plain Text Email with PyWhatKit Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Sends a plain text email using SMTP. This function supports common email providers like Gmail, Yahoo, Outlook, and AOL. Requires an app-specific password for services like Gmail. ```python import pywhatkit # Send a plain text email pywhatkit.send_mail( email_sender="your.email@gmail.com", password="your_app_password", # Use app-specific password for Gmail subject="Meeting Tomorrow", message="Hi,\n\nJust a reminder about our meeting tomorrow at 10 AM.\n\nBest regards", email_receiver="recipient@example.com" ) ``` -------------------------------- ### Display Message History Source: https://github.com/ankit404butfound/pywhatkit/wiki/Miscellaneous-Functions Retrieves and displays the history of all messages sent using the library. ```python import pywhatkit pywhatkit.show_history() ``` -------------------------------- ### Send WhatsApp Message to a Group at a Specific Time Source: https://github.com/ankit404butfound/pywhatkit/wiki/Sending-WhatsApp-Messages Sends a WhatsApp message to a specified group at a designated time. The Group ID is found in the group invite link. The browser tab can be optionally closed after sending. ```python 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 ``` -------------------------------- ### Fetch Wikipedia Information Source: https://github.com/ankit404butfound/pywhatkit/wiki/Miscellaneous-Functions Retrieves details about a specific topic using the Wikipedia API. Users can define the number of lines to return and toggle whether the function returns the data as a string. ```python import pywhatkit pywhatkit.info("Python Language", 10) ``` -------------------------------- ### Send Image/GIF via WhatsApp Source: https://github.com/ankit404butfound/pywhatkit/wiki/Sending-WhatsApp-Messages Send an image or GIF to a WhatsApp user or group. Supports captions and closing the browser tab. ```APIDOC ## POST /api/sendwhats_image ### Description Send an image or GIF file to a WhatsApp user or group. A caption can be included with the media. The browser tab can be optionally closed after sending. Note platform-specific limitations on image formats. ### Method POST ### Endpoint /api/sendwhats_image ### Parameters #### Query Parameters - **receiver** (str) - Required - The recipient's phone number (for users) or group ID (for groups). - **img_path** (str) - Required - The local path to the image or GIF file (e.g., 'C:\Image.png'). - **caption** (str) - Optional - A text caption to accompany the image/GIF. Defaults to an empty string. - **wait_time** (int) - Optional - The time in seconds to wait for the WhatsApp Web page to load. Defaults to 15. - **tab_close** (bool) - Optional - Whether to close the browser tab after sending the media. Defaults to False. - **close_time** (int) - Optional - The time in seconds to wait before closing the tab after the media is sent, if `tab_close` is True. Defaults to 3. ### Request Example ```json { "receiver": "+911234567890", "img_path": "C:\\Image.png", "caption": "Here is the image", "wait_time": 10, "tab_close": true, "close_time": 5 } ``` ### Response #### Success Response (200) - **status** (str) - Indicates the success of the operation (e.g., 'Image sent successfully'). #### Response Example ```json { "status": "Image sent successfully" } ``` ``` -------------------------------- ### Play YouTube Video Source: https://github.com/ankit404butfound/pywhatkit/wiki/Miscellaneous-Functions Plays the most relevant YouTube video for a given topic. Supports an optional API mode to resolve malformed URL issues and allows toggling the automatic opening of the video. ```python import pywhatkit pywhatkit.playonyt("Python", use_api=True) ``` -------------------------------- ### Cancel Scheduled Shutdown with PyWhatKit Source: https://github.com/ankit404butfound/pywhatkit/wiki/Shutdown-and-CancelShutdown Aborts any previously scheduled system shutdown task. This function is compatible with Windows, MacOS, and Linux distributions. ```python import pywhatkit # Cancel the pending shutdown pywhatkit.cancel_shutdown() ``` -------------------------------- ### Send HTML Email with PyWhatKit Source: https://github.com/ankit404butfound/pywhatkit/wiki/Sending-a-Mail Sends an email with HTML content as the body using the send_hmail function. This function acts as a wrapper for the standard send_mail function to handle HTML formatting. ```python import pywhatkit pywhatkit.send_hmail("test@test.com", "password", "test", "

HELLO

", "receive@test.com") ``` -------------------------------- ### Send WhatsApp Group Messages Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Functions to send scheduled or instant messages to WhatsApp groups using group IDs. ```python import pywhatkit # Send message to group at midnight pywhatkit.sendwhatmsg_to_group( group_id="AB123CDEFGHijklmn", message="Good morning everyone!", time_hour=0, time_min=0, wait_time=15, tab_close=True, close_time=3 ) # Send instant message to group pywhatkit.sendwhatmsg_to_group_instantly( group_id="AB123CDEFGHijklmn", message="Important announcement!", wait_time=15, tab_close=True, close_time=3 ) ``` -------------------------------- ### Text to Handwriting Source: https://github.com/ankit404butfound/pywhatkit/wiki/Text-to-Handwriting Converts a given string into an image with handwritten characters. You can specify the output filename and the RGB color of the text. ```APIDOC ## POST /text_to_handwriting ### Description Converts a string to an image with handwritten characters. Allows customization of the output filename and text color. ### Method POST ### Endpoint /text_to_handwriting ### Parameters #### Request Body - **string** (str) - Required - The text to convert to handwriting. - **save_to** (str) - Optional - The filename to save the image to. Defaults to "pywhatkit.png". - **rgb** (tuple) - Optional - A tuple representing the RGB color of the text. Defaults to (0, 0, 0) (black). ### Request Example ```json { "string": "Hello World", "save_to": "my_handwriting.png", "rgb": [0, 0, 138] } ``` ### Response #### Success Response (200) - **message** (str) - A success message indicating the image was created. #### Response Example ```json { "message": "Handwritten image saved successfully." } ``` ``` -------------------------------- ### Send Scheduled WhatsApp Message to Group Source: https://github.com/ankit404butfound/pywhatkit/wiki/Sending-WhatsApp-Messages Send a WhatsApp message to a specific group at a scheduled time. Requires the group ID. ```APIDOC ## POST /api/sendwhatmsg_to_group ### Description Send a WhatsApp message to a specific group at a scheduled time. The Group ID can be found in the WhatsApp group invite link. The browser tab can be optionally closed after sending. ### Method POST ### Endpoint /api/sendwhatmsg_to_group ### Parameters #### Query Parameters - **group_id** (str) - Required - The ID of the WhatsApp group (e.g., 'AB123CDEFGHijklmn'). - **message** (str) - Required - The content of the message to be sent. - **time_hour** (int) - Required - The hour at which to send the message (24-hour format). - **time_min** (int) - Required - The minute at which to send the message (24-hour format). - **wait_time** (int) - Optional - The time in seconds to wait for the WhatsApp Web page to load. Defaults to 15. - **tab_close** (bool) - Optional - Whether to close the browser tab after sending the message. Defaults to False. - **close_time** (int) - Optional - The time in seconds to wait before closing the tab after the message is sent, if `tab_close` is True. Defaults to 3. ### Request Example ```json { "group_id": "AB123CDEFGHijklmn", "message": "hello", "time_hour": 12, "time_min": 12, "wait_time": 30, "tab_close": true, "close_time": 5 } ``` ### Response #### Success Response (200) - **status** (str) - Indicates the success of the operation (e.g., 'Message scheduled successfully'). #### Response Example ```json { "status": "Message scheduled successfully" } ``` ``` -------------------------------- ### Send Scheduled WhatsApp Messages Source: https://context7.com/ankit404butfound/pywhatkit/llms.txt Functions to schedule messages for specific times. Requires a phone number with country code and handles browser tab management. ```python import pywhatkit # Send a message at 2:30 PM pywhatkit.sendwhatmsg( phone_no="+1234567890", message="Hello! This is a scheduled message.", time_hour=14, time_min=30, wait_time=15, tab_close=True, close_time=3 ) # Send multiple messages as a list pywhatkit.sendwhatmsg( phone_no="+1234567890", message=["First message", "Second message", "Third message"], time_hour=15, time_min=0 ) ``` -------------------------------- ### Send WhatsApp Message Instantly Source: https://github.com/ankit404butfound/pywhatkit/wiki/Sending-WhatsApp-Messages Sends a WhatsApp message instantly to a specified phone number. The browser tab can be optionally closed after the message is sent, with a configurable delay. ```python sendwhatmsg_instantly(phone_no: str, message: str, wait_time: int = 15, tab_close: bool = False, close_time: int = 3) -> None ``` -------------------------------- ### Send HTML Email Source: https://github.com/ankit404butfound/pywhatkit/wiki/Sending-a-Mail Sends an email with HTML content as the body. This function utilizes the send_mail function internally. ```APIDOC ## POST /send_hmail ### Description Sends an email with HTML code as the body content. This function leverages the `send_mail` function. ### Method POST ### Endpoint /send_hmail ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **email_sender** (string) - Required - The email address of the sender. - **password** (string) - Required - The App Password for the sender's email account. - **subject** (string) - Required - The subject line of the email. - **html_code** (string) - Required - The HTML code to be used as the email body. - **email_receiver** (string) - Required - The email address of the recipient. ### Request Example ```json { "email_sender": "test@test.com", "password": "your_app_password", "subject": "test", "html_code": "

HELLO

", "email_receiver": "receive@test.com" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates successful email sending. #### Response Example ```json { "status": "Email sent successfully" } ``` ``` -------------------------------- ### Send Plain Text Email Source: https://github.com/ankit404butfound/pywhatkit/wiki/Sending-a-Mail Sends a plain text email. It automatically detects the email provider to set the correct SMTP server. ```APIDOC ## POST /send_mail ### Description Sends a plain text email using the provided sender credentials, subject, message, and receiver. ### Method POST ### Endpoint /send_mail ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **email_sender** (string) - Required - The email address of the sender. - **password** (string) - Required - The App Password for the sender's email account. - **subject** (string) - Required - The subject line of the email. - **message** (string) - Required - The plain text content of the email. - **email_receiver** (string) - Required - The email address of the recipient. ### Request Example ```json { "email_sender": "test@test.com", "password": "your_app_password", "subject": "Test Mail", "message": "This is a test email.", "email_receiver": "testrecv@test.com" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates successful email sending. #### Response Example ```json { "status": "Email sent successfully" } ``` ``` -------------------------------- ### Send WhatsApp Message to a Specific Time Source: https://github.com/ankit404butfound/pywhatkit/wiki/Sending-WhatsApp-Messages Sends a WhatsApp message to a specified phone number at a designated time. The time must be in 24-hour format. Optionally, the browser tab can be closed after sending. ```python 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 ``` -------------------------------- ### Send Instant WhatsApp Message Source: https://github.com/ankit404butfound/pywhatkit/wiki/Sending-WhatsApp-Messages Send a WhatsApp message instantly to a specific phone number. Supports closing the browser tab. ```APIDOC ## POST /api/sendwhatmsg_instantly ### Description Send a WhatsApp message instantly to a specified phone number. The browser tab can be optionally closed after the message is sent. ### Method POST ### Endpoint /api/sendwhatmsg_instantly ### Parameters #### Query Parameters - **phone_no** (str) - Required - The recipient's phone number including country code (e.g., '+911234567890'). - **message** (str) - Required - The content of the message to be sent. - **wait_time** (int) - Optional - The time in seconds to wait for the WhatsApp Web page to load. Defaults to 15. - **tab_close** (bool) - Optional - Whether to close the browser tab after sending the message. Defaults to False. - **close_time** (int) - Optional - The time in seconds to wait before closing the tab after the message is sent, if `tab_close` is True. Defaults to 3. ### Request Example ```json { "phone_no": "+911234567890", "message": "hello", "wait_time": 15, "tab_close": true, "close_time": 4 } ``` ### Response #### Success Response (200) - **status** (str) - Indicates the success of the operation (e.g., 'Message sent successfully'). #### Response Example ```json { "status": "Message sent successfully" } ``` ``` -------------------------------- ### Send Scheduled WhatsApp Message Source: https://github.com/ankit404butfound/pywhatkit/wiki/Sending-WhatsApp-Messages Send a WhatsApp message to a specific phone number at a scheduled time. Supports closing the browser tab after sending. ```APIDOC ## POST /api/sendwhatmsg ### Description Send a WhatsApp message to a specific phone number at a scheduled time. The time should be provided in 24-hour format. Optionally, the browser tab can be closed after the message is sent, with a configurable delay. ### Method POST ### Endpoint /api/sendwhatmsg ### Parameters #### Query Parameters - **phone_no** (str) - Required - The recipient's phone number including country code (e.g., '+911234567890'). - **message** (str) - Required - The content of the message to be sent. - **time_hour** (int) - Required - The hour at which to send the message (24-hour format). - **time_min** (int) - Required - The minute at which to send the message (24-hour format). - **wait_time** (int) - Optional - The time in seconds to wait for the WhatsApp Web page to load. Defaults to 15. - **tab_close** (bool) - Optional - Whether to close the browser tab after sending the message. Defaults to False. - **close_time** (int) - Optional - The time in seconds to wait before closing the tab after the message is sent, if `tab_close` is True. Defaults to 3. ### Request Example ```json { "phone_no": "+910123456789", "message": "Hello", "time_hour": 12, "time_min": 12, "wait_time": 30, "tab_close": true, "close_time": 5 } ``` ### Response #### Success Response (200) - **status** (str) - Indicates the success of the operation (e.g., 'Message scheduled successfully'). #### Response Example ```json { "status": "Message scheduled successfully" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.