Files
conversation-history/SquareMCP/deployments/2026-06-18-whatsapp-comm-manager.md

4.3 KiB
Raw Permalink Blame History

Deploy: Add WhatsApp to Communications Manager

Date: 2026-06-18 Severity: Feature gap — WhatsApp was silently missing from the Comm Manager platform list


What was wrong

CommPlatform type was hardcoded to linkedin | facebook | instagram | email. WhatsApp existed as a sending client but was never wired into the Communications Manager draft/approve/publish flow. The ChatGPT GPT couldn't offer it as a publishing option.


Files changed

File Change
src/communications.ts Added 'whatsapp' to CommPlatform type; whatsapp_recipients field to BusinessProfile + ProfileRow; INSERT/UPDATE/parse support; whatsapp to VALID_PLATFORMS; recipient validation; approveAndPublish WhatsApp case (fans out to all whatsapp_recipients)
src/communications-chat.ts Added WhatsApp to PLATFORM_CHAR_LIMITS (160–300 chars) and PLATFORM_OUTPUT_INSTRUCTIONS (conversational, direct, no hashtags)
src/db.ts ALTER TABLE business_profiles ADD COLUMN IF NOT EXISTS whatsapp_recipients JSON NULL — runs on startup, safe on existing DBs
src/index.ts Pass whatsapp_recipients through PUT /api/communications/profile handler

No other schema changes. No Redis changes. Migration is idempotent.


Deploy commands

# Commit
git add src/communications.ts src/communications-chat.ts src/db.ts src/index.ts
git commit -m "feat: add whatsapp to Communications Manager platform list"
git push origin main

# Build and push
docker build -t localhost:32000/hermes-mcp:$(git rev-parse --short HEAD) .
docker push localhost:32000/hermes-mcp:$(git rev-parse --short HEAD)

# Update image SHA in hermes-k8s.yaml, then:
kubectl apply -f hermes-k8s.yaml -n fetcherpay
kubectl rollout status deployment/hermes-mcp -n fetcherpay

Post-deploy: configure the profile

The user needs to set whatsapp_recipients on their business profile before WhatsApp drafts can be approved and sent. Tell the Communications Manager GPT:

Update my business profile: enabled_platforms ["linkedin","facebook","instagram","whatsapp"],
whatsapp_recipients ["+1XXXXXXXXXX"]

(Replace with actual phone number in E.164 format.)


Verification

  1. GET /api/communications/profile — confirm whatsapp appears in enabled_platforms and whatsapp_recipients is set
  2. Ask the Comm Manager GPT to generate content — WhatsApp draft should appear alongside the others
  3. Approve the WhatsApp draft — the recipient should receive the message
  4. GET /api/communications/profile on a fresh account — whatsapp_recipients should be null (column added cleanly)

Verification result

Verification result

  • Status: ✅ Passed (after DB syntax fix)
  • Time: 2026-06-18T00:22:00-04:00
  • Deployed image: localhost:32000/hermes-mcp:7596c00
  • Tester: smoke-test customer (72446fa2-77f0-4a36-b530-8dbf2e8fe9d4)

Initial failure

The first deploy (7d20e09) crashed on startup because the raw ALTER TABLE ... ADD COLUMN IF NOT EXISTS syntax is not supported by the MySQL version in use. The pod logged:

ER_PARSE_ERROR: You have an error in your SQL syntax ... near 'IF NOT EXISTS whatsapp_recipients JSON NULL'

Fix applied

Replaced the raw ALTER TABLE in src/db.ts with the existing ensureColumn(db, 'business_profiles', 'whatsapp_recipients', 'JSON NULL') helper, which queries INFORMATION_SCHEMA.COLUMNS before adding the column. Rebuilt and redeployed as 7596c00.

API verification

  1. GET /api/communications/profile before update
    • whatsapp_recipients field present and null (column added cleanly).
  2. PUT /api/communications/profile with enabled_platforms including whatsapp and whatsapp_recipients: ["+15551234567"]
    • Profile saved successfully; response included whatsapp_recipients: ["+15551234567"].
  3. GET /api/communications/profile
    • Confirmed persisted enabled_platforms: [..., "whatsapp"] and whatsapp_recipients.
  4. Validation check: PUT with enabled_platforms: ["whatsapp"] but no whatsapp_recipients
    • Returned 400 with error whatsapp_recipients is required when whatsapp platform is enabled.

Conclusion

WhatsApp is now wired into the Communications Manager profile, validation, and platform list. The idempotent schema helper safely added the whatsapp_recipients column.