agentleFS
muhammad-anas35muhammad-anas35/Nexus-ai-employee/skills/whatsapp-watcher/SKILL.md

whatsapp-watcher

Skill1 starsChanged 52 days agoMITView on GitHub

Monitor WhatsApp Web for urgent messages using Playwright automation. Detects messages with keywords like "urgent", "asap", "invoice", "payment", or "help" and creates action files. Use when you need to monitor WhatsApp for time-sensitive communications or integrate WhatsApp into automated workflows. Requires manual QR code setup.

  • Reads credentials
  • Deletes or force-pushes
  • Installs packages

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No need to scan QR code every time

    line 156
  2. Distinctive:

    Only processes unread messages

    line 161
  3. Distinctive:

    Never sync session to cloud

    line 176
  4. Distinctive:

    Read-only access to chats

    line 184
  5. Distinctive:

    Consider official WhatsApp Business API for commercial use

    line 191
  6. Distinctive:

    Verify messages are unread

    line 234
  7. Distinctive:

    Check WhatsApp Web is logged in

    line 235

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

WhatsApp Watcher

Monitor WhatsApp Web for urgent messages containing specific keywords, automatically creating action files in the vault for immediate processing.

Overview

This skill uses Playwright to automate WhatsApp Web, monitoring for urgent messages that contain keywords like "urgent", "asap", "invoice", "payment", or "help". When detected, it creates action files for Claude to process.

Usage

# Start the WhatsApp watcher
python scripts/whatsapp_watcher.py

# Test mode (dry run)
python scripts/whatsapp_watcher.py --test

# Custom check interval (seconds)
python scripts/whatsapp_watcher.py --interval 30

What It Does

  1. Monitors WhatsApp Web using Playwright automation
  2. Scans unread chats for urgent keywords
  3. Creates action files in /Needs_Action/WHATSAPP_*.md
  4. Preserves session for continuous monitoring
  5. Logs all activity to /Logs/whatsapp_watcher.log

Prerequisites

Install Playwright

# Install Playwright
pip install playwright

# Install browser binaries
playwright install chromium

First Run Setup

# First run will open WhatsApp Web for QR code scan
python scripts/whatsapp_watcher.py --setup

# Scan QR code with your phone
# Session will be saved for future runs

Configuration

Environment Variables

# .env file
WHATSAPP_SESSION_PATH=./whatsapp_session
VAULT_PATH=./AI_Employee_Vault
CHECK_INTERVAL=30  # seconds
HEADLESS=true  # Run browser in background

Keyword Configuration

Default urgent keywords:

  • urgent
  • asap
  • invoice
  • payment
  • help
  • emergency
  • critical

Customize in whatsapp_watcher.py:

self.keywords = ['urgent', 'asap', 'invoice', 'payment', 'help', 'custom_keyword']

Action File Format

Created files follow this structure:

---
type: whatsapp
from: Contact Name
phone: +1234567890
received: 2026-03-12T20:26:00Z
priority: high
status: pending
keywords_matched: urgent, payment
---

# WhatsApp Message Received

## Message Content

[Message text content]

## Suggested Actions

- [ ] Reply to sender
- [ ] Process request
- [ ] Create invoice/payment
- [ ] Archive after handling

## Contact Details

- **From:** Contact Name
- **Phone:** +1234567890
- **Time:** 2026-03-12 20:26:00
- **Keywords:** urgent, payment
- **Priority:** high

## Notes

Add processing notes here.

Integration with Workflow

WhatsApp Message → WhatsApp Watcher → /Needs_Action/WHATSAPP_*.md
                                            ↓
                              Claude processes with /process-vault-tasks
                                            ↓
                              Creates plan or draft reply
                                            ↓
                              Requests approval if needed
                                            ↓
                              Human sends reply manually
                                            ↓
                              Marks as done, logs action

Features

Keyword Detection

  • Scans message text for urgent keywords
  • Case-insensitive matching
  • Multiple keyword support
  • Configurable keyword list

Session Persistence

  • Saves WhatsApp Web session
  • No need to scan QR code every time
  • Persistent across restarts
  • Secure local storage

Smart Filtering

  • Only processes unread messages
  • Ignores group messages (optional)
  • Focuses on urgent communications
  • Prevents duplicate processing

Error Handling

  • Graceful handling of connection issues
  • Auto-reconnect on session loss
  • Continues monitoring after errors
  • Detailed error logging

Security & Privacy

Session Management

  • Session stored locally in whatsapp_session/
  • Never sync session to cloud
  • Add to .gitignore
  • Encrypted by Playwright

Privacy

  • Messages stay local
  • No external logging
  • Full audit trail locally
  • Read-only access to chats

WhatsApp Terms of Service

⚠️ Important: WhatsApp's Terms of Service prohibit automated access to WhatsApp Web. Use this tool:

  • For personal use only
  • At your own risk
  • With awareness of potential account restrictions
  • Consider official WhatsApp Business API for commercial use

Monitoring

Check Status

# View recent activity
tail -f AI_Employee_Vault/Logs/whatsapp_watcher.log

# Check created action files
ls -lt AI_Employee_Vault/Needs_Action/WHATSAPP_*.md

# View browser session
ls -la whatsapp_session/

Health Checks

The watcher logs heartbeat messages:

2026-03-12 20:26:00 - WhatsAppWatcher - INFO - Checking for urgent messages...
2026-03-12 20:26:02 - WhatsAppWatcher - INFO - Found 1 urgent message(s)
2026-03-12 20:26:02 - WhatsAppWatcher - INFO - Created WHATSAPP_client_urgent_1710275162.md

Troubleshooting

"Session expired" error

# Delete session and re-authenticate
rm -rf whatsapp_session/
python scripts/whatsapp_watcher.py --setup

"Browser not found" error

# Reinstall Playwright browsers
playwright install chromium

No messages detected

  • Check keyword configuration
  • Verify messages are unread
  • Check WhatsApp Web is logged in
  • Review logs for errors

High CPU usage

  • Increase check interval
  • Use headless mode
  • Close unnecessary browser tabs

Advanced Usage

Custom Message Processing

Extend the watcher for custom logic:

def should_process_message(self, message_text, contact_name):
    """Custom filtering logic"""
    # Only process from specific contacts
    if contact_name not in ['Important Client', 'Boss']:
        return False

    # Check for specific patterns
    if 'invoice' in message_text.lower():
        return True

    return False

Group Message Handling

# Enable group message monitoring
self.monitor_groups = True

# Filter specific groups
self.allowed_groups = ['Work Team', 'Client Group']

Integration with Reply System

# Chain with processing and reply
python scripts/whatsapp_watcher.py &
sleep 5
claude /process-vault-tasks
# Human reviews and sends reply manually

Performance

  • Memory: ~200MB (Chromium browser)
  • CPU: Low (only during checks)
  • Network: Minimal (WhatsApp Web connection)
  • Disk: ~100MB (browser session)

Limitations

  • Requires active internet connection
  • WhatsApp Web must stay logged in
  • Cannot send messages (read-only)
  • Manual reply required
  • Subject to WhatsApp's rate limits

Dependencies

playwright==1.41.0

Alternative: WhatsApp Business API

For production use, consider:

  • WhatsApp Business API
  • Official API with send capabilities
  • No automation restrictions
  • Requires business verification
  • Paid service

See Also

  • /process-vault-tasks - Process created action files
  • Company_Handbook.md - WhatsApp handling rules
  • orchestrator.py - Automated scheduling
  • gmail_watcher.py - Similar pattern for email

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.