agentleFS
roysahar11roysahar11/whatsapp-waha-skill/whatsapp/SKILL.md

whatsapp

Skill2 starsChanged 8 days agoMITView on GitHub

The official WhatsApp integration via WAHA. Always use this skill whenever the user asks to do anything in WhatsApp, including reading or searching chats, retrieving media, checking contacts or groups, and drafting or sending messages. Use this skill rather than the WhatsApp desktop app, WhatsApp Web, or browser/computer automation.

  • Reads credentials

17 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use apple-notes.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • seedprodSkill

    apple-notes

    Manage Apple Notes via the `memo` CLI on macOS (create, view, edit, delete, search, move, and export notes). Use when a user asks OpenClaw to add a note, list notes, search notes, or manage note folders.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

26 rules. 0 are common, 15 are distinctive, and 11 are very specific to this project.

  • 0

    Common

    Most of the 16 edited versions we read keep these.

  • 15

    Distinctive

    This author's own choices. Worth a look.

  • 11

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    First: Read config.local.md in this skill's directory for personal settings (default phone number, integration preferences).

    line 10
  2. Very specific:

    Use the user's own phone number (from config.local.md) when no other recipient is identified.

    line 18
  3. Distinctive:

    If user says "send a message" without specifying recipient → send to their own number

    line 20
  4. Distinctive:

    If user says "test this message" → send to their own number

    line 21
  5. Distinctive:

    If user says "send to the group" without identifying it → ask which group, then apply Rule 2

    line 22
  6. Distinctive:

    Send confirmation: Ask for final confirmation to send that approved message to that audience.

    line 39
  7. Distinctive:

    Before requesting a new approval, check the user's prior instructions, applicable standing authorizations, and the invoked skill or …

    line 45
  8. Distinctive:

    If a reviewer says authorization evidence is missing, recheck the existing approval and the reviewer's permitted next steps.

    line 75
  9. Very specific:

    Never use Read, cat, head, tail, or any tool to view .env files

    line 87
  10. Very specific:

    Never use echo, printf, or any command that outputs secret values

    line 88
  11. Distinctive:

    Never expose API tokens, credentials, instance IDs, or secrets in the conversation

    line 89
  12. Very specific:

    Always use the provided TypeScript scripts which handle credentials internally via dotenv

    line 90
  13. Very specific:

    Run a script with the bundled ts-node.

    line 117
  14. Distinctive:

    Only then ask the user for the phone number

    line 327
  15. Very specific:

    If the file scripts/contacts-aliases.json exists, it contains pre-defined aliases for frequently used contacts with their preferred …

    line 400
  16. Very specific:

    FIRST: - Read contacts-aliases.json and check if the name matches any alias

    line 416
  17. Distinctive:

    IF FOUND: - Use the phone number and language from the alias

    line 417
  18. Very specific:

    Check config.local.md for any personal integration preferences (e.g., a drafting voice/style skill to use when composing messages).

    line 441
  19. Distinctive:

    DEFAULT TO SELF: - Use self-chat when neither the user nor an authorized workflow identifies an external recipient

    line 448
  20. Distinctive:

    REUSE EXISTING AUTHORIZATION: - Follow Rule 2 before asking again: an applicable prior approval, approved sending template, or authorized …

    line 449
  21. Distinctive:

    NEVER ASSUME RECIPIENTS: - If unclear, ask before sending

    line 450
  22. Distinctive:

    NEVER read .env files: - Use scripts that load credentials via dotenv

    line 453
  23. Distinctive:

    NEVER expose in conversation: - Don't display API keys, tokens, instance IDs

    line 455
  24. Very specific:

    Always use --dry-run first: when testing new recipients or bulk sends

    line 458
  25. Distinctive:

    Always preview recipient count: before broadcasting

    line 464
  26. Very specific:

    Use the /waha-admin skill for container setup, session management, and error resolution.

    line 481

“Common” is measured: kept by at least 6 in 10 of the 16 edited versions of this file we could read. “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 Skill (WAHA)

Send and read WhatsApp messages programmatically through a self-hosted WAHA instance.

