Checkout Flows

WhatsApp Flows collect shipping address and payment details after a cart order. This is the native checkout path — distinct from carousel Buy-button orders, which create orders with order_source carousel_campaign or carousel_inquiry without using the native cart UI.

List flows

GET /api/external/commerce/flows

Auth: Authorization: Bearer ck_<api_key> (required)

Response example

{
  "success": true,
  "flows": [
    {
      "id": 1,
      "meta_flow_id": "700000000000001",
      "name": "Demo Checkout Flow",
      "category": "SHOPPING",
      "status": "PUBLISHED"
    }
  ]
}

Create flow

POST /api/external/commerce/flows

Auth: Authorization: Bearer ck_<api_key> (required)

Request parameters

FieldRequiredTypeDescription
nameYesstringFlow display name
categoryNostringMeta flow category (default SHOPPING)
flowJsonNoobjectWhatsApp Flow JSON definition (screens, fields, routing)

Response example

{
  "success": true,
  "message": "Flow created",
  "flow": {
    "id": 1,
    "meta_flow_id": "700000000000001",
    "name": "Demo Checkout Flow",
    "category": "SHOPPING",
    "status": "DRAFT"
  }
}

Publish flow

POST /api/external/commerce/flows/:flowId/publish

Auth: Authorization: Bearer ck_<api_key> (required)

:flowId is the internal ChatYug flow ID (not the Meta flow ID).

Response example

{
  "success": true,
  "message": "Flow published successfully"
}

Send flow message

POST /api/external/messages/flow

Auth: Authorization: Bearer ck_<api_key> (required)

Send an interactive Flow message to a customer. Use after a cart order if auto-send is disabled in portal settings, passing the flow_token from GET /orders/:orderId.

Request parameters

FieldRequiredTypeDescription
phoneNumberIdYesstringWhatsApp phone number ID to send from
toYesstringRecipient phone in digits (e.g. 919876543210)
flowIdNostringMeta Flow ID. Falls back to the default checkout flow configured in portal Commerce Settings.
flowTokenNostringBind flow response to an order. Auto-generated if omitted.
headerTextNostringDefault 🛒 Ready to Checkout?
bodyTextNostringDefault Complete your order below.
footerTextNostringDefault Powered by ChatYug
ctaTextNostringFlow CTA button label (default Proceed)
initialScreenIdNostringFirst screen to open (auto-resolved from stored flow JSON if omitted)
initialScreenDataNoobjectPre-fill data for the first screen (e.g. order_id, product_name, order_total)

Response example

{
  "success": true,
  "message": "Flow message sent",
  "flowToken": "flow_1720856400000_abc123",
  "messageId": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgSQjAwMDAwMDAwMDAwMDAwAA=="
}

Code samples — send flow

curl -X POST https://chatyug.com/api/external/messages/flow \
  -H "Authorization: Bearer ck_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "phoneNumberId": "100000000000001",
    "to": "919876543210",
    "flowId": "700000000000001",
    "flowToken": "order_1720856400000_abc123",
    "initialScreenData": {
      "order_id": "1001",
      "product_name": "Demo Cotton T-Shirt",
      "order_total": "INR 998.00"
    }
  }'
const axios = require('axios');

await axios.post('https://chatyug.com/api/external/messages/flow', {
  phoneNumberId: '100000000000001',
  to: '919876543210',
  flowId: '700000000000001',
  flowToken: 'order_1720856400000_abc123',
  initialScreenData: {
    order_id: '1001',
    product_name: 'Demo Cotton T-Shirt',
    order_total: 'INR 998.00'
  }
}, { headers: { Authorization: 'Bearer ck_your_api_key_here' } });
import requests

requests.post('https://chatyug.com/api/external/messages/flow', json={
    'phoneNumberId': '100000000000001',
    'to': '919876543210',
    'flowId': '700000000000001',
    'flowToken': 'order_1720856400000_abc123',
    'initialScreenData': {
        'order_id': '1001',
        'product_name': 'Demo Cotton T-Shirt',
        'order_total': 'INR 998.00'
    }
}, headers={'Authorization': 'Bearer ck_your_api_key_here'})
$client = new GuzzleHttp\Client();
$client->post('https://chatyug.com/api/external/messages/flow', [
    'headers' => ['Authorization' => 'Bearer ck_your_api_key_here'],
    'json' => [
        'phoneNumberId' => '100000000000001',
        'to' => '919876543210',
        'flowId' => '700000000000001',
        'flowToken' => 'order_1720856400000_abc123',
        'initialScreenData' => [
            'order_id' => '1001',
            'product_name' => 'Demo Cotton T-Shirt',
            'order_total' => 'INR 998.00'
        ]
    ]
]);
Meta reference: WhatsApp Flows