WhatsApp Templates API

10. Send approved template

Public Developer API for Meta template lifecycle on Cloud WhatsApp accounts. Same Meta engine as the Washeej dashboard. Access requires explicit template scopes; Device/QR management is rejected. Provider Meta delete stays deferred.

Send approved template

Dual-surface endpoints (same contract):

  • POST /v1/templates/send
  • POST /external-api/templates/send

Cloud + approved/sendable + exact language + sequential params. Delivery status continues via message webhooks (wamid).

Idempotency-Key (required)

  • Idempotency-Key header is required on these lifecycle/send dual-surface paths.
  • Missing key → 422 idempotency_key_required (no Meta/provider call).
  • Same key + same payload → original persisted result (replay).
  • Same key + different payload → 409 idempotency_conflict (payload_mismatch).
  • In-flight same key → 409 idempotency_in_flight with retryable=true.
  • Provider outcome unknown → provider_outcome_unknown; Washeej does not blindly resubmit to Meta.

Legacy inbox send (compatibility)

POST /external-api/inbox/send-template-message remains supported for existing Cloud integrators. It keeps the legacy response envelope and does not require Idempotency-Key. New integrations should prefer /v1/templates/send or /external-api/templates/send with durable idempotency.

cURL
curl -X POST "https://staging-mobile.washeej.com/v1/templates/send" \
  -H "client-id: YOUR_CLIENT_ID" \
  -H "client-secret: YOUR_CLIENT_SECRET" \
  -H "Idempotency-Key: send-$(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "template_id": "YOUR_TEMPLATE_ID",
    "mobile_code": "966",
    "mobile": "500000000",
    "whatsapp_account_id": YOUR_CLOUD_ACCOUNT_ID,
    "body_variables": ["Ahmed"]
  }'