💬 Shared WhatsApp Inbox on the new PlatformMore
1msg official logo

Send a WhatsApp Flow for appointment booking (API)

This scenario sends a WhatsApp Flow entry point with sendFlow during the 24-hour customer service window.

Use case overview

This scenario sends a WhatsApp Flow entry point with sendFlow during the 24-hour customer service window. A personalised greeting plus Book now CTA opens the published flow form.

Template example

Hi {{1}}, book your appointment:

  • {{1}}
    customer name in the flow invitation text
WhatsApp Business API for appointment booking — whatsapp flow

When to use it

Use this scenario when a client expresses booking intent during an active WhatsApp session and you need structured date and time capture that free-text chat cannot validate. It fits service-appointment workflows for developers, small teams, and agencies that already have a published Meta Flow and want the client to schedule without leaving the thread.

Validated scheduling fields
The Book now CTA opens your published Meta Flow inside WhatsApp, so date and time preferences arrive as structured form submissions instead of ambiguous free-text replies your backend must parse.
Booking stays in the same thread
sendFlow fires during the open 24-hour customer service window, so the client completes the flow form in the same chat instead of switching to email or an external booking widget.
Personalised flow invitation
One body variable carries the customer name in the greeting text, so the sendFlow message reads as a direct invitation before the client taps Book now.
Booking data back to your system
When the client submits the flow form, the completion payload returns to your CRM or calendar integration via the flow webhook, so scheduling does not stop at the chat screen.
No cold-start template friction
Because the client is already in an open session, sendFlow delivers the flow entry point without starting a new conversation through a rigid approved template first.

Workflow

  1. Trigger

    A client expresses booking intent while the session is open.

    event · triggered

  2. Capture event

    Your backend resolves the customer name and flow id.

    phone: "+…"

  3. Build & send

    sendFlow sends the greeting with the Book now CTA.

    POST /send_flow

  4. Delivered

    The client completes the flow form and booking data returns to your system.

    delivered

WhatsApp Business API for appointment booking — whatsapp flow

Technical implementation

Prerequisites

  1. 1MSG API Key · How to get API Key
  2. WhatsApp Business account · How to Connect WABA
  3. Open 24-hour session window · How the 24-hour window works
  4. Customer opt-in · How to Manage Customers Consent
  5. Webhook endpoint · How to Set Up Webhooks

Code examples

#!/usr/bin/env bash
set -euo pipefail

# === Configuration (replace "___" placeholders) ===
API_BASE_URL="https://api.1msg.io"        # production 1MSG API base URL
CHANNEL_ID="___"                           # channel ID from 1MSG dashboard
API_TOKEN="___"                            # channel JWT token (Bearer)



# === Test data ===
TEST_PHONE="___"                 # client phone in international format
FLOW_TOKEN="___"                         # flow token from your backend

PHONE_NORM="$(printf '%s' "$TEST_PHONE" | tr -cd '0-9')"
URL="${API_BASE_URL%/}/${CHANNEL_ID}/sendFlow"

read -r -d '' PAYLOAD <<JSON || true
{
  "phone": "${PHONE_NORM}",
  "body": "Hi Alex, book your appointment:",
  "flowId": "1234567890",
  "flowToken": "${FLOW_TOKEN}",
  "flowCta": "Book now",
  "flowAction": "navigate"
}
JSON

RESPONSE="$(curl -s -w '\n%{http_code}' -X POST "$URL" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${API_TOKEN}" \
  -d "$PAYLOAD")"

HTTP_CODE="$(printf '%s' "$RESPONSE" | tail -n1)"
BODY="$(printf '%s' "$RESPONSE" | sed '$d')"

case "$BODY" in
  *'"sent":true'*) ok=1 ;;
  *) ok=0 ;;
esac

if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ] && [ "$ok" -eq 1 ]; then
  echo "Message sent to client."
else
  echo "$BODY" >&2
  exit 1
fi

Response and delivery status

HTTP 2xx and JSON "sent": true mean 1MSG accepted the message for sending — not that it already reached the customer's phone. Save the id field (looks like wamid.…) to correlate delivery callbacks.

200 OKResponse
{
  "sent": true,
  "message": "Sent to [email protected]",
  "description": "Message has been sent to the provider",
  "id": "wamid.HBgLMzgwNjM5..."
}
  • sent

    Accepted for sending — not yet on the customer's phone

  • id

    Store it; delivery callbacks and hookInfo are keyed on this

Delivery statuses and webhooks →

Common errors

StatusAPI responseCauseFix
200Message was not sent: provide chatId, phone, bsuid, or usernameNo recipient the channel could resolve.Pass exactly one recipient: phone (country code plus number, digits only), chatId (for example [email protected]) or bsuid.
401token is requiredThe request has no token.Add your channel token as the token query parameter: https://api.1msg.io/{channelId}/{method}?token=…
429too many requests. please try laterThe channel is over its send rate.Queue messages on your side and retry with exponential backoff.

All error codes →

Common questions

Related

Build for WhatsApp in hours
without infrastructure hassle