From aviz85-claude-skills-library
Sends and receives WhatsApp messages, images, voice notes, and files via Green API (primary) with WAHA fallback. Includes voice transcription and media encoding guidance.
How this skill is triggered — by the user, by Claude, or both
Slash command
/aviz85-claude-skills-library:whatsappThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Send messages via unified script with Green API (primary) + WAHA (fallback if configured).
Send messages via unified script with Green API (primary) + WAHA (fallback if configured).
cd ~/.claude/skills/whatsapp/scripts
# Text message
npx ts-node send-message.ts "Hello!" --to 972501234567
# Multiline text from shell: use $'...'
npx ts-node send-message.ts $'Line 1\n\nLine 2\n- Bullet A\n- Bullet B' --to 972501234567
# Image with caption
npx ts-node send-message.ts --to 972501234567 --image /path/to/image.jpg --caption "Check this out!"
# Video with caption
npx ts-node send-message.ts --to 972501234567 --video /path/to/video.mp4 --caption "Watch this!"
# Any media file (auto-detect)
npx ts-node send-message.ts --to 972501234567 --media /path/to/any-file --caption "Here!"
# Voice message
npx ts-node send-message.ts --to 972501234567 --voice /path/to/audio.ogg
# File/document
npx ts-node send-message.ts --to 972501234567 --file /path/to/doc.pdf --caption "Here's the doc"
# Send to group
npx ts-node send-message.ts "Group message" --group [email protected]
# Reply to a specific message (quoted reply)
npx ts-node send-message.ts "Reply!" --group [email protected] --quote BAE5367237E13A1B
# Voice as quoted reply
npx ts-node send-message.ts --group [email protected] --voice /tmp/voice.mp3 --quote BAE5367237E13A1B
# Dry run (preview)
npx ts-node send-message.ts "Test" --to 972501234567 --dry-run
| Alias | Number | Use Case |
|---|---|---|
| myself / me / test | $MY_PHONE (from config.sh) | Default recipient |
WhatsApp (and Facebook) play a video silently if its audio track is MP3 muxed into an MP4 — the file is valid and has sound in desktop players, but the mobile app drops it. Always ship video with AAC audio:
# Re-encode ONLY the audio to AAC, leave the video untouched; +faststart for streaming
ffmpeg -y -i in.mp4 -c:v copy -c:a aac -b:a 192k -movflags +faststart out.mp4
# Verify it isn't silent before sending
ffmpeg -i out.mp4 -af volumedetect -f null /dev/null 2>&1 | grep mean_volume
Voice notes: convert the source to OGG/Opus first — raw MP3 in a container is unreliable in the app.
| Option | Description |
|---|---|
"message" | Text message (first positional argument) |
--to, --phone <NUMBER> | Phone number (Israeli format accepted) |
--group <ID> | Group ID (format: [email protected]) |
--image <PATH> | Attach image file |
--video <PATH> | Attach video file (MP4, etc.) |
--media <PATH> | Attach any media file (auto-detect) |
--voice <PATH> | Send voice message (OGG/MP3) |
--file <PATH> | Attach document/file |
--caption <TEXT> | Caption for media files |
--quote <MSG_ID> | Reply to a specific message (quotedMessageId) |
--dry-run | Preview without sending |
When sending a WhatsApp message with line breaks from the shell, do not pass literal \n inside a normal quoted string if you want actual newlines in the final message.
Use shell ANSI-C quoting instead:
npx ts-node send-message.ts $'Hi\n\nLine 2\n- Item 1\n- Item 2' --group [email protected]
Why:
"text with \n" sends the characters \ + n — but the script auto-converts these to real newlines$'text with \n' sends real line breaks nativelyEither form works — the script normalizes literal \n to real newlines before sending.
Apostrophes inside $'...': Use \' directly — do NOT use the '\'' trick. The '\'' pattern breaks out of ANSI-C quoting, and everything after it becomes regular single-quoted (where \n is literal).
# CORRECT — apostrophe inside $'...'
$'I\'ve added a check.\n\nNext line.'
# WRONG — breaks ANSI-C quoting, \n becomes literal after the apostrophe
$'I'\''ve added a check.\n\nNext line.'
For structured WhatsApp messages, prefer:
English messages: Use regular bullets/dashes. Never use Hebrew letters (א. ב. ג.) in English text.
- First item
- Second item
- Third item
Hebrew messages: Every line must start with a Hebrew character for correct RTL rendering. Use Hebrew letters for list items.
א. פריט ראשון
ב. פריט שני
ג. פריט שלישי
Don't mix: No Hebrew letters in English messages, no dashes/numbers in Hebrew messages.
Don't:
- פריט ראשון
1. פריט שני
* פריט שלישי
Lines starting with non-Hebrew characters (dashes, numbers, asterisks, English) break RTL alignment in WhatsApp. Always ensure the first visible character is Hebrew.
| Content Type | Primary | Fallback |
|---|---|---|
| Text | Green API | WAHA (if configured) |
| Image | Green API | - |
| Video | Green API | - |
| Voice | Green API | - |
| File | Green API | - |
Note: WAHA is not currently installed. Green API handles all message types.
Credentials in scripts/.env:
# Green API (primary provider)
GREEN_API_URL=https://7103.api.greenapi.com
GREEN_API_INSTANCE=your_instance
GREEN_API_TOKEN=your_token
# WAHA (optional fallback — uncomment if installed)
# WAHA_URL=http://localhost:3001
# WAHA_API_KEY=your_key
# WAHA_SESSION=default
| Input | Normalized |
|---|---|
972501234567 | [email protected] |
0501234567 | [email protected] |
501234567 | [email protected] |
For text messages only:
source ~/.claude/skills/whatsapp/config.sh
curl -s -X POST "$WAHA_URL/api/sendText" \
-H "X-Api-Key: $WAHA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session": "default",
"chatId": "[email protected]",
"text": "Hello!"
}'
source ~/.claude/skills/whatsapp/config.sh
curl -s -H "X-Api-Key: $WAHA_API_KEY" "$WAHA_URL/api/sessions/default"
When user says "send WhatsApp to [name]" without phone number:
get-contact skill to search CRMAlways confirm contact before sending.
When user says "send to [project] group" — search Green API directly (WAHA may be down):
TOKEN=$(grep "GREEN_API_TOKEN" ~/.claude/skills/whatsapp/scripts/.env | cut -d'=' -f2)
INSTANCE=$(grep "GREEN_API_INSTANCE" ~/.claude/skills/whatsapp/scripts/.env | cut -d'=' -f2)
curl -s "https://7103.api.greenapi.com/waInstance$INSTANCE/getChats/$TOKEN" | python3 -c "
import json,sys
data=json.load(sys.stdin)
for c in (data if isinstance(data,list) else []):
if '@g.us' in c.get('id',''):
print(c.get('id'), '|', c.get('name',''))
"
Then send using send-message.ts --group <ID>.
Never check WAHA session before sending — the script handles fallback automatically.
Green API is the primary provider. WAHA is not installed and only used as fallback if explicitly configured.
Just run send-message.ts — it uses Green API directly.
Fetch incoming messages, voice recordings, and media from any contact:
# Get recent messages from a contact
npx ts-node get-messages.ts --chat 972526062921 --count 5
# Get messages from last 2 hours
npx ts-node get-messages.ts --chat 972526062921 --minutes 120
# Get all messages from a time range
npx ts-node get-messages.ts --start "2h ago" --end "now"
# Output as JSON (includes download URLs for media)
npx ts-node get-messages.ts --chat 972526062921 --json
What you get:
Quoted/reply messages are shown inline — get-messages.ts now displays quoted context automatically with ↳ Reply to prefix. Both extendedTextMessage and quotedMessage types are handled.
Message types: textMessage, extendedTextMessage (with .text), quotedMessage (reply with .quotedMessage.textMessage), reactionMessage, imageMessage
Voice Message Workflow:
get-messages.ts --jsondownloadUrl from audioMessage typeffmpeg -i file.oga -ar 16000 file.wav/transcribe --language he /path/to/file.wavSometimes after sending a message you need the contact's reply before you can continue — an approval, a decision, feedback, a "how much do I owe you". Instead of stopping and asking the user to watch the chat, hand the waiting to the Monitor tool and keep working; each new reply arrives as a notification.
Use scripts/watch-replies.sh — it polls for genuinely new incoming messages (dedupes by id, handles text / reactions / media) and prints one line per reply, which is exactly what Monitor consumes. Exits only when killed (Monitor timeout / TaskStop).
# usage
scripts/watch-replies.sh --chat <number|groupId> [--since <epoch>] [--interval 30] [--label REPLY]
Launch it through the Monitor tool (not Bash), so replies notify you while you keep working:
command: ~/.claude/skills/whatsapp/scripts/watch-replies.sh --chat 972501234567 --since "$(date +%s)" --label CLIENTtimeout_ms: how long to wait (e.g. 3600000 for an hour).--since to the moment you sent ($(date +%s)), or old history re-fires as if new.⚠️ Do NOT hand-roll an inline poller in the Monitor
command. Passing a group id or JSON body directly in the shell breaks under zsh —@g.ustriggersbad math expression: illegal character: @, and the monitor exits 1.watch-replies.shtakes the chat as an argument (--chat <id>), so group ids are safe. Always reach for this script; never inline the group id + curl/python in the Monitor command.
Reach for it when the reply changes what you do next:
Skip it for fire-and-forget (a confirmation, an FYI, a "done") — no reply is expected, so there's nothing to watch.
Often the right move is to remain engaged: when a reply lands, respond, then re-arm a fresh watcher (new --since) for the next turn. That's a real back-and-forth — send sample → they approve → send fix → wait again — until the thread naturally closes (final approval, thanks, payment settled, or the user says wrap up). Each round: send → watch → reply → re-watch. Use your judgement on when the exchange is genuinely done and it's time to stop watching.
TaskStop the old one before arming a new one.(reaction 👍) and media as [imageMessage]; when you need the image URL / caption / voice file, pull the full record with get-messages.ts --json.npx claudepluginhub aviz85/claude-skills-library --plugin ten-by-tenAutomates WhatsApp messaging via Green API: send text, voice notes (with ffmpeg), images/files; retrieve group members using TypeScript CLI scripts. Useful for bulk messaging or group data extraction.
Sends and receives WhatsApp messages, reacts to conversations, sets status, and polls for incoming messages via Baileys WebSocket client. Restricted to allowlisted contacts. Use when the user asks to send or read WhatsApp messages, monitor WhatsApp conversations, or automate WhatsApp communication.
Sends WhatsApp messages, reads chats, and manages conversations via CLI. Handles QR code and pairing code authentication. Drives auth flow on failure.