WhatsApp· 6 min read

WhatsApp Flows: build forms inside the chat


A WhatsApp Flow is a form of one or more screens that opens inside the chat. You describe the screens in Flow JSON, send the Flow as an interactive message, and receive the answers in an nfm_reply message on your messages webhook. A Flow without an endpoint needs no server of yours until that final webhook. A Flow with an endpoint exchanges encrypted data with your server while the user moves between screens. Flows are part of the WhatsApp Cloud API, Meta’s official API; Meta calls them “a way to build structured interactions for business messaging” (WhatsApp Flows, accessed 2026-11-02).

When a Flow beats a chain of questions

A Flow fits when you need several fields at once, such as an appointment with date, time and service. One question per message also works, but every answer is free text you have to parse.

Device support limits the choice. Meta lists Flows on “Android running OS 6.0 and newer” and “iPhone running iOS 12 and newer”, and states that “WhatsApp Flows is not supported on companion devices (for example, WhatsApp Web)” (Flows overview, accessed 2026-11-02). A user who answers you from WhatsApp Web cannot open the form. If your audience works from a desktop, keep a plain-message path for the same data.

For two or three choices, a reply buttons or list message is lighter and works without building a Flow.

Flow JSON basics

Flow JSON needs two top-level keys, version and screens. routing_model and data_api_version are optional, and the current data_api_version is 3.0 (Flow JSON reference, accessed 2026-11-02). Meta’s header example reads {"version": "3.1", "data_api_version": "3.0", "routing_model": {"MY_FIRST_SCREEN": ["MY_SECOND_SCREEN"]}, "screens": [...]}.

You only write a routing model when the Flow uses an endpoint. “The routing model is generated automatically if your Flow doesn’t use a Data Endpoint.” When you do write one, “There can be up to a maximum of 10 branches within the routing model.”

A few rules on the same page catch first drafts. SUCCESS “is a reserved keyword and should not be used as a screen id”. The whole Flow JSON string “cannot exceed 10 MB”. And “It’s mandatory to have a Footer component on the terminal screen.” That Footer usually carries the complete action, which “Terminates the flow and sends the response message to the chat thread”. This is Meta’s example Footer, joined from the page’s snippets:

{
  "type": "Footer",
  "label": "Submit data",
  "on-click-action": {
    "name": "complete",
    "payload": {
      "discount_code": "${data.discount_code}",
      "items": "${form.selected_items}"
    }
  }
}

In Meta’s examples, the completion webhook’s response_json carries flow_token plus the fields you send, which is where this payload’s values end up.

Endpoint or no endpoint

A Flow without an endpoint is static. Every screen and option is in the Flow JSON, and your server sees nothing until the user submits. Use it for forms whose options don’t change per user.

A Flow with an endpoint calls your server during the session. Meta defines the endpoint as a “Communication channel created to exchange data between WhatsApp screens and the business server” (Flows overview). You need one when a screen depends on live data, such as free appointment slots or a price for the user’s address. In Flow JSON 3.0 and later, data_channel_uri “is not supported”, so you set endpoint_uri through the Flows API instead.

Each request to your endpoint carries encrypted_flow_data, encrypted_aes_key and initial_vector (implementing the endpoint, accessed 2026-11-02). Decrypt the AES key with your RSA private key (OAEP, SHA-256), then decrypt the data with AES-GCM. Encrypt your response with AES-GCM using the bit-inverted IV, and “encode the whole output as base64 string and send it in the HTTP response body as plain text”. If a request cannot be decrypted, “the endpoint should return HTTP 421 response status code.”

The decrypted request names an action. INIT opens the Flow, data_exchange carries a screen’s submitted data, and BACK arrives when a screen sets refresh_on_back. A ping health check expects {"data": {"status": "active"}}. Error notifications expect {"data": {"acknowledged": true}}. To finish from the endpoint, answer with the SUCCESS screen:

{
  "screen": "SUCCESS",
  "data": {
    "extension_message_response": {
      "params": {
        "flow_token": "FLOW_TOKEN"
      }
    }
  }
}

Meta’s health guide says to “aim to return a response in less than 1 second” (health monitoring, accessed 2026-11-02). Do the slow work after the Flow completes, behind a queue between the webhook and your workers.

Sign the business public key

Endpoint flows need a signed public key on each phone number. Meta’s encryption page asks for a registered number and a 2048-bit RSA key pair, and says “this API must be called to sign the business public key for each phone number” (business encryption, accessed 2026-11-02). Generate the pair with Meta’s commands. The first one asks for a passphrase.