First: Read config.local.md in this skill's directory for personal settings (default phone number, integration preferences).


Safety Rules

Rule 1: DEFAULT RECIPIENT IS THE USER

Use the user's own phone number (from config.local.md) when no other recipient is identified. An external recipient may come from the user's request or an explicitly authorized workflow's documented contact; apply Rule 2 to the existing authorization.

  • If user says "send a message" without specifying recipient → send to their own number
  • If user says "test this message" → send to their own number
  • If user says "send to the group" without identifying it → ask which group, then apply Rule 2

Rule 2: APPROVAL DEPENDS ON THE RECIPIENTS

Apply these rules to every supported message type, including text, images, voice notes, files, and contact cards:

DestinationRequired approvalsAction
The user's own self-chatNoneSend directly within the requested task or workflow. No draft approval or send confirmation is needed, in interactive sessions as well as automated workflows.
One person other than the userExisting authorization or one new approvalSend when an applicable prior approval, approved template, or authorized workflow covers this execution (see below). Otherwise, present the message and recipient and ask once. A clear instruction to send specific content to that recipient already counts.
Multiple recipients, a group, or a broadcastTwoFirst obtain approval of the draft and full audience; then obtain a separate final send confirmation.

Self-chat includes --phone "self" and the user's own number from config.local.md, after normalizing its format. This exemption does not depend on using autonomous mode or on whether the user is available to respond.

For multiple recipients:

  1. Draft approval: Show the message and the full recipient list or identified group, including recipient count for broadcasts. Wait for explicit approval.
  2. Send confirmation: Ask for final confirmation to send that approved message to that audience. Send after confirmation.

Count recipients across the whole requested operation: a group is a multiple-recipient destination, and sending a batch one person at a time still requires the two-step workflow. Reuse approvals already given for the same content and audience.

Existing authorization for templates and workflows

Before requesting a new approval, check the user's prior instructions, applicable standing authorizations, and the invoked skill or workflow. A template approved for sending, or user-authorized instructions in another skill, can already authorize its prescribed message. Execute within that authorization without requesting fresh explicit approval for each send. Keep domain-specific approval rules and templates in their owning skill; this skill applies their authorization.

For a send to one person, confirm that the authorization covers the purpose or trigger, permitted content or template (including attachments), and recipient or an explicit recipient-selection rule. Fill factual placeholders from the approved sources and respect any limits on repetition. A documented recipient-selection rule can identify the contact for the current task without a new named-recipient approval each time. A template's existence or approval of its wording alone does not establish permission to send it.

A clear affirmative response to a combined workflow approval can authorize its WhatsApp step too; it need not repeat the word WhatsApp. Respect later limits or revocations. If content, attachments, recipient, or repetition fall outside the existing scope, ask only for the missing authorization. A one-person authorization does not cover a group, broadcast, or batch; apply the multiple-recipient rules above to the full audience.

Make the existing authorization visible to the execution reviewer: cite its source and date when available, the authorized template or workflow and scope, and the resolved recipient and selection source. Include any current approval when relevant; it need not be a new explicit send confirmation. Keep bearer links and credentials out of explanations and logs. Another skill supplies authorization only when it records or implements user-granted authority; its mere instruction to send does not create that authority.

If a reviewer says authorization evidence is missing, recheck the existing approval and the reviewer's permitted next steps. If an evidence-based retry is allowed, submit the same action with the omitted authorization evidence instead of asking the user to repeat it. Honor an explicit block or requirement for new approval; do not route around it. Report any remaining block accurately.

Rule 3: MATCH EXTERNAL SENDS TO THEIR AUTHORIZATION

For any destination other than self-chat, resolve the intended person, group, or recipient list and apply Rule 2 using existing authorization first. Ask for new approval only when the available authorization does not cover the send; clarify an unclear recipient rather than guessing.

Rule 4: NEVER EXPOSE SECRETS

  • Never use Read, cat, head, tail, or any tool to view .env files
  • Never use echo, printf, or any command that outputs secret values
  • Never expose API tokens, credentials, instance IDs, or secrets in the conversation
  • Always use the provided TypeScript scripts which handle credentials internally via dotenv

