Skip to main content

WhatsApp Webhooks

Agent-TS is Kapso-first for WhatsApp messaging. It keeps a compatibility webhook for external client testing, but production traffic should use Kapso / Meta webhooks.

Endpoints

Compatibility Webhook

POST /api/v1/external/whatsapp For local testing or temporary bridge scenarios.

Meta Business API Webhook

GET /api/v1/webhooks/whatsapp - Verification POST /api/v1/webhooks/whatsapp - Message handling For Meta’s official WhatsApp Business API.

External Client Integration

Text Message Payload

Image Message Payload

The media.data field must include the data URI prefix (data:image/jpeg;base64,).

Response Format

Kapso-first messaging

Kapso is the supported WhatsApp transport for:
  • free-text conversations
  • interactive list menus
  • reply buttons for confirmations and navigation
  • WhatsApp Flows for structured data capture and PIN/auth steps
  • template messages from internal services when approved by WhatsApp

Meta WhatsApp Business API

Webhook Verification

Meta sends a GET request to verify your webhook:
The agent responds with the challenge if the verify token matches WHATSAPP_VERIFY_TOKEN.

Incoming Message Payload

Meta Developer Console Setup

  1. Go to Meta for Developers
  2. Create or select your app
  3. Add WhatsApp product
  4. Configure webhook URL: https://your-domain.com/api/v1/webhooks/whatsapp
  5. Set verify token: Same as WHATSAPP_VERIFY_TOKEN
  6. Subscribe to messages webhook field

Payload Fields Reference

Error Responses

Validation Error

Agent Error

Rate Limited

Health Check

Verify the agent is running:
Response:

Testing

Test Compatibility Text Message

Test Compatibility Transfer

Security Considerations

All incoming messages are sanitized to prevent injection attacks.
30 requests per minute per phone number by default.
Meta webhooks are verified using the configured verify token.
Production webhook endpoints must use HTTPS.

Next Steps

Configuration

Environment variable setup

KYC Validation

Image processing details