openssl genrsa -des3 -out private.pem 2048
openssl rsa -in private.pem -outform PEM -pubout -out public.pem

Then upload the public key. “Meta automatically signs the public key during upload”.

curl -X POST \
  'https://graph.facebook.com/v26.0/PHONE_NUMBER_ID/whatsapp_business_encryption' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'business_public_key=BUSINESS_PUBLIC_KEY'

A GET on the same path returns business_public_key and business_public_key_signature_status, which is VALID or MISMATCH. Check it after every key rotation and on every new number.

Send the Flow

Inside the customer service window you send the Flow as an interactive message (sending a Flow, accessed 2026-11-02). This is Meta’s minimum sample, cleaned so it runs. Meta’s version has an inline //or flow_id comment, which breaks the JSON, so it is removed here.

curl -X  POST \
 'https://graph.facebook.com/v18.0/FROM_PHONE_NUMBER/messages' \
 -H 'Authorization: Bearer ACCESS_TOKEN' \
 -H 'Content-Type: application/json' \
 -d '{
  "recipient_type": "individual",
  "messaging_product": "whatsapp",
  "to": "whatsapp-id",
  "type": "interactive",
  "interactive": {
    "type": "flow",
    "header": {
      "type": "text",
      "text": "Flow message header"
    },
    "body": {
      "text": "Flow message body"
    },
    "footer": {
      "text": "Flow message footer"
    },
    "action": {
      "name": "flow",
      "parameters": {
        "flow_message_version": "3",
        "flow_name": "appointment_booking_v1",
        "flow_cta": "Book!"
      }
    }
  }
}'

Use flow_id in place of flow_name if you prefer the numeric ID. Meta’s sample calls v18.0; its other current samples use v26.0.

flow_message_version “must be 3”. mode is draft or published, and published is the default. flow_action is navigate or data_exchange, with navigate as the default. Meta also advises CTA text of 30 characters or less, without emoji.

Set your own flow_token. Meta describes it as “generated by the business to serve as an identifier”, and the default value is unused. A token that encodes the user and the session lets you match the completion webhook to the right record.

Outside the window, Meta’s route is a template: “you can create and send a message template with a WhatsApp Flow attached to it.” The template goes through approval like any other.

Read the nfm_reply webhook

When the user submits, the answers arrive on the regular messages webhook (Flows webhooks, accessed 2026-11-02). This is Meta’s example:

{
  "messages": [{
    "context": {
      "from": "16315558151",
      "id": "gBGGEiRVVgBPAgm7FUgc73noXjo"
    },
    "from": "<USER_ACCOUNT_NUMBER>",
    "id": "<MESSAGE_ID>",
    "type": "interactive",
    "interactive": {
      "type": "nfm_reply",
      "nfm_reply": {
        "name": "flow",
        "body": "Sent",
        "response_json": "{\"flow_token\": \"<FLOW_TOKEN>\", \"optional_param1\": \"<value1>\", \"optional_param2\": \"<value2>\"}"
      }
    },
    "timestamp": "<MESSAGE_SEND_TIMESTAMP>"
  }]
}

response_json is a string that holds JSON, so parse it a second time:

import json


def flow_answers(message: dict):
    interactive = message.get("interactive", {})
    if interactive.get("type") != "nfm_reply":
        return None
    return json.loads(interactive["nfm_reply"]["response_json"])

The parsed object carries flow_token plus the fields from your complete payload. context.id is the message that held the Flow button. Store the answers before your bot replies, as in save to CRM before replying, and check the signature first, as in X-Hub-Signature-256 verification.

Publishing states and endpoint health

A Flow moves through five states (Flow lifecycle, accessed 2026-11-02).

State What Meta allows
Draft Testing only; can be deleted; users see a banner
Published Sent to real users; editing metadata or Flow JSON returns it to Draft
Deprecated Cannot be sent
Throttled 10 messages per hour
Blocked Cannot be sent or opened

For significant changes to a published Flow, Meta suggests cloning it. A blocked Flow recovers through Throttled back to Published.

Meta throttles or blocks endpoint flows when error rate, latency or availability “deteriorate significantly”, without a published number. Subscribe to the flows webhook field to see trouble first. It sends FLOW_STATUS_CHANGE, ENDPOINT_ERROR_RATE at 5, 10 and 50% over 30 minutes, and ENDPOINT_LATENCY at p90 of 1, 5 and 7 seconds. ENDPOINT_AVAILABILITY, CLIENT_ERROR_RATE and FLOW_VERSION_EXPIRY_WARNING complete the set. Meta presents these thresholds as alerts, not as the point where throttling starts.

Z-API Omni team