Autonomous Mode

For cron jobs and automated agents sending messages to the user's own self-chat without user interaction. Self-chat also requires no approval during ordinary interactive use; autonomous mode is not a prerequisite for that exemption.

Invocation: /whatsapp autonomous <operation> <args>

Example:

/whatsapp autonomous send-message --phone "self" --message "Daily report ready"

This invocation does not expand authorization. External sends follow Rule 2, including applicable standing or workflow authorization; multiple-recipient sends retain their audience-wide approval requirements.


Prerequisites

  1. WAHA instance running and accessible (image devlikeapro/waha:noweb — the free core image, NOWEB engine)
  2. WAHA session connected (WhatsApp linked via QR code on the WAHA dashboard)
  3. .env file configured in the scripts/ folder (see .env.example)

Running Commands

Run a script with the bundled ts-node. Both paths are relative to this skill's folder (the one that holds this SKILL.md), so put that folder's path in front of each:

scripts/node_modules/.bin/ts-node scripts/<script.ts> [args...]

Examples in this skill show only <script.ts> [args...]; always expand them to that full command. Run it from your current directory instead of cd-ing into the skill: the scripts find their own .env, and relative paths in arguments resolve against where you run them. Where other docs say wa.sh <script.ts>, use this command instead.


Sending Messages

Send Text Message

send-message.ts --phone "972501234567" --message "Hello!"

Options:

  • --phone <NUMBER> - Send to individual (international format, or "self")
  • --group <ID> - Send to group (format: 120363xxx@g.us)
  • --message <TEXT> - Message text
  • --dm-all - With --group: DM each participant individually
  • --dry-run - Preview without sending

Examples:

# Single person
send-message.ts --phone "972501234567" --message "Hello!"

# Group message
send-message.ts --group "120363xxxxxxxxxxxx@g.us" --message "Hello everyone!"

# Broadcast DM to all group members
send-message.ts --group "120363xxxxxxxxxxxx@g.us" --dm-all --message "Personal message to all"

# Dry run (test without sending)
send-message.ts --phone "972501234567" --message "Test" --dry-run

Send Image

send-image.ts --phone "972501234567" --image "/path/to/image.jpg" --caption "Check this out!"

Options:

  • --phone <NUMBER> or --group <ID> - Recipient
  • --image <PATH> - Path to image file (JPG, PNG, GIF, WebP)
  • --caption <TEXT> - Optional caption
  • --dry-run - Preview without sending

Send Voice Note

send-voice.ts --phone "972501234567" --audio "/path/to/audio.mp3"

Options:

  • --phone <NUMBER> or --group <ID> - Recipient
  • --audio <PATH> - Path to audio file (auto-converts to OGG)
  • --dry-run - Preview without sending

Note: Requires ffmpeg installed for audio conversion.

Send File (PDF, Documents, etc.)

send-file.ts --phone "972501234567" --file "/path/to/document.pdf"

Options:

  • --phone <NUMBER> or --group <ID> - Recipient
  • --file <PATH> - Path to file (PDF, DOCX, XLSX, ZIP, etc.)
  • --caption <TEXT> - Optional caption/description
  • --filename <NAME> - Optional custom filename (must include extension)
  • --dry-run - Preview without sending

Examples:

# Send a PDF document
send-file.ts --phone "972501234567" --file "/path/to/report.pdf" --caption "Here's the report"

# Send to a group with custom filename
send-file.ts --group "120363xxx@g.us" --file "/path/to/data.xlsx" --filename "Q4-Report.xlsx"

# Dry run to preview
send-file.ts --phone "972501234567" --file "/path/to/doc.pdf" --dry-run

Supported formats: PDF, DOCX, XLSX, PPTX, TXT, ZIP, and more (max 100MB)

Send Contact (vCard)

send-contact.ts --to "972501234567" --contact "972509876543:John Doe"

Options:

  • --to <NUMBER> - Recipient phone number (or "self")
  • --contact <P:N> - Contact to send (phone:name format), can be repeated
  • --dry-run - Preview without sending

