Skip to main content
Dynamic WhatsApp Flows call your data endpoint to fetch screen content at runtime.

How it works

  1. User opens the flow in WhatsApp
  2. Meta sends an encrypted request to Kapso
  3. Kapso decrypts and forwards to your function
  4. Your function returns screen data
  5. Kapso encrypts and returns to Meta
  6. User sees the dynamic content

Setup requirements

Before using data endpoints:
  1. WhatsApp phone number - Set in the Info tab
  2. Flows encryption - One-time setup per phone number (Kapso handles the key exchange)
  3. Function - Your code that returns screen data

Request format

Kapso sends this payload to your function:
{
  "source": "whatsapp_flow",
  "flow": {
    "id": "kapso_flow_id",
    "meta_flow_id": "meta_flow_id"
  },
  "data_exchange": {
    "version": "3.0",
    "action": "data_exchange",
    "screen": "CURRENT_SCREEN",
    "data": {},
    "flow_token": "unique_session_token"
  },
  "signature_valid": true,
  "received_at": "2024-01-15T10:30:00Z"
}
The data_exchange object contains Meta’s original payload with the current screen and any user-submitted data.

Response format

Your function must return:
{
  "version": "3.0",
  "screen": "NEXT_SCREEN_ID",
  "data": {
    "field_name": "value"
  }
}
FieldDescription
versionAlways "3.0"
screenScreen ID to display next
dataKey-value pairs matching screen’s data schema

Completing the flow

To end the flow and close it:
{
  "version": "3.0",
  "screen": "SUCCESS",
  "data": {
    "extension_message_response": {
      "params": {
        "flow_token": "from_request"
      }
    }
  }
}

Limits

LimitValue
Response timeout15 seconds
Rate limit100 requests/minute per flow

Error handling

If your function fails or times out, Kapso returns an error screen to the user. Check the Invocations in your function dashboard for debugging.