Skip to content
WhatSync/DocsAPI v1

Create or edit a WhatsApp form

Save a WhatsApp form (a Meta Flow: screens of fields that open inside the chat) as a DRAFT on the connected Business account.

POST/api/v1/tools/create_whatsapp_formWrite
Key permissions
Read chats and messages + Manage templates
Authentication
Authorization: Bearer $WHATSYNC_API_KEY
How keys work

How it works

  • Nothing is sent.
  • Pass form_id to replace the definition of an existing draft.
  • Write definition as Flow JSON: {"version":"7.2","screens":[{"id":"DETAILS","title":"...","data":{},"layout":{"type":"SingleColumnLayout","children":[...]}}]}.
  • Screen IDs use letters and underscores; SUCCESS is reserved.
  • Components: TextHeading, TextSubheading, TextBody, TextCaption, TextInput (input-type text, number, email, password, passcode, phone), TextArea, Dropdown, RadioButtonsGroup, CheckboxGroup, ChipsSelector (data-source: [{id,title}]), DatePicker, CalendarPicker, OptIn, EmbeddedLink, Image, PhotoPicker, DocumentPicker, If, Switch.
  • Inputs need a unique name and label.
  • Every screen ends with a Footer whose on-click-action is navigate ({"name":"navigate","next":{"type":"screen","name":"NEXT_ID"},"payload":{}}) or, on the last screen ("terminal": true, "success": true), complete with a payload that collects the answers: "${form.field}" for this screen, "${screen.OTHER_ID.form.field}" for earlier screens.
  • Only the complete payload is returned as answers.
  • Meta returns validation_errors; fix them and save again with form_id.
  • Then share preview_url.

Meta's reference

Body parameters

idempotencyKeystringbody or header

A fresh random UUID for each new action; never build it from dates, names, counters or step numbers, which repeat across runs. Reuse it exactly only to retry the same action.

form_idstringoptional

An existing DRAFT form to replace; omit to create a new form

namestringrequired

Internal form name, unique on the account

categoriesSIGN_UP | SIGN_IN | APPOINTMENT_BOOKING | LEAD_GENERATION | CONTACT_US | CUSTOMER_SUPPORT | SURVEY | OTHER[]required

See the example and input schema for this value.

definitionobject | stringrequired

Flow JSON object (or the same as a JSON string)

Conditions and pagination

  • The example is a minimal Flow JSON draft, not an empty object. Inspect validation_errors and preview_url after saving. Supply form_id only to replace an existing draft; publishing is permanent.
  • Use a unique idempotency key for each intended action. Reuse the same key and exactly the same input on a retry. The body key takes precedence over Idempotency-Key.

Response

The response wraps tool-specific data in result. Save operation_id and inspect get_operation with operationId if the outcome is uncertain. completed means the operation completed; it does not prove message delivery or Meta approval. An uncertain operation returns HTTP 409 with error.operation_id.

Every response includes X-Request-Id. Errors use the shared error format and retry rules.

Schemas

Input JSON Schema
Input JSON Schema
{
  "type": "object",
  "properties": {
    "idempotencyKey": {
      "type": "string",
      "pattern": "^[A-Za-z0-9._:-]{8,128}$",
      "description": "A fresh random UUID for each new action; never build it from dates, names, counters or step numbers, which repeat across runs. Reuse it exactly only to retry the same action."
    },
    "form_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 30,
      "description": "An existing DRAFT form to replace; omit to create a new form"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Internal form name, unique on the account"
    },
    "categories": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "SIGN_UP",
          "SIGN_IN",
          "APPOINTMENT_BOOKING",
          "LEAD_GENERATION",
          "CONTACT_US",
          "CUSTOMER_SUPPORT",
          "SURVEY",
          "OTHER"
        ]
      },
      "minItems": 1,
      "maxItems": 3
    },
    "definition": {
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": {}
        },
        {
          "type": "string",
          "maxLength": 1000000
        }
      ],
      "description": "Flow JSON object (or the same as a JSON string)"
    }
  },
  "required": [
    "idempotencyKey",
    "name",
    "categories",
    "definition"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
Response JSON Schema
Response JSON Schema
{
  "type": "object",
  "properties": {
    "operation_id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "completed"
      ]
    },
    "replayed": {
      "type": "boolean"
    },
    "result": {
      "type": "object",
      "properties": {
        "form_id": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "type": [
            "string",
            "null"
          ]
        },
        "categories": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "json_version": {
          "type": [
            "string",
            "null"
          ]
        },
        "validation_errors": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true,
            "description": "Provider or tool-specific fields; preserve unknown fields."
          }
        },
        "preview_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "preview_expires_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "meta_can_send": {
          "type": [
            "string",
            "null"
          ]
        },
        "meta_send_blockers": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true,
            "description": "Provider or tool-specific fields; preserve unknown fields."
          }
        },
        "next_step": {
          "type": "string"
        },
        "definition": {
          "type": "object",
          "additionalProperties": true,
          "description": "Provider or tool-specific fields; preserve unknown fields."
        }
      },
      "required": [],
      "additionalProperties": true
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "operation_id",
    "status",
    "result"
  ],
  "additionalProperties": true
}