Reading Messages

Get Chat History

Fetch message history from any chat. Defaults to your own chat when no arguments provided - useful for reading messages sent to yourself.

get-chat-history.ts --self --count 10

Options:

  • --self - Read from your own chat - DEFAULT if no chat specified
  • --chat <NUMBER> - Read from a specific contact's chat (a phone number, or a full chat id such as 123@lid, passed through verbatim)
  • --group <ID> - Read from a group chat
  • --count <N> - Number of messages to fetch (default: 100)
  • --format <FMT> - Output format: simple (default), json, or slim-json. simple truncates each message to 100 characters — use slim-json whenever you need the full text (links, long messages)
  • --find-joins - Find people who joined (for groups)
  • --days <N> - Filter joins from last N days (default: 21)

Examples:

# Read last 10 messages from your own chat (sent to yourself)
get-chat-history.ts --self --count 10

# Read messages from a specific contact
get-chat-history.ts --chat "972501234567" --count 20

# Read group messages
get-chat-history.ts --group "120363xxx@g.us" --count 50

# Find who joined a group in the last week
get-chat-history.ts --group "120363xxx@g.us" --find-joins --days 7

Use case: Send a message to yourself on WhatsApp, then use this to read it - useful for sharing example templates, notes, or content you want Claude to use.

Get Recent Messages

Fetch recent messages across all chats or from a specific chat.

get-recent-messages.ts --since 24 --limit 20

Options:

  • --chat <ID> or --group <ID> - Filter by chat/group ID
  • --limit <N> - Max messages to process (default: 50)
  • --since <HOURS> - Only show messages from last N hours (default: 24)
  • --all - Show all message types

Download Media

Download and decrypt media files (videos, images, audio) from any chat. Handles WhatsApp's end-to-end encryption automatically.

download-media.ts --chat "972501234567" -o ./output

Options:

  • --chat <NUMBER> - Download from a contact's chat
  • --group <ID> - Download from a group chat
  • --self - Download from your own chat
  • -o, --output DIR - Output directory (default: current dir)
  • --count <N> - Number of messages to scan (default: 100)
  • --types <TYPES> - Comma-separated: video,audio,image (default: all three)
  • --dry-run - List media without downloading

Examples:

# List all media in a chat without downloading
download-media.ts --chat "972501234567" --dry-run

# Download only videos
download-media.ts --chat "972501234567" --types video -o ./videos

# Download from a group
download-media.ts --group "120363xxx@g.us" -o ./group-media

Output: Files named {timestamp}_{sent|recv}_{type}_{id}.{ext} + a manifest.json with metadata. Skips files that already exist.


Contacts & Groups

Finding a Person's Chat

WAHA's contact store is incomplete, so a name search can miss someone who is plainly in the user's phone:

  • Address-book names saved after the session was linked often never sync. The NOWEB engine gets them through app-state patches it frequently fails to decrypt (see waha-admin, "bad decrypt"). The name the user gave the contact ("Noa - Fractional CTO") may simply not exist here.
  • 1:1 chats carry no name at all — the chats list returns bare ids.
  • Most contacts are keyed by an @lid id, not a phone-based @c.us one.

What every incoming message does carry is the sender's own WhatsApp profile name (pushName) and its text. So search in this order, stopping at the first hit:

  1. contacts-aliases.json (see Contact Aliases below)
  2. get-contacts.ts --search "<name>"
  3. find-chat.ts --name "<name>" — the person's own profile name, which is often in English even when the user refers to them in Hebrew (try both: "Noa" and "נועה")
  4. find-chat.ts --text "<word>" — something distinctive they wrote: their company, a link domain, the topic you are looking for
  5. Only then ask the user for the phone number

Find Chat

find-chat.ts --name "Noa"
find-chat.ts --text "acmecorp"

Scans the most recent 1:1 chats and matches the contact-store names, the senders' profile names, and the message text. Prints each matching chat's phone, names, last activity, matching snippets, and the ready-to-run get-chat-history.ts command. ~10 seconds for 300 chats.

