PageSourceSearch

https://app.campaignhq.co/_next/static/chunks/pages/developer/docs-c20cce5a8291125d.js

js campaignhq.co collected 2026-10-01 12:01:28 UTC 32,878 bytes, 76 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2575],{33714:function(e,s,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/developer/docs",function(){return n(69873)}])},69873:function(e,s,n){"use strict";n.r(s),n.d(s,{default:function(){return DeveloperDocsPage}});var i=n(85893),t=n(9008),r=n.n(t),a=n(41664),l=n.n(a),d=n(11163),c=n(67294),o=n(74855),p=n(40061),h=n(14924),x=n(37791),m=n(93032),u=n(71276);let j={info:{_postman_id:"5a7ec3db-7152-488f-a5ab-e4f6f8d7b0df",name:"CampaignHQ - Transactional WhatsApp API (v1 Consumer)",description:"Consumer-friendly collection for /api/v1/whatsapp/send using template.variables (position, merge_tag, value).",schema:"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},variable:[{key:"base_url",value:"http://localhost:3000"},{key:"api_key",value:"REPLACE_WITH_BEARER_API_KEY"},{key:"service_id",value:"715"},{key:"template_auth_id",value:"123"},{key:"template_marketing_id",value:"456"},{key:"campaign_id",value:""},{key:"recipient_phone",value:"+919632641012"}],item:[{name:"Template - Authentication OTP",request:{method:"POST",header:[{key:"Authorization",value:"Bearer {{api_key}}",type:"text"},{key:"Content-Type",value:"application/json",type:"text"}],body:{mode:"raw",raw:'{\n  "message_type": "template",\n  "campaign_id": null,\n  "service_id": {{service_id}},\n  "idempotency_key": "auth-otp-0001",\n  "template": {\n    "template_id": {{template_auth_id}},\n    "language": "en",\n    "dynamic_template_data": {\n      "otp": "123456"\n    },\n    "variables": {\n      "header": [],\n      "body": [\n        { "position": 1, "merge_tag": "otp", "value": "123456" }\n      ],\n      "url": []\n    }\n  },\n  "to": [\n    {\n      "phone_number": "{{recipient_phone}}",\n      "name": "Vishal",\n      "dynamic_recipient_data": {\n        "first_name": "Vishal"\n      }\n    }\n  ],\n  "metadata": {\n    "source": "postman-auth"\n  }\n}'},url:{raw:"{{base_url}}/api/v1/whatsapp/send",host:["{{base_url}}"],path:["api","v1","whatsapp","send"]}},response:[]},{name:"Template - Marketing with Header/Body/URL Dynamic Data",request:{method:"POST",header:[{key:"Authorization",value:"Bearer {{api_key}}",type:"text"},{key:"Content-Type",value:"application/json",type:"text"}],body:{mode:"raw",raw:'{\n  "message_type": "template",\n  "campaign_id": "{{campaign_id}}",\n  "service_id": {{service_id}},\n  "idempotency_key": "mkt-0007",\n  "template": {\n    "template_id": {{template_marketing_id}},\n    "language": "en",\n    "dynamic_template_data": {\n      "first_name": "Vishal",\n      "coupon_code": "SUMMER25",\n      "discount_pct": "25",\n      "cta_token": "token-global-001"\n    },\n    "variables": {\n      "header": [\n        { "position": 1, "merge_tag": "first_name", "value": "Vishal" }\n      ],\n      "body": [\n        { "position": 1, "merge_tag": "coupon_code", "value": "SUMMER25" },\n        { "position": 2, "merge_tag": "discount_pct", "value": "25" }\n      ],\n      "url": [\n        { "position": 1, "merge_tag": "cta_token", "value": "token-global-001" }\n      ]\n    }\n  },\n  "to": [\n    {\n      "phone_number": "{{recipient_phone}}",\n      "name": "Vishal",\n      "dynamic_recipient_data": {\n        "first_name": "Vishal"\n      }\n    },\n    {\n      "phone_number": "+919800000002",\n      "name": "Aditi",\n      "dynamic_recipient_data": {\n        "first_name": "Aditi",\n        "cta_token": "token-aditi-002"\n      }\n    }\n  ],\n  "metadata": {\n    "source": "postman-marketing"\n  }\n}'},url:{raw:"{{base_url}}/api/v1/whatsapp/send",host:["{{base_url}}"],path:["api","v1","whatsapp","send"]}},response:[]},{name:"Text Message",request:{method:"POST",header:[{key:"Authorization",value:"Bearer {{api_key}}",type:"text"},{key:"Content-Type",value:"application/json",type:"text"}],body:{mode:"raw",raw:'{\n  "message_type": "text",\n  "service_id": {{service_id}},\n  "text": {\n    "body": "Hello from CampaignHQ",\n    "preview_url": false\n  },\n  "to": [\n    {\n      "phone_number": "{{recipient_phone}}",\n      "name": "Vishal"\n    }\n  ],\n  "metadata": {\n    "source": "postman-text"\n  }\n}'},url:{raw:"{{base_url}}/api/v1/whatsapp/send",host:["{{base_url}}"],path:["api","v1","whatsapp","send"]}},response:[]},{name:"Interactive Message",request:{method:"POST",header:[{key:"Authorization",value:"Bearer {{api_key}}",type:"text"},{key:"Content-Type",value:"application/json",type:"text"}],body:{mode:"raw",raw:'{\n  "message_type": "interactive",\n  "service_id": {{service_id}},\n  "interactive": {\n    "type": "button",\n    "body": {\n      "text": "Please confirm"\n    },\n    "action": {\n      "buttons": [\n        {\n          "type": "reply",\n          "reply": {\n            "id": "yes",\n            "title": "Yes"\n          }\n        },\n        {\n          "type": "reply",\n          "reply": {\n            "id": "no",\n            "title": "No"\n          }\n        }\n      ]\n    }\n  },\n  "to": [\n    {\n      "phone_number": "{{recipient_phone}}"\n    }\n  ],\n  "metadata": {\n    "source": "postman-interactive"\n  }\n}'},url:{raw:"{{base_url}}/api/v1/whatsapp/send",host:["{{base_url}}"],path:["api","v1","whatsapp","send"]}},response:[]}]},g=[{id:"tx-overview",title:"Overview (v1)"},{id:"tx-base-url",title:"Base URL"},{id:"tx-auth",title:"Authentication"},{id:"tx-endpoints",title:"Endpoints"},{id:"tx-access-prerequisites",title:"Account access"},{id:"tx-rate-limits",title:"Rate limits"},{id:"tx-request-body",title:"Request body"},{id:"tx-phone-numbers",title:"Phone numbers"},{id:"tx-success-response",title:"Success response"},{id:"tx-errors",title:"Error responses"},{id:"tx-examples",title:"Examples"},{id:"tx-consumer-versioning",title:"Versioning (v1)"},{id:"tx-related-docs",title:"Related documentation"},{id:"tx-integrator-checklist",title:"Integrator checklist"}],y=[{id:"whatsapp",label:"WhatsApp",href:"/developer/docs/",topic:"whatsapp"},{id:"events",label:"Custom events",href:"/developer/docs/?topic=events",topic:"events"},{id:"email",label:"Email",href:"#",comingSoon:!0},{id:"sms",label:"SMS",href:"#",comingSoon:!0}];function DeveloperDocsPage(){let e=(0,d.useRouter)(),s=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e||function(e){let s=e.match(/[?&]topic=([^&/?#]+)/);return s?decodeURIComponent(s[1]):void 0}(s);return"events"===n?"events":"whatsapp"}(e.query.topic,e.asPath),n="events"===s?h.q:g,[t,a]=(0,c.useState)(n[0].id),[p,v]=(0,c.useState)(!0),[b,f]=(0,c.useState)(!0),[_,w]=(0,c.useState)(!1),[N,k]=(0,c.useState)(u.Bv),A=`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(j,null,2))}`,T=(0,u.yJ)(N);(0,c.useEffect)(()=>{a(n[0].id)},[s]),(0,c.useEffect)(()=>{let e=n.map(e=>
1document.getElementById(e.id)).filter(Boolean),updateActiveSectionOnScroll=()=>{if(!e.length)return;let s=window.scrollY+180,n=e[0].id;for(let i of e)i.offsetTop<=s&&(n=i.id);let i=window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-24;i&&(n=e[e.length-1].id),a(n)},s=new IntersectionObserver(e=>{let s=e.filter(e=>e.isIntersecting).sort((e,s)=>s.intersectionRatio-e.intersectionRatio);s[0]?.target?.id&&a(s[0].target.id)},{rootMargin:"-12% 0px -70% 0px",threshold:[.05,.2,.4,.7]});return e.forEach(e=>s.observe(e)),window.addEventListener("scroll",updateActiveSectionOnScroll,{passive:!0}),window.addEventListener("resize",updateActiveSectionOnScroll),updateActiveSectionOnScroll(),()=>{s.disconnect(),window.removeEventListener("scroll",updateActiveSectionOnScroll),window.removeEventListener("resize",updateActiveSectionOnScroll)}},[s]);let navLinkClass=e=>`block rounded px-2 py-1.5 text-sm transition ${t===e?"bg-indigo-50 font-semibold text-indigo-700":"text-gray-700 hover:bg-gray-50 hover:text-gray-900"}`;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r(),{children:(0,i.jsx)("title",{children:"events"===s?"Custom Events - Developer Docs - CampaignHQ":"Developer Docs - CampaignHQ"})}),(0,i.jsxs)("div",{className:"mx-auto max-w-7xl px-6 py-8 lg:px-10",children:[(0,i.jsxs)("div",{className:"rounded-2xl border border-indigo-100 bg-gradient-to-r from-indigo-50 to-white p-6",children:[(0,i.jsx)("div",{className:"mb-2 inline-flex rounded-full border border-indigo-200 bg-white px-2.5 py-1 text-xs font-semibold text-indigo-700",children:"Developer Docs"}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"text-2xl font-semibold text-gray-900",children:"events"===s?"Custom Events":"WhatsApp Developer Docs"}),(0,i.jsx)("p",{className:"mt-1 text-sm text-gray-700",children:"events"===s?(0,i.jsxs)(i.Fragment,{children:["Track product events, identify users, and start automations (",(0,i.jsx)("strong",{children:"v1"}),")."]}):(0,i.jsxs)(i.Fragment,{children:["Transactional WhatsApp send API (",(0,i.jsx)("strong",{children:"v1"}),", consumer reference)."]})})]}),(0,i.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:"events"===s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("a",{href:"#ev-overview",className:"rounded-md border border-indigo-300 bg-white px-3 py-2 text-sm font-medium text-indigo-700 hover:bg-indigo-50",children:"Event ingest API (v1)"}),(0,i.jsx)(o.CopyToClipboard,{text:T,onCopy:()=>{w(!0),window.setTimeout(()=>w(!1),2e3)},children:(0,i.jsx)("button",{type:"button",className:"rounded-md border border-indigo-300 bg-white px-3 py-2 text-sm font-medium text-indigo-700 hover:bg-indigo-50",children:_?"Copied JS snippet":"Copy JS snippet"})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("a",{href:"#tx-overview",className:"rounded-md border border-indigo-300 bg-white px-3 py-2 text-sm font-medium text-indigo-700 hover:bg-indigo-50",children:"Transactional send API (v1)"}),(0,i.jsx)("a",{href:A,download:"campaignhq-transactional-whatsapp-v1.postman_collection.json",className:"rounded-md border border-indigo-300 bg-white px-3 py-2 text-sm font-medium text-indigo-700 hover:bg-indigo-50",children:"Download Postman collection"})]})})]}),(0,i.jsxs)("div",{className:"mt-6 grid gap-6 lg:grid-cols-12",children:[(0,i.jsx)("aside",{className:"lg:col-span-3",children:(0,i.jsxs)("div",{className:"sticky top-24 space-y-4",children:[(0,i.jsxs)("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[(0,i.jsxs)("button",{type:"button",onClick:()=>v(e=>!e),className:"flex w-full items-center justify-between",children:[(0,i.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-gray-500",children:"Channels"}),(0,i.jsx)("span",{className:"text-xs text-gray-500",children:p?"Hide":"Show"})]}),p?(0,i.jsx)("nav",{className:"mt-3 space-y-1",children:y.map(e=>{let n=e.topic===s;return e.comingSoon?(0,i.jsxs)("a",{href:e.href,onClick:e=>e.preventDefault(),className:"flex items-center justify-between rounded px-2 py-1.5 text-sm text-gray-500",children:[(0,i.jsx)("span",{children:e.label}),(0,i.jsx)("span",{className:"rounded bg-gray-100 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-gray-500",children:"Soon"})]},e.id):(0,i.jsx)(l(),{href:e.href,className:`flex items-center justify-between rounded px-2 py-1.5 text-sm ${n?"bg-indigo-50 font-semibold text-indigo-700":"text-gray-700 hover:bg-gray-50 hover:text-gray-900"}`,children:(0,i.jsx)("span",{children:e.label})},e.id)})}):null]}),(0,i.jsxs)("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[(0,i.jsxs)("button",{type:"button",onClick:()=>f(e=>!e),className:"flex w-full items-center justify-between",children:[(0,i.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-gray-500",children:"events"===s?"Event ingest (v1)":"Transactional send (v1)"}),(0,i.jsx)("span",{className:"text-xs text-gray-500",children:b?"Hide":"Show"})]}),b?(0,i.jsx)("nav",{className:"mt-3 space-y-1",children:n.map(e=>(0,i.jsx)("a",{href:`#${e.id}`,className:navLinkClass(e.id),children:e.title},e.id))}):null]})]})}),(0,i.jsx)("div",{className:"space-y-4 lg:col-span-9",children:"events"===s?(0,i.jsx)(h.Z,{onIngestHostChange:k}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"rounded-xl border border-indigo-100 bg-indigo-50 p-4 text-sm text-indigo-900",children:[(0,i.jsx)("p",{className:"font-semibold",children:"WhatsApp transactional send (v1)"}),(0,i.jsxs)("p",{className:"mt-1",children:["API path prefix ",(0,i.jsx)("code",{children:"/api/v1/…"}),". Request and response JSON fields use ",(0,i.jsx)("strong",{children:"snake_case"}
1)," unless your client reads company-plan settings via a serializer that applies camelCase (e.g. ",(0,i.jsx)("code",{children:"whatsappApi"}),"). Send traffic to"," ",(0,i.jsxs)("strong",{children:["POST ",m.Sg,"/api/v1/whatsapp/send"]}),"."]})]}),(0,i.jsxs)(x.Je,{id:"tx-overview",title:"WhatsApp transactional send API — v1 (consumer reference)",children:[(0,i.jsxs)("p",{children:["For ",(0,i.jsx)("strong",{children:"API consumers"})," (integrations, partners, client apps). This page describes ",(0,i.jsx)("strong",{children:"version 1"})," ","of CampaignHQ’s transactional WhatsApp send endpoint: request and response formats, authentication, limits, and errors."]}),(0,i.jsxs)("p",{children:["Send ",(0,i.jsx)("strong",{children:"transactional"})," WhatsApp messages (template, session text, or interactive payloads) to one or more recipients in a single HTTP request."]}),(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"Synchronous:"})," validation and acceptance or rejection are reflected in the HTTP response."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"Asynchronous:"})," provider delivery, contact and campaign setup, and provider IDs complete"," ",(0,i.jsx)("strong",{children:"after"})," the response."]})]}),(0,i.jsx)("p",{children:"Operational visibility into delivery outcomes beyond this HTTP contract is handled with CampaignHQ separately (not documented here)."})]}),(0,i.jsxs)(x.Je,{id:"tx-base-url",title:"Base URL",children:[(0,i.jsx)("p",{children:"Production API host:"}),(0,i.jsx)("pre",{className:"overflow-auto rounded-lg bg-gray-900 p-4 text-xs leading-6 text-gray-100",children:m.Sg}),(0,i.jsx)("p",{children:"Examples below use this origin. Other environments may use a different host; adjust the scheme and hostname accordingly."})]}),(0,i.jsxs)(x.Je,{id:"tx-auth",title:"Authentication",children:[(0,i.jsx)("div",{className:"overflow-x-auto rounded-lg border border-gray-200",children:(0,i.jsxs)("table",{className:"min-w-full divide-y divide-gray-200 text-sm",children:[(0,i.jsx)("thead",{className:"bg-gray-50",children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{className:"px-3 py-2 text-left font-semibold text-gray-900",children:"Header"}),(0,i.jsx)("th",{className:"px-3 py-2 text-left font-semibold text-gray-900",children:"Value"})]})}),(0,i.jsxs)("tbody",{className:"divide-y divide-gray-100 bg-white",children:[(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{className:"px-3 py-2",children:(0,i.jsx)("code",{children:"Authorization"})}),(0,i.jsx)("td",{className:"px-3 py-2",children:(0,i.jsx)("code",{children:"Bearer <your_api_key_token>"})})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{className:"px-3 py-2",children:(0,i.jsx)("code",{children:"Content-Type"})}),(0,i.jsx)("td",{className:"px-3 py-2",children:(0,i.jsx)("code",{children:"application/json"})})]})]})]})}),(0,i.jsxs)("p",{children:["Missing or invalid credentials return"," ",(0,i.jsx)("code",{children:"401 Unauthorized"})," with a JSON body (see"," ",(0,i.jsx)("a",{href:"#tx-errors",className:"font-medium text-indigo-700 hover:text-indigo-900",children:"Error responses"}),")."]})]}),(0,i.jsxs)(x.Je,{id:"tx-endpoints",title:"Endpoints",children:[(0,i.jsx)(x.GL,{children:"Send messages"}),(0,i.jsx)("pre",{className:"overflow-auto rounded-lg bg-gray-900 p-4 text-xs leading-6 text-gray-100",children:`POST ${m.Sg}/api/v1/whatsapp/send`}),(0,i.jsx)(x.GL,{children:"Supported message types"}),(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsx)("li",{children:(0,i.jsx)("code",{children:"template"})}),(0,i.jsx)("li",{children:(0,i.jsx)("code",{children:"text"})}),(0,i.jsx)("li",{children:(0,i.jsx)("code",{children:"interactive"})})]})]}),(0,i.jsxs)(x.Je,{id:"tx-access-prerequisites",title:"Account access and prerequisites",children:[(0,i.jsx)("p",{children:"Before you send, your account needs all of the following:"}),(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsx)("li",{children:"Transactional WhatsApp API enabled on your account"}),(0,i.jsx)("li",{children:"WhatsApp sending allowed on your account"}),(0,i.jsxs)("li",{children:["A connected WhatsApp channel. The API uses your active connection by default. Pass ",(0,i.jsx)("code",{children:"service_id"})," to use a specific one."]})]}),(0,i.jsxs)("p",{children:["If any of these are missing, the request returns"," ",(0,i.jsx)("code",{children:"422"})," with a message you can act on."]})]}),(0,i.jsxs)(x.Je,{id:"tx-rate-limits",title:"Rate limits and quotas (v1 behaviour)",children:[(0,i.jsxs)("p",{children:["Limits are enforced server-side. Treat numeric defaults below as ",(0,i.jsx)("strong",{children:"implementation defaults"}),"; your tenant may have a ",(0,i.jsx)("strong",{children:"custom"})," RPM configured."]}),(0,i.jsx)(x.GL,{children:"Requests per minute (per account)"}),(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"What c
1ounts:"})," Each ",(0,i.jsx)("code",{children:"POST"})," ","counts as ",(0,i.jsx)("strong",{children:"one"})," request toward your account’s limit, regardless of recipient count in"," ",(0,i.jsx)("code",{children:"to"}),"."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"Window:"})," Per"," ",(0,i.jsx)("strong",{children:"UTC calendar minute"}),"."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"Typical limit:"})," Plan field"," ",(0,i.jsx)("code",{children:"transactional_whatsapp_api_rpm"})," when set (positive integer); else an environment default may apply; if unset, server default ",(0,i.jsx)("strong",{children:"120"})," ","requests/minute per account."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"When exceeded:"})," ",(0,i.jsx)("code",{children:"429 Too Many Requests"}),". Back off and retry (exponential backoff). Response includes a human-readable"," ",(0,i.jsx)("code",{children:"message"}),"."]})]}),(0,i.jsx)(x.GL,{children:"Daily transactional volume (per WhatsApp connection)"}),(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"What counts:"})," Each recipient in"," ",(0,i.jsx)("code",{children:"to"})," counts toward a daily budget for the WhatsApp ",(0,i.jsx)("strong",{children:"service"})," (",(0,i.jsx)("code",{children:"service_id"})," ","or default active service)."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"Window:"})," Per"," ",(0,i.jsx)("strong",{children:"UTC calendar day"}),"."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"Cap:"})," From the integration’s messaging tier / provider limits. If unreadable, a conservative default may apply (for example ",(0,i.jsx)("strong",{children:"250"})," units per day — subject to change; rely on errors in practice)."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"When exceeded:"})," Entire request fails with"," ",(0,i.jsx)("code",{children:"422"}),", e.g."," ",(0,i.jsx)("code",{children:"Daily transactional WhatsApp limit reached for this service (limit: N)"}),". No partial enqueue; reduce batch size or wait until next UTC day."]})]}),(0,i.jsxs)("p",{children:[(0,i.jsx)("strong",{children:"Important:"})," Daily budget aligns with tier/config, not a guaranteed mirror of Meta’s real-time counters. Mixed campaign + API traffic may still hit provider limits."]}),(0,i.jsx)(x.GL,{children:"Throughput after acceptance"}),(0,i.jsxs)("p",{children:["After ",(0,i.jsx)("code",{children:"200 OK"}),", workers apply"," ",(0,i.jsx)("strong",{children:"per-connection throttling"}),". This affects how fast messages leave the queue, not HTTP acceptance."]}),(0,i.jsx)(x.GL,{children:"Recipients per request"}),(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"Maximum:"})," ",(0,i.jsx)("strong",{children:"100"})," in"," ",(0,i.jsx)("code",{children:"to"}),"."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"Minimum:"})," ",(0,i.jsx)("strong",{children:"1"}),"."]})]})]}),(0,i.jsxs)(x.Je,{id:"tx-request-body",title:"Request body",children:[(0,i.jsx)(x.GL,{children:"Root fields"}),(0,i.jsxs)("ul",{className:"list-disc space-y-2 pl-6",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"message_type"})," (string, required):"," ",(0,i.jsx)("code",{children:"template"}),", ",(0,i.jsx)("code",{children:"text"}),", or"," ",(0,i.jsx)("code",{children:"interactive"}),"."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"to"})," (array, required): recipients (recipient object below). Max ",(0,i.jsx)("strong",{children:"100"}),"."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"campaign_id"})," (UUID string, optional): transactional WhatsApp campaign id."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"transactional_campaign_id"})," (string, optional): alias for ",(0,i.jsx)("code",{children:"campaign_id"}),"."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"service_id"})," (string, optional): WhatsApp message service id; omit for default active service for the API user."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"idempotency_key"})," (string, optional): correlation only — does ",(0,i.jsx)("strong",{children:"not"})," guarantee HTTP-layer dedupe by itself."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"metadata"})," (object, optional): arbitrary JSON-serializable map stored with the send."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"template"}),", ",(0,i.jsx)("code",{children:"text"}),","," ",(0,i.jsx)("code",{children:"interactive"})," (objects, conditional): required shape per ",(0,i.jsx)("code",{children:"message_type"}),"."]})]}),(0,i.jsxs)(x.GL,{children:["Recipient object (",(0,i.jsx)("code",{children:"to[]"}),")"]}),(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"phone_number"})," (string, required): E.164 recommended; server may normalize (see Phone numbers)."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"name"})," (string, optional): display hints for contact creation."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"dynamic_recipient_data"})," (object, optional): merged into contact/template context where applicable."]})]}),(0,i.jsx)(x.GL,{children:(0,i.jsx)("code",{children:"message_type: template"})}),(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"template.template_id"})," (required): CampaignHQ WhatsApp template id."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"template.language"})," (optional): language hint when applicable."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"template.dynamic_template_data"})," (optional): template variables (e.g. OTP)."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"template.variables.header"}),","," ",(0,i.jsx)("code",{children:"template.variables.body"}),", and"," ",(0,i.jsx)("code",{children:"template.variables.url"})," (all required arrays): use empty arrays when a section has no placeholders."]})]}),(0,i.jsx)(x.GL,{children:"Template variable object"}),(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"position"})," (number, required): starts at"," ",(0,i.jsx)("code",{children:"1"}),"."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"merge_tag"})," (string, required)."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"value"})," (string, optional but recommended)."]})]}),(0,i.jsx)(x.GL,{children:"Template variable value sources"}),(0,i.jsxs)("ol",{className:"list-decimal space-y-1 pl-6",children:[(0,i.jsx)("li",{children:(0,i.jsx)("code",{children:"variables[].value"})}),(0,i.jsx)("li",{children:(0,i.jsx)("code",{children:"template.dynamic_template_data"})}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"to[].dynamic_recipient_data"})," (recipient override)"]})]}),(0,i.jsxs)("p",{children:["Template must be ",(0,i.jsx)("strong",{children:"approved"}),". Invalid or unapproved → ",(0,i.jsx)("code",{children:"422"}),"."]}),(0,i.jsx)(x.GL,{children:(0,i.jsx)("code",{children:"message_type: text"})}),(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"text.body"})," (required): non-empty after trim."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"text.preview_url"})," (optional boolean): preview URL behaviour for session messages."]})]}),(0,i.jsx)("p",{children:"Session/country/billing rules apply in workers;
1 failures may surface asynchronously."}),(0,i.jsx)(x.GL,{children:(0,i.jsx)("code",{children:"message_type: interactive"})}),(0,i.jsxs)("p",{children:[(0,i.jsx)("code",{children:"interactive"})," (object, required): non-empty JSON; structure validated by the WhatsApp provider."]})]}),(0,i.jsxs)(x.Je,{id:"tx-phone-numbers",title:"Phone numbers",children:[(0,i.jsxs)("p",{children:["Server normalizes where possible (default country code for 10-digit numbers, leading ",(0,i.jsx)("code",{children:"+"}),"). Prefer"," ",(0,i.jsx)("strong",{children:"E.164"})," (",(0,i.jsx)("code",{children:"+countrycode…"}),") in integrations."]}),(0,i.jsxs)("p",{children:["Use ",(0,i.jsx)("code",{children:"phoneNumber"})," in each ",(0,i.jsx)("code",{children:"data[]"})," row as the canonical value for that response."]})]}),(0,i.jsxs)(x.Je,{id:"tx-success-response",title:"Success response",children:[(0,i.jsxs)("p",{children:[(0,i.jsx)("strong",{children:"Status:"})," ",(0,i.jsx)("code",{children:"200 OK"})]}),(0,i.jsx)("pre",{className:"overflow-auto rounded-lg bg-gray-900 p-4 text-xs leading-6 text-gray-100",children:`{
2  "success": true,
3  "data": [
4    {
5      "phoneNumber": "+919876543210",
6      "message_id": "550e8400-e29b-41d4-a716-446655440000",
7      "status": "queued",
8      "reason": null
9    }
10  ]
11}`}),(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"success"}),": always ",(0,i.jsx)("code",{children:"true"})," for HTTP"," ",(0,i.jsx)("code",{children:"200"}),"."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"data"}),": one entry per recipient (best effort, request order)."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"phoneNumber"}),": normalized destination."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"message_id"}),": server-generated UUID for this enqueue; support correlation — not always Meta"," ",(0,i.jsx)("code",{children:"wamid"})," immediately."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"status"}),": ",(0,i.jsx)("code",{children:"queued"})," (accepted into pipeline) or ",(0,i.jsx)("code",{children:"failed"})," (see ",(0,i.jsx)("code",{children:"reason"}),")."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("code",{children:"reason"}),": detail when failed; else"," ",(0,i.jsx)("code",{children:"null"}),"."]})]}),(0,i.jsxs)("p",{children:[(0,i.jsx)("strong",{children:"Partial failure:"})," HTTP may still be"," ",(0,i.jsx)("code",{children:"200"})," with mixed ",(0,i.jsx)("code",{children:"queued"})," /"," ",(0,i.jsx)("code",{children:"failed"})," rows — always inspect"," ",(0,i.jsx)("code",{children:"data[]"}),"."]})]}),(0,i.jsxs)(x.Je,{id:"tx-errors",title:"Error responses",children:[(0,i.jsx)("p",{children:"Common validation and send errors:"}),(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsxs)("li",{children:["Missing or invalid ",(0,i.jsx)("code",{children:"message_type"}),"."]}),(0,i.jsxs)("li",{children:["Missing ",(0,i.jsx)("code",{children:"template.template_id"})," for template sends."]}),(0,i.jsxs)("li",{children:["Missing ",(0,i.jsx)("code",{children:"template.variables.header/body/url"}),"."]}),(0,i.jsx)("li",{children:"Invalid variable positions (non-sequential)."}),(0,i.jsxs)("li",{children:["Missing value for required ",(0,i.jsx)("code",{children:"merge_tag"}),"."]}),(0,i.jsx)("li",{children:"Missing recipient phone number."}),(0,i.jsx)("li",{children:"Template not found or not approved."}),(0,i.jsxs)("li",{children:["Rate limit exceeded (",(0,i.jsx)("code",{children:"429"}),")."]})]})]}),(0,i.jsxs)(x.Je,{id:"tx-examples",title:"Examples",children:[(0,i.jsx)(x.GL,{children:"Template message"}),(0,i.jsx)("pre",{className:"overflow-auto rounded-lg bg-gray-900 p-4 text-xs leading-6 text-gray-100",children:`{
12  "message_type": "template",
13  "service_id": 715,
14  "idempotency_key": "optional-idempotency-key",
15  "template": {
16    "template_id": 123,
17    "language": "en",
18    "dynamic_template_data": {
19      "otp": "123456"
20    },
21    "variables": {
22      "header": [
23        { "position": 1, "merge_tag": "first_name", "value": "Vishal" }
24      ],
25      "body": [
26        { "position": 1, "merge_tag": "otp", "value": "123456" }
27      ],
28      "url": [
29        { "position": 1, "merge_tag": "token", "value": "abc123" }
30      ]
31    }
32  },
33  "to": [
34    {
35      "phone_number": "+919632641012",
36      "name": "Vishal",
37      "dynamic_recipient_data": {
38        "first_name": "Vishal"
39      }
40    }
41  ],
42  "metadata": {
43    "source": "frontend"
44  }
45}`}),(0,i.jsx)(x.GL,{children:"Text message"}),(0,i.jsx)("pre",{className:"overflow-auto rounded-lg bg-gray-900 p-4 text-xs leading-6 text-gray-100",children:`{
46  "message_type": "text",
47  "service_id": 715,
48  "text": {
49    "body": "Hello from CampaignHQ",
50    "preview_url": false
51  },
52  "to": [
53    { "phone_number": "+919632641012", "name": "Vishal" }
54  ],
55  "metadata": {
56    "source": "frontend"
57  }
58}`}),(0,i.jsx)(x.GL,{children:"Interactive message"}),(0,i.jsx)("pre",{className:"overflow-auto rounded-lg bg-gray-900 p-4 text-xs leading-6 text-gray-100",children:`{
59  "message_type": "interactive",
60  "service_id": 715,
61  "interactive": {
62    "type": "button",
63    "body": { "text": "Please confirm" },
64    "action": {
65      "buttons": [
66        { "type": "reply", "reply": { "id": "yes", "title": "Yes" } }
67      ]
68    }
69  },
70  "to": [
71    { "phone_number": "+919632641012" }
72  ],
73  "metadata": {
74    "source": "frontend"
75  }
76}`})]}),(0,i.jsx)(x.Je,{id:"tx-consumer-versioning",title:"Versioning and compatibility (v1)",children:(0,i.jsxs)("ul",{className:"list-disc space-y-1 pl-6",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:"v1"})," — first published consumer contract for ",(0,i.jsx)("code",{children:"POST /api/v1/whatsapp/send"}),"."]}),(0,i.jsxs)("li",{children:["Breaking changes would use a new URL prefix (e.g."," ",(0,i.jsx)("code",{children:"/api/v2/…"}),") or a negotiated version header if introduced."]}),(0,i.jsx)("li",{children:"Additive JSON fields may appear — ignore unknown keys."})]})}),(0,i.jsx)(x.Je,{id:"tx-related-docs",title:"Related documentation",children:(0,i.jsx)("ul",{className:"list-disc space-y-1 pl-6",children:(0,i.jsx)("li",{children:"Repo or partner docs may include FE_WHATSAPP_TRANSACTIONAL_SEND_API.md and WHATSAPP_UNIFIED_SENDING_API.md for deeper technical context."})})}),(0,i.jsxs)(x.Je,{id:"tx-integrator-checklist",title:"Support checklist for integrators",children:[(0,i.jsx)("p",{children:"Before going live:"}),(0,i.jsxs)("ol",{className:"list-decimal space-y-1 pl-6",children:[(0,i.jsxs)("li",{children:["Always send all three template variable groups (",(0,i.jsx)("code",{children:"header"}),", ",(0,i.jsx)("code",{children:"body"}),", ",(0,i.jsx)("code",{children:"url"}),") and use ",(0,i.jsx)("code",{children:"[]"})," when empty."]}),(0,i.jsxs)("li",{children:["Keep variable ",(0,i.jsx)("code",{children:"position"})," values sequential starting from ",(0,i.jsx)("code",{children:"1"}),"."]}),(0,i.jsxs)("li",{children:["Prefer setting ",(0,i.jsx)("code",{children:"variables[].value"})," explicitly."]}),(0,i.jsxs)("li",{children:["Use ",(0,i.jsx)("code",{children:"dynamic_recipient_data"})," for recipient-specific values in batch sends."]}),(0,i.jsxs)("li",{children:["Implement ",(0,i.jsx)("code",{children:"429"})," retry with exponential backoff."]}),(0,i.jsx)("li",{children:"Surface API error messages directly in developer/debug mode for faster diagnosis."})]})]})]})})]})]})]})}DeveloperDocsPage.Layout=p.R}},function(e){e.O(0,[9921,5675,2814,7536,7811,3355,3410,1796,3263,9980,9774,2888,179],function(){return e(e.s=33714)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.