FabricFabricHarness
EcosystemChannels

WhatsApp

Route verified WhatsApp Cloud API webhooks to persistent agents.

Use the Meta Cloud API adapter from @fabric-harness/channels/whatsapp:

fh add channel whatsapp
import { createWhatsAppChannel } from '@fabric-harness/channels/whatsapp';

export default createWhatsAppChannel({
  appSecret: process.env.WHATSAPP_APP_SECRET!,
  verifyToken: process.env.WHATSAPP_VERIFY_TOKEN!,
  agent: 'assistant',
});

Configure both GET and POST /channels/whatsapp/webhook. The GET route completes Meta's verification challenge. The POST route verifies X-Hub-Signature-256 against the exact body, deduplicates by WhatsApp message ID, uses the business account as tenant, records the sender as onBehalfOf, and keys the persistent instance by business account/phone number/sender.

Use replyInWhatsApp(ref, { accessToken }) for text replies. Keep template credentials host-side, govern template sends separately, and live-test phone-number/business permissions before rollout.