Usage Examples - klakshman318/pywhatkit-whatsapp-integration GitHub Wiki
📋 Usage Examples
Here are practical examples and commands for sending WhatsApp messages using pywhatkit
.
1️⃣ Install Dependencies
Install the required packages:
pip install -r requirements.txt
Or directly:
pip install pywhatkit
2️⃣ Basic Message Example
import pywhatkit
pywhatkit.sendwhatmsg_instantly(
phone_no="+919xxxxxxxxx",
message="Hello from pywhatkit!",
wait_time=10,
tab_close=True
)
3️⃣ Message with Emoji
message = "Hi 👋, this is an automated WhatsApp message!"
pywhatkit.sendwhatmsg_instantly("+919xxxxxxxxx", message, wait_time=10, tab_close=True)
4️⃣ Scheduled Message
Send a message at a specific time (e.g., 3:30 PM):
pywhatkit.sendwhatmsg("+919xxxxxxxxx", "Scheduled message", 15, 30)
5️⃣ Send Image with Caption
pywhatkit.sendwhats_image("+919xxxxxxxxx", "path/to/image.jpg", "Here’s an image!", wait_time=10)
Notes
- Replace
+919xxxxxxxxx
with your actual phone number (stored securely via GitHub Secrets in workflows). - Adjust
wait_time
for slower connections (default is 15 seconds; you can use 10+). - Ensure WhatsApp Web is accessible and QR login is completed once.
Customize messages, images, and timings as per your needs.