{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibah5nxhbiushmhvsstrv5n4mkrembs2al2v5ufzheuxxxe67a23a",
"uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mptnga6y24q2"
},
"coverImage": {
"$type": "blob",
"ref": {
"$link": "bafkreibgtg7kgrkczj2qicbyeka4lk4sl5ztfpgxhc4ebzfiktphyzwsv4"
},
"mimeType": "image/webp",
"size": 71324
},
"path": "/markbusking/how-to-automate-whatsapp-with-python-in-2026-no-selenium-no-bs-1fb5",
"publishedAt": "2026-07-04T17:21:34.000Z",
"site": "https://dev.to",
"tags": [
"python",
"whatsapp",
"playwright",
"automation",
"https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd\"",
"https://github.com/markbus-ai/whatsplay",
"@client.on_message"
],
"textContent": "How to Automate WhatsApp with Python in 2026\n\nEvery WhatsApp automation tutorial still recommends `selenium` with fragile XPath selectors that break every week. There's a better way.\n\nWhy Playwright + `whatsplay`?\n\nPlaywright is faster, more reliable, and `whatsplay` wraps the WhatsApp Web DOM with stable selectors (attribute-based instead of minified class names).\n\nWhat you'll build\nA bot that monitors a price and sends an alert to your WhatsApp group.\n\nInstall\npip install whatsplay playwright\nplaywright install chromium\n\nStep 1: Connect to WhatsApp\nfrom whatsplay import Client\n\nclient = Client()\nclient.launch()\nclient.wait_for_login()\n\nStep 2: Send a message\nchat = client.get_chat(\"Mi Grupo\")\nchat.send_message(\"¡Hola! Esto es automático 🤖\")\n\nStep 3: Monitor + alert (real use case)\nimport httpx\n\ndef check_price():\nr = httpx.get(\"https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd\")\nreturn r.json()[\"bitcoin\"][\"usd\"]\n\n@client.on_message()\ndef handler(msg):\nif msg.text and \"precio\" in msg.text.lower():\nprice = check_price()\nchat.send_message(f\"BTC está en ${price:,}\")\n\nWhy this approach wins\n\n * Selectors don't break on WhatsApp updates\n * Works with QR login, persistent sessions\n * 34 tests covering message parsing, timestamps, voice messages\n\n\n\nFull docs: github.com/markbus-ai/whatsplay (https://github.com/markbus-ai/whatsplay)\nPyPI: pip install whatsplay",
"title": "How to Automate WhatsApp with Python in 2026 (No Selenium, No BS)"
}