API Docs

WhatsApp template drafts

Generate preflight-checked Meta-shaped template drafts and report the real approval outcome for measurement and eligible refunds.

POST/whatsapp-template-drafts

Utility order-update template

UTILITY requires specific customer-initiated action context and realistic examples for every variable.

curl --request POST \
  --url https://www.lahjty.com/api/v1/whatsapp-template-drafts \
  --header "Authorization: Bearer $LAHJTY_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: template-order-shipped-1851" \
  --data '{
  "name": "order_shipped",
  "category": "UTILITY",
  "output_language": "ar",
  "language_code": "ar",
  "market": "SA",
  "dialect": "saudi",
  "purpose": "Tell a customer that their order has shipped",
  "customer_action_context": "The recipient placed the referenced order",
  "variables": [
    {
      "name": "customer_name",
      "example": "نورة"
    },
    {
      "name": "order_number",
      "example": "A-1842"
    },
    {
      "name": "delivery_date",
      "example": "الخميس"
    }
  ],
  "header": "TEXT",
  "footer": true,
  "buttons": [
    {
      "type": "QUICK_REPLY",
      "text": "تواصل معنا"
    }
  ],
  "external_customer_id": "merchant-91"
}'

Example response

response.json
{
  "id": "wtd_01jexample",
  "object": "whatsapp_template_draft",
  "request_id": "req_01jexample",
  "status": "UNSUBMITTED",
  "output_language": "ar",
  "market": "SA",
  "dialect": "saudi",
  "meta_payload": {
    "name": "order_shipped",
    "language": "ar",
    "category": "UTILITY",
    "components": [
      {
        "type": "HEADER",
        "format": "TEXT",
        "text": "تحديث طلبك"
      },
      {
        "type": "BODY",
        "text": "هلا {{1}}، تم شحن طلبك رقم {{2}} ومتوقع يوصل {{3}}.",
        "example": {
          "body_text": [
            [
              "نورة",
              "A-1842",
              "الخميس"
            ]
          ]
        }
      }
    ]
  },
  "payload_hash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
  "compliance": {
    "ready_for_submission": true,
    "findings": [],
    "final_decision_owner": "META"
  },
  "usage": {
    "credits_used": 2,
    "balance_after": 474
  }
}
POST/whatsapp-template-drafts

English marketing template

English is supported. Include a concrete opt-in context and omit dialect.

curl --request POST \
  --url https://www.lahjty.com/api/v1/whatsapp-template-drafts \
  --header "Authorization: Bearer $LAHJTY_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: template-marketing-en-1852" \
  --data '{
  "name": "weekend_coffee_offer",
  "category": "MARKETING",
  "output_language": "en",
  "language_code": "en_GB",
  "market": "AE",
  "purpose": "Offer opted-in customers 20% off a coffee subscription this weekend",
  "opt_in_context": "Recipients opted in to WhatsApp promotions during checkout",
  "variables": [
    {
      "name": "first_name",
      "example": "Maya"
    }
  ],
  "header": "TEXT",
  "footer": true,
  "buttons": [
    {
      "type": "URL",
      "text": "View offer",
      "url": "https://merchant.example/offers/weekend"
    }
  ],
  "external_customer_id": "merchant-91"
}'

Submit through your provider

  1. Store draft id, meta_payload, and payload_hash.
  2. Submit meta_payload through your own WhatsApp provider integration.
  3. Report every Meta state change with a unique provider_event_id.
POST/whatsapp-template-drafts/wtd_01jexample/outcomes

Report the Meta outcome

Send the hash of the payload actually submitted. An unchanged rejection becomes a refund candidate, but reporting alone grants no credits; Lahjty must first verify trusted Meta or provider evidence.

curl --request POST \
  --url https://www.lahjty.com/api/v1/whatsapp-template-drafts/wtd_01jexample/outcomes \
  --header "Authorization: Bearer $LAHJTY_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: template-outcome-meta-event-3001" \
  --data '{
  "outcome": "REJECTED",
  "meta_template_id": "123456789012345",
  "provider_event_id": "provider-meta-event-3001",
  "submitted_payload_hash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
  "category": "UTILITY",
  "reason": "Meta rejection reason",
  "occurred_at": "2026-09-04T09:30:00Z"
}'

Example response

response.json
{
  "object": "whatsapp_template_outcome",
  "draft_id": "wtd_01jexample",
  "outcome": "REJECTED",
  "unchanged": true,
  "category": "UTILITY",
  "refund": {
    "candidate": true,
    "eligible": false,
    "status": "PENDING_VERIFICATION",
    "credits": 2,
    "balance_after": null,
    "verification_required": true
  }
}

What to measure

Run approval-rate experiments by category, language, market, and whether the merchant edited the draft. Compare generated drafts with human-written controls. Do not mix approval rate with campaign-copy repeat usage; they answer different product questions.