Skip to main content

WhatsApp Integration

Overview

Nexus integrates with the WhatsApp Business API (Cloud API) via Meta's Embedded Signup flow. Once connected, agents can send and receive WhatsApp messages, template messages, media, and reactions from the omnichannel inbox.

Capabilities

  • Receive inbound text, image, video, document, audio, and location messages.
  • Send outbound text, media, and template messages.
  • Send reactions to messages.
  • Receive delivery status updates (sent, delivered, read).
  • Voice note transcription (Arabic and English) via voice-transcription-worker.

Required permissions / scopes

  • whatsapp_business_management
  • whatsapp_business_messaging

Edge Functions

FunctionDirectionPurpose
whatsapp-webhookInboundReceives messages and status updates from WhatsApp
wa-webhookInboundAlternative webhook endpoint
whatsapp-send-messageOutboundSends text and media messages
wa-sendOutboundAlternative send endpoint
whatsapp-send-templateOutboundSends pre-approved template messages
whatsapp-send-reactionOutboundSends emoji reactions to messages
whatsapp-get-templatesReadFetches available message templates
whatsapp-templatesReadLists templates
whatsapp-reply-statusStatusHandles reply status updates
whatsapp-status-webhookStatusReceives delivery status webhooks
wa-es-callbackAuthHandles embedded signup OAuth callback
save-whatsapp-credentialsConfigStores connection credentials

Webhook setup

WhatsApp webhooks are registered automatically during the Embedded Signup flow. The webhook endpoint receives all events for the connected WABA (WhatsApp Business Account) and routes them to the correct organization.

Webhook verification uses a verify token stored in environment variables (never exposed publicly).

Common troubleshooting

IssueResolution
Messages not arrivingCheck webhook subscription in Meta Business Manager → WhatsApp → Configuration. Verify the Edge Function is deployed.
Template messages failingEnsure the template is approved. Check that template parameters match the expected format.
Media not downloadingVerify Supabase Storage is configured. Check media URL expiration.
Duplicate messagesCheck for duplicate webhook deliveries. The system deduplicates by external message ID.