Receives WhatsApp Business Cloud API webhooks, picks out group messages, translates them to English (from Hebrew by default), summarizes them, and stores every record in SQLite. Results are viewable at the /status endpoint.
The listener lives at:
Rendering mermaid diagram...
hub.challenge — we echo it back if the hub.verify_token matches.text messages that carry a group_id, translate each, summarize it, and store it.GET /status returns the latest processed messages as JSON.| Method | Path | Purpose |
|---|---|---|
| GET | / | Meta webhook verification handshake (hub.* query params) |
| POST | / | Receive webhook events (translate + summarize + store) |
| GET | /status | View recent processed messages as JSON |
| POST | /test | Simulate a group-message webhook to test the pipeline |
| POST | /digest | Email outstanding messages now (on-demand digest trigger) |
In addition to storing messages, a scheduled job emails you a digest of everything new since the last run. New messages are marked "digested" once included, so nothing is double-sent.
0 5,12 * * * — 05:00 and 12:00 UTC (08:00 and 15:00 UTC+3).jobs/digest.ts (interval type); logic lives in lib/digest.ts.curl -X POST https://whatsapp-listener.val.run/digestDIGEST_EMAIL to override.Required before Meta can talk to us:
WA_VERIFY_TOKEN — a secret string. Set the same value in Meta's App Dashboard so webhook verification passes.Optional:
SOURCE_LANGUAGE — source language code. Defaults to he (Hebrew) since that's the expected group language. Override (e.g. es, nl) for other groups, or leave unset to auto-detect each message with franc.TARGET_LANGUAGE — target language, default en.MYMEMORY_EMAIL — your email; raises MyMemory's free translation quota from ~5K to ~50K chars/day.SUMMARY_MAX_SENTENCES — extractive summary length, default 3.DIGEST_EMAIL — digest recipient. If unset, mail goes to the val owner's address.LLM_ENDPOINT / LLM_API_KEY / LLM_MODEL — optional; if all three are set, use an OpenAI-compatible chat-completions endpoint for higher-quality abstractive summaries (falls back to extractive otherwise).Key env var URLs (set these in the Val Town UI):
👉 Add WA_VERIFY_TOKEN here: https://www.val.town/x/kineticalrisk/whatsapp-listener/environment-variables?key=WA_VERIFY_TOKEN 👉 Add SOURCE_LANGUAGE here: https://www.val.town/x/kineticalrisk/whatsapp-listener/environment-variables?key=SOURCE_LANGUAGE 👉 Add DIGEST_EMAIL here: https://www.val.town/x/kineticalrisk/whatsapp-listener/environment-variables?key=DIGEST_EMAIL 👉 Add MYMEMORY_EMAIL here: https://www.val.town/x/kineticalrisk/whatsapp-listener/environment-variables?key=MYMEMORY_EMAIL
curl -X POST https://whatsapp-listener.val.run/test
Then open https://whatsapp-listener.val.run/status to see the processed message.
whatsapp_business_messaging permission.https://whatsapp-listener.val.run/WA_VERIFY_TOKENmessages webhook field.group_id); 1:1 chats are ignored.[Image] / [Video] / [Audio] placeholders.MYMEMORY_EMAIL or an LLM key.