1MSG

Create WhatsApp Flow

POST
/flows

Create a WhatsApp Flow in draft state (name and categories required). Optionally set endpointUri (your data-channel URL), upload Flow JSON, and publish immediately.

Authorization

JWT token
querytoken<token>

Request Body

multipart/form-data
  1. body
name*string

Flow name

categories*array<>

Categories (comma or array)

endpointUri?string

HTTPS URL of your server for this Flow data channel. This is not a 1msg route, and these calls are not delivered to the channel webhookUrl.

WhatsApp POSTs JSON with encrypted_flow_data, encrypted_aes_key, and initial_vector. Decrypt encrypted_aes_key with the RSA private key that matches the uploaded business_public_key (RSA-OAEP, SHA-256), then decrypt encrypted_flow_data with AES-128-GCM (initial_vector is the IV; the last 16 bytes of the ciphertext are the auth tag). Respond with that ciphertext as a base64 string and header Content-Type: text/plain. Encrypt the response with the same AES key and the IV after inverting every byte. If decryption fails, respond with HTTP 421 so the WhatsApp app fetches the public key again.

The same URL receives the service ping. Answer it in the same encrypted form; the decrypted body is {"data":{"status":"active"}}. ping and screen exchanges do not arrive on the channel webhook. When the user submits the form, the result is delivered to the channel webhookUrl as messages[].interactive.type = nfm_reply.

Upload the public key with POST /whatsapp_business_encryption and call GET /whatsapp_business_encryption until business_public_key_signature_status is VALID.

Formaturi
cloneFlowId?string

Clone existing flow id

publish?boolean

Publish immediately

flowJson?|

Flow JSON definition (string or object)

file?unknown

Optional flow.json upload

Response Body

Flow created

application/json
  1. response
id?string
success?boolean
flowJson?
publish?
curl -X POST 'https://api.1msg.io/123/flows' \  -F 'name=lead_form' \  -F 'categories=[  "LEAD_GENERATION"]' \  -F 'publish=false'
{  "id": "string",  "success": true,  "flowJson": {    "success": true,    "validationErrors": [      {        "error": "string",        "errorType": "string",        "message": "string",        "lineStart": 0,        "lineEnd": 0,        "columnStart": 0,        "columnEnd": 0,        "pointers": [          {            "lineStart": 0,            "lineEnd": 0,            "columnStart": 0,            "columnEnd": 0,            "path": "string"          }        ]      }    ]  },  "publish": {}}