WhatsApp GIF
Source safe, context-matching GIFs and send exactly one high-quality result to WhatsApp.
Workflow
- Decide if GIF is appropriate.
- Build concise search query from user intent (2-5 words).
- Run
scripts/find_gif.pyto fetch and rank candidates. - Send top result with
messagetool to WhatsApp (prefer local-file payload mode). - If send fails, retry once with next candidate.
- If still failing or no results, send concise fallback text.
Decision rules
Prefer GIF when:
- The user explicitly asks for GIF/meme/reaction.
- A brief emotional signal is enough.
- Tone benefits from a visual response.
Avoid GIF when:
- Topic is serious/sensitive (medical, legal, conflict, grief).
- Group context is formal or unclear.
- User asked for text-only response.
Script usage
Use these deterministic helpers:
python3 skills/openclaw-whatsapp-gif/scripts/find_gif.py "congrats celebration" --limit 5 --json
python3 skills/openclaw-whatsapp-gif/scripts/find_gif.py "great job" --limit 3 --json --target "+1234567890"
python3 skills/openclaw-whatsapp-gif/scripts/send_gif.py "+1234567890" "great job celebration" --json
python3 skills/openclaw-whatsapp-gif/scripts/send_gif.py "+1234567890" "great job celebration" --delivery-mode local --json
python3 skills/openclaw-whatsapp-gif/scripts/send_gif.py "+1234567890" "great job celebration" --payload-only
Behavior:
- Reads
TENOR_API_KEYand/orGIPHY_API_KEY. - Applies safe filtering (
contentfilter=low/rating=g+ blocklist). - Uses retry + backoff for network fetches.
- Ranks by keyword overlap + lightweight preference.
- If no API keys or no provider results, uses built-in safe fallback catalog.
- Optional web scraping fallback is available only when
allowWebScrapeFallbackis enabled inreferences/policy.json. - Expands intent queries using common reaction aliases.
- Deduplicates repeated URLs across providers.
- Returns URL only (default) or candidate list (
--json). - With
--target, prints a ready-to-send WhatsAppmessagepayload in JSON. - With
send_gif.py --payload-only, prints only the final message payload for direct tool handoff. send_gif.pyvalidates media size/type, retries next candidates when a URL is bad, and writes to OS temp cache.- Telemetry logging is disabled by default and can be enabled by policy or CLI flag.
- Remote URL fallback is disabled by default and must be explicitly enabled in policy.
- Runtime policy is configurable in
references/policy.json.
WhatsApp send pattern
Use message with:
action: "send"channel: "whatsapp"target: <chat id/recipient>media: <gif/mp4 url>caption: <optional short line>gifPlayback: true
If provider rejects .gif, retry using next candidate URL (prefer MP4).
Fallback
If no suitable GIF or delivery fails twice:
- Send concise text preserving intent.
- Do not keep retrying in a loop.
References
- Provider notes:
references/providers.md