Files
coucou/scripts/test-whatsapp.sh
Claude 2a0c5682ec WhatsApp pill, phase 1: see incoming messages in the notch
GitHub build only. Coucou talks to a local gateway (GOWA by default, or OpenWA)
and never to WhatsApp's servers.

- WhatsAppProvider with GOWAProvider and OpenWAProvider: status, QR, recent
  messages, send, mark read, group names. Endpoints taken from each gateway's
  docs.
- Webhook bound to 127.0.0.1 only. Coucou registers itself with the gateway
  (GOWA PATCH /devices/{id}/webhook, OpenWA POST /webhooks) and checks the
  HMAC-SHA256 signature on the raw body. Falls back to polling every 20 s.
- WhatsAppController keeps the conversations in memory only (last 20 per
  chat), cleared when turned off or on quit. No message content is logged.
- Pill integration_whatsapp (#25D366) with one row per conversation:
  initials, name, last message, unread count. Media shows as a label only.
  New message: Mochi's happy emote, the global sound setting, the usual
  island rules.
- Settings > Integrations > WhatsApp (experimental): off by default,
  warning, gateway, URL, credentials (Keychain), port, Test connection,
  QR shown in Coucou, mute groups unless mentioned, ignored chats, Focus.
- Tests: gateway payloads copied from the GOWA and OpenWA docs, OpenWA's
  signature fixture, inbox and filters (scripts/test-whatsapp.sh, in CI).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-10-18 15:31:47 +02:00

11 lines
388 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
TEST_DIR="$(mktemp -d "${TMPDIR:-/tmp}/coucou-whatsapp.XXXXXX")"
trap 'rm -rf "$TEST_DIR"' EXIT
swiftc NotchBuddy/Sources/App/WhatsAppModels.swift \
NotchBuddy/Sources/App/WhatsAppGateway.swift \
tests/WhatsAppTests.swift tests/WhatsAppGatewayTests.swift \
-o "$TEST_DIR/whatsapp-tests"
"$TEST_DIR/whatsapp-tests"