aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/hooks/wamail
diff options
context:
space:
mode:
authorElvis Claros Castro <elvis@claros.ar>2026-09-26 19:26:33 -0300
committerElvis Claros Castro <elvis@claros.ar>2026-09-26 19:26:33 -0300
commitd80640d01eeb84907e36ff4af33add9081eda17c (patch)
tree27698b34e06e28d111c2196700015d9c82f78274 /contrib/hooks/wamail
downloadwa-cli-main.tar.gz
wa-cli-main.zip
wa-cli: WhatsApp from the terminal, with a neomutt Maildir bridgeHEADmain
Diffstat (limited to 'contrib/hooks/wamail')
-rwxr-xr-xcontrib/hooks/wamail16
1 files changed, 16 insertions, 0 deletions
diff --git a/contrib/hooks/wamail b/contrib/hooks/wamail
new file mode 100755
index 0000000..192589b
--- /dev/null
+++ b/contrib/hooks/wamail
@@ -0,0 +1,16 @@
+#!/bin/sh
+# wa-cli -> wamail hook: real-time delivery to the neomutt Maildir.
+# Install: ln -s /path/to/wa-cli/contrib/hooks/wamail ~/.config/wa-cli/hooks/all.d/50-wamail
+# The daemon runs hooks one at a time, in order; wamail has its own lock against the timer.
+case "$1" in
+ message_create|unread_count|chat_archived) ;;
+ message_revoke_everyone)
+ stanza=$(jq -r '.data.message.stanzaId // empty')
+ [ -n "$stanza" ] && exec "$HOME/.local/bin/wamail" revoked "$WA_CLI_ACCOUNT" "$stanza"
+ exit 0 ;;
+ *) exit 0 ;;
+esac
+chat=$(jq -r '.data.chatId // .data.message.chatId // .data.chat.id // .data.id // empty')
+case "$chat" in
+ *@c.us|*@g.us|*@lid) exec "$HOME/.local/bin/wamail" sync "$WA_CLI_ACCOUNT" --chat "$chat" --quiet ;;
+esac