5.7 KiB
All Integration Attempts
WhatsApp Personal Account Integration Attempts - Complete Log
Date: 2026-05-01 Author: OpenCode AI Status: ABANDONED - All attempts failed Final action: Restored to clean state (git checkout HEAD -- .)
Goal
Enable Hermes MCP to send WhatsApp messages using a personal account (Garfield's number: +19548716341). Meta Cloud API requires a business account, so we tried workarounds.
Attempt 1: Playwright Browser Automation (FAILED)
Approach
Use Playwright to automate WhatsApp Web in a headless browser.
Changes Made
- Created
src/clients/whatsapp-web.ts(Playwright-based) - Extract QR code from canvas → serve via HTTP server on port 3000
- Session persistence in
/tmp/whatsapp-web-session
Problems Encountered
- Kubernetes port exposure - QR server on port 3000 not exposed
- Playwright dependencies - Required
apt-get installof multiple system libs - Container crashes - Pod in
CrashLoopBackOff - Dockerfile issues - Needed
node:20-sliminstead of Alpine
Files Modified
src/clients/whatsapp-web.ts(new)src/tools.ts(addedwhatsapp_web_send_messagetool)src/index.ts(added/whatsapp-web/sendendpoint + QR server)Dockerfile(added Playwright + system deps)package.json(movedplaywrightto dependencies)
Result
❌ Pod crashed repeatedly. Playwright in Docker container too brittle.
Attempt 2: Baileys Node.js Library (FAILED)
Approach
Use Baileys (pure Node.js WhatsApp Web library, no browser needed).
Changes Made
- Rewrote
src/clients/whatsapp-web.tsusing Baileys - Used
qr-imageto generate QR code images - Used
useMultiFileAuthStatefor session persistence
Problems Encountered
- TypeScript errors - Complex types, ES modules vs CommonJS conflicts
- Build failures -
tsckept failing with various errors - Docker cache issues - Images not rebuilding properly
- Pod crashes - Exit code 1, no clear error visible due to certificate issues with
kubectl logs
TypeScript Errors Fixed (but still failed)
TS2305: Module has no exported member 'WhatsAppToolArgs'TS7016: Could not find declaration file for module 'qr-image'TS2304: Cannot find name 'WhatsAppToolArgs'TS1005: ',' expected(syntax errors in complex type definitions)
Files Modified
src/clients/whatsapp-web.ts(rewritten multiple times)src/tools.ts(addedWhatsAppToolArgstype, then removed)src/index.ts(importedsetupQRServer)package.json(addedbaileys,qr-image)
Result
❌ Build succeeded but pod still crashed. Switched to CommonJS (.cjs) but still failed.
Attempt 3: CommonJS Rewrite (FAILED)
Approach
Bypass TypeScript entirely by writing .cjs (CommonJS) files.
Changes Made
- Created
src/clients/whatsapp-web.cjs(CommonJS syntax) - Updated imports in
tools.tsandindex.tsto userequire() - Added
// eslint-disable-next-linecomments
Problems Encountered
- ES module scope -
require is not definedin ES modules - File extensions - Renamed to
.cjs, then back to.ts - Docker COPY -
whatsapp-web.cjsnot being copied todist/
Result
❌ Still crashed. Pod in CrashLoopBackOff.
Attempt 4: Final Clean Build (FAILED)
Approach
Force rebuild Docker image without cache, ensure all files correct.
Actions Taken
- Removed all WhatsApp files
- Restored to clean state multiple times with
git checkout HEAD -- . - Rebuilt from scratch multiple times
- Pushed to local registry
localhost:32000/hermes-mcp:latest
Docker Build Command
docker build --no-cache -t localhost:32000/hermes-mcp:latest .
Result
❌ Pod still crashes. Certificate issues prevent viewing logs via kubectl logs.
Final State
What Works
✅ Hermes MCP server (original version without WhatsApp)
✅ Health endpoint: https://hermes.fetcherpay.com/health
✅ Obsidian tools working
✅ Email tools working
What Doesn't Work
❌ WhatsApp personal account integration ❌ All workarounds (Playwright, Baileys) fail in Kubernetes
Files Restored to Original
src/clients/whatsapp-web.ts(deleted)src/tools.ts(original)src/index.ts(original)Dockerfile(original)package.json(original)
Root Causes
- WhatsApp Web protocols - Both Playwright and Baileys fail in headless Docker containers
- Kubernetes complexity - Certificate issues block debugging (
kubectl logsfails with TLS error) - TypeScript/ES modules - ES module configuration makes CommonJS interop difficult
- Container crashes - Exit code 1 with no visible error output
Recommendations for Future AI
Option 1: Twilio WhatsApp Sandbox (RECOMMENDED)
- Pros: Works with personal numbers, no container issues, just REST API
- Cons: Requires Twilio account (free sandbox available)
- Implementation: 1 hour, just REST calls like Meta Cloud API
Option 2: Meta Cloud API with Business Account
- Pros: Native solution, already partially implemented in
src/clients/whatsapp.ts - Cons: Requires WhatsApp Business account (user has personal)
Option 3: Skip WhatsApp
- Move to Phase 2 (LinkedIn integration)
- Come back to WhatsApp when user has business account
Commands That Might Help Debugging
# Check pod status
microk8s kubectl get pods -n fetcherpay -l app=hermes-mcp
# Check events
microk8s kubectl get events -n fetcherpay --sort-by='.lastTimestamp' | grep hermes
# Try to see crash reason (but TLS cert issue blocks this)
microk8s kubectl logs deployment/hermes-mcp -n fetcherpay --tail=50
Bottom line: WhatsApp personal account integration is not feasible with current approach. Use Twilio or get a business account.