ChatPilot
Webhook Pipeline
Meta webhook verification, POST ingestion, and idempotent dispatch.
GET verification compares Meta's hub.verify_token with wa_verify_token and returns hub.challenge on match.
POST payloads include metadata, messages, statuses, contacts, and referrals. ChatPilot extracts phone_number_id, resolves the tenant, writes a webhook_events guard row, dispatches Inngest work, and returns HTTP 200.
webhook_events should enforce uniqueness on event_type + external_id, where external_id maps to values such as wa_message_id or mpesa_checkout_request_id.