Options:

  • --name <TEXT> - Match contact-store name or the sender's profile name (substring, case-insensitive)
  • --text <TEXT> - Match message text (substring, case-insensitive); either match counts when both are given
  • --chats <N> - Recent chats to scan (default: 300; only the 1:1 ones are read)
  • --messages <N> - Messages to read per chat (default: 40)
  • --format <FMT> - simple (default) or json

Limits: a person who never wrote to the user has no profile name to match, and a chat older than the scan window needs a larger --chats.

Search Contacts

get-contacts.ts --search "John"

Options:

  • --search <NAME> - Search by name
  • --type <TYPE> - Filter: user, group, or all (default: all). user covers both @lid and @c.us contacts; @lid results show the resolved phone number
  • --limit <N> - Limit number of results
  • --format <FMT> - Output: simple (default) or json

Examples:

# Find a contact by name
get-contacts.ts --search "John Smith"

# List all groups
get-contacts.ts --type group

# Find contacts with partial name match
get-contacts.ts --search "John" --type user

Get Contact Info

get-contact-info.ts --phone "972501234567"

Options:

  • --phone <NUMBER> - Single phone number
  • --phones <N1,N2,...> - Comma-separated phone numbers
  • --format <FMT> - Output: simple (default) or json
  • --download-avatar - Download profile picture

Get Group Members

get-group-members.ts --group "120363xxxxxxxxxxxx@g.us"

Options:

  • --group <ID> - Group ID
  • --format phones - Phone numbers only (default)
  • --format json - Full JSON output
  • --output <FILE> - Save to file

Contact Aliases

If the file scripts/contacts-aliases.json exists, it contains pre-defined aliases for frequently used contacts with their preferred language settings.

Structure:

{
  "aliases": {
    "nickname": {
      "phone": "972501234567",
      "name": "Display Name",
      "language": "english"
    }
  }
}

Workflow for finding contacts:

  1. FIRST - Read contacts-aliases.json and check if the name matches any alias
  2. IF FOUND - Use the phone number and language from the alias
  3. IF NOT FOUND - Continue with the search order in Finding a Person's Chat

See contacts-aliases.example.json for the expected format.


Instance Management

Check Instance Status

check-instance.ts [settings|state|reboot|logout]
  • settings (default) - Show full session settings
  • state - Show connection state
  • reboot - Stop and restart the session
  • logout - Disconnect WhatsApp (will need QR scan again)

Personal Integration Preferences

Check config.local.md for any personal integration preferences (e.g., a drafting voice/style skill to use when composing messages).


Safety Guidelines

Sending Safety

  1. DEFAULT TO SELF - Use self-chat when neither the user nor an authorized workflow identifies an external recipient
  2. REUSE EXISTING AUTHORIZATION - Follow Rule 2 before asking again: an applicable prior approval, approved sending template, or authorized workflow can cover a send; apply the full-audience rules for groups and batches
  3. NEVER ASSUME RECIPIENTS - If unclear, ask before sending

Credential Security

  1. NEVER read .env files - Use scripts that load credentials via dotenv
  2. NEVER echo/print secrets - No echo $TOKEN, printf, or debug output
  3. NEVER expose in conversation - Don't display API keys, tokens, instance IDs

Technical Safety

  1. Always use --dry-run first when testing new recipients or bulk sends
  2. Rate limiting is built-in (500ms between messages in broadcast mode)
  3. Max 200 messages/day recommended per number for bulk operations

Broadcast Safety (--dm-all)

  1. TWO-STEP APPROVAL - Apply Rule 2 to the full audience of --dm-all broadcasts
  2. Always preview recipient count before broadcasting
  3. Suggest sending to self first to verify message content

Phone Number Formats

The scripts auto-normalize phone numbers. Israeli number example:

  • 0501234567 → 972501234567
  • +972501234567 → 972501234567
  • 972501234567 → 972501234567 (unchanged)
  • self → user's own number (auto-resolved from session)

Troubleshooting & WAHA Management

Use the /waha-admin skill for container setup, session management, and error resolution.

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.