{"info":{"_postman_id":"7adb3bb7-7dac-4214-a8dc-005e6dc82c15","name":"baat.ai - WhatsApp Template","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"description":"<html><head></head><body></body></html>","owner":"44300938","collectionId":"7adb3bb7-7dac-4214-a8dc-005e6dc82c15","publishedId":"2sB2iwGFCk","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2025-04-22T06:48:24.000Z"},"item":[{"name":"Send WhatsApp Template Message","id":"6b02b841-2d8f-40a8-9925-c98b6945913f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"url":"https://apis.baat.ai/v1/whatsapp/messages","description":"<p>This endpoint enables you to send a WhatsApp template message <strong>through baat.ai</strong>, which internally connects to the Meta Cloud API.</p>\n<h2 id=\"request-header-parameters\">Request Header Parameters</h2>\n<ul>\n<li><code>X-API-KEY</code> (string): Required header used for authenticating API access. You must include a valid API key for baat.ai.</li>\n</ul>\n<h2 id=\"request-body-parameters\">Request Body Parameters</h2>\n<ul>\n<li><p><code>phone_number</code> (string): The phone number of the recipient. It should have the country code like '91' for India, followed by the mobile number (10-digit number for Indian mobile numbers).</p>\n</li>\n<li><p><code>contact_name</code> (string): The contact name of the recipient.</p>\n</li>\n<li><p><code>message</code> (object): The message content including body, header, footer, button, language code, and template name.</p>\n<ul>\n<li><p><code>body_params</code> (array of strings): An array of strings used to populate the placeholders in the template body (e.g., <code>{{1}}</code>, <code>{{2}}</code>).</p>\n</li>\n<li><p><code>header_params</code> (array of strings): An array of strings used for header content. This may include text (e.g., codes), or media URLs for image, video, or document headers.</p>\n</li>\n<li><p><code>button_params</code> (array of strings): An array of strings containing dynamic values used in button URLs or call actions.</p>\n</li>\n<li><p><code>language_code</code> (string): The language code for the message, such as <code>en</code>, <code>hi</code>, or <code>en_US</code>.</p>\n</li>\n<li><p><code>template_name</code> (string): The name of the approved WhatsApp template to be sent.</p>\n</li>\n</ul>\n</li>\n<li><p><code>template_id</code> (string): The ID of the template, mapped internally to baat.ai’s cache and Meta’s registry.</p>\n</li>\n<li><p><code>channel_id</code> (number): The ID of the <strong>channel configured within baat.ai</strong>. Each baat.ai account can have multiple WhatsApp numbers (WABA phone numbers) associated with it, each represented as a distinct <strong>channel</strong>. This ID determines which WhatsApp number (sender) the message will be sent from. Note: <code>channel_id</code> is not the Meta WABA ID. It is baat.ai’s internal representation for different communication channels (e.g., multiple WhatsApp senders, Email, SMS, etc.).</p>\n</li>\n<li><p><code>source</code> (string): The source of the message, e.g., the name of the application or platform.</p>\n</li>\n</ul>\n<h3 id=\"header_params-array-of-strings\"><code>header_params</code> (array of strings)</h3>\n<p>The <code>header_params</code> array is used to provide additional context at the top of the template message. Depending on the template configuration in Meta:</p>\n<ul>\n<li><p>If the header type is <strong>text</strong>, a single value like <code>\"Your OTP is 123456\"</code> should be passed.</p>\n</li>\n<li><p>If the header type is <strong>image</strong>, <strong>video</strong>, or <strong>document</strong>, provide a publicly accessible URL or a media ID. For example: <code>\"https://example.com/banner.jpg\"</code>.</p>\n</li>\n</ul>\n<h3 id=\"button_params-array-of-strings\"><code>button_params</code> (array of strings)</h3>\n<p>The <code>button_params</code> array is used to populate dynamic values in template buttons. Supported button types include:</p>\n<ul>\n<li><p><strong>URL Buttons</strong>: Accept dynamic URLs like <code>\"https://example.com/offer/{{1}}\"</code>.</p>\n</li>\n<li><p><strong>Call Buttons</strong>: Accept phone numbers such as <code>\"+919999999999\"</code>.</p>\n</li>\n<li><p><strong>Quick Replies</strong>: No dynamic values required.</p>\n</li>\n</ul>\n<h2 id=\"response\">Response</h2>\n<p>The response will contain the status of the message sending process.</p>\n<h2 id=\"error-responses\">Error Responses</h2>\n<ul>\n<li><p><code>400 Bad Request</code>: The request was invalid or cannot be served. The possible cause could be missing or incorrect parameters in the request payload.</p>\n</li>\n<li><p><code>401 Unauthorized</code>: The request lacks valid authentication credentials. Ensure that the <code>X-API-KEY</code> is included and correct.</p>\n</li>\n<li><p><code>5xx Server Error</code>: Indicates that the server failed to fulfill a valid request. This could be due to server-side issues.</p>\n</li>\n</ul>\n","urlObject":{"protocol":"https","path":["v1","whatsapp","messages"],"host":["apis","baat","ai"],"query":[],"variable":[]}},"response":[{"id":"22307127-4548-49ed-ae1a-5b9551cb8161","name":"Send WhatsApp Template Message","originalRequest":{"method":"POST","header":[{"key":"X-API-KEY","value":"<your-api-key>","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"phone_number\": \"91XXXXXXXXXX\",\n  \"contact_name\": \"<contact-name>\",\n  \"message\": {\n    \"body_params\": [\"<body-param-1>\", \"<body-param-2>\"],\n    \"header_params\": [\"<header-param-1>\"],\n    \"button_params\": [\"<button-param-1>\"],\n    \"language_code\": \"<template-language-code>\",\n    \"template_name\": \"<name-of-the-template>\"\n  },\n  \"template_id\": \"<template-id-provided-by-the-meta>\",\n  \"channel_id\": 0,\n  \"source\": \"<source-of-the-message>\"\n}","options":{"raw":{"language":"json"}}},"url":"https://apis.baat.ai/v1/whatsapp/messages"},"status":"Accepted","code":202,"_postman_previewlanguage":"json","header":[],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message_id\": \"7leyrX9mNyBYnns9BJGj\",\n    \"status\": \"queued\"\n}"}],"_postman_id":"6b02b841-2d8f-40a8-9925-c98b6945913f"},{"name":"Send WhatsApp Template","id":"adac1a69-f51d-468c-89f2-22a3dad8b7bf","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"phone_number\": \"91XXXXXXXXXX\",\n    \"contact_name\": \"<contact-name>\",\n    \"message\": {\n        \"template_name\": \"<name-of-the-template>\",\n        \"language_code\": \"<template-language-code>\",\n        \"body_params_by_name\": {\n            \"customer_name\": \"<value>\",\n            \"order_id\": \"<value>\"\n        },\n        \"header_params_by_name\": {\n            \"invoice_image\": \"https://example.com/invoices/42.png\"\n        },\n        \"button_params_by_name\": {\n            \"tracking_id\": \"<value>\"\n        }\n    },\n    \"template_id\": \"<template-id-provided-by-the-meta>\",\n    \"channel_id\": 0,\n    \"source\": \"<source-of-the-message>\"\n}","options":{"raw":{"language":"json"}}},"url":"https://apis.baat.ai/v1/whatsapp/messages","description":"<p>Here's a description you can paste into the request's Description field (just under the request name at the top):</p>\n<p>Send a WhatsApp template message to a contact through a configured WAC_API channel.</p>\n<p>Supports both classic positional templates (<code>{{1}}</code>, <code>{{2}}</code>) and named-parameter templates (<code>{{customer_name}}</code>). The caller picks the shape — the server does not convert between them.</p>\n<h2 id=\"authentication\">Authentication</h2>\n<p>Pass your API key in the <code>X-API-KEY</code> header. Keys are scoped to an organization and channel.</p>\n<h2 id=\"request-body\">Request body</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>phone_number</code></td>\n<td>string</td>\n<td>yes</td>\n<td>Recipient mobile number without country code.</td>\n</tr>\n<tr>\n<td><code>contact_name</code></td>\n<td>string</td>\n<td>yes</td>\n<td>Contact display name. Used if the contact is created on first send.</td>\n</tr>\n<tr>\n<td><code>template_id</code></td>\n<td>string</td>\n<td>yes</td>\n<td>Template name as registered with Meta.</td>\n</tr>\n<tr>\n<td><code>channel_id</code></td>\n<td>number</td>\n<td>yes</td>\n<td>Baat channel id to send from.</td>\n</tr>\n<tr>\n<td><code>message.language_code</code></td>\n<td>string</td>\n<td>yes</td>\n<td>Template language, e.g. <code>en</code>, <code>en_US</code>.</td>\n</tr>\n<tr>\n<td><code>message.template_name</code></td>\n<td>string</td>\n<td>yes</td>\n<td>Must match <code>template_id</code>.</td>\n</tr>\n<tr>\n<td><code>message.body_params</code></td>\n<td>string[]</td>\n<td>no</td>\n<td>Classic positional body values, in order.</td>\n</tr>\n<tr>\n<td><code>message.header_params</code></td>\n<td>string[]</td>\n<td>no</td>\n<td>Classic positional header values.</td>\n</tr>\n<tr>\n<td><code>message.button_params_by_index</code></td>\n<td>object</td>\n<td>no</td>\n<td><code>{ \"\": \"\" }</code> for URL button placeholders in classic templates.</td>\n</tr>\n<tr>\n<td><code>message.body_params_by_name</code></td>\n<td>object</td>\n<td>no</td>\n<td><code>{ \"\": \"\" }</code> for named-template body placeholders.</td>\n</tr>\n<tr>\n<td><code>message.header_params_by_name</code></td>\n<td>object</td>\n<td>no</td>\n<td>Same shape, for named-template header placeholders.</td>\n</tr>\n<tr>\n<td><code>message.button_params_by_name</code></td>\n<td>object</td>\n<td>no</td>\n<td>Same shape, for named-template URL button placeholders. The server resolves the button index by matching the placeholder against the cached template.</td>\n</tr>\n</tbody>\n</table>\n</div><p>Use <strong>either</strong> the positional fields <strong>or</strong> the <code>\\*_by_name</code> fields per component, matching how the template was created. Sending a named param whose name doesn't appear in the template returns <code>400</code>.</p>\n<h2 id=\"response\">Response</h2>\n<p><code>200 OK</code> with the created message record on success. <code>400</code> for validation or unknown-parameter errors. <code>401</code> for missing/invalid API key.</p>\n","urlObject":{"protocol":"https","path":["v1","whatsapp","messages"],"host":["apis","baat","ai"],"query":[],"variable":[]}},"response":[{"id":"091b1349-25b7-47e4-935e-beda8ea564ec","name":"Send WhatsApp Template","originalRequest":{"method":"POST","header":[{"key":"X-API-KEY","value":"<your-api-key>","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"phone_number\": \"91XXXXXXXXXX\",\n    \"contact_name\": \"<contact-name>\",\n    \"message\": {\n        \"template_name\": \"<name-of-the-template>\",\n        \"language_code\": \"<template-language-code>\",\n        \"body_params_by_name\": {\n            \"customer_name\": \"<value>\",\n            \"order_id\": \"<value>\"\n        },\n        \"header_params_by_name\": {\n            \"invoice_image\": \"https://example.com/invoices/42.png\"\n        },\n        \"button_params_by_name\": {\n            \"tracking_id\": \"<value>\"\n        }\n    },\n    \"template_id\": \"<template-id-provided-by-the-meta>\",\n    \"channel_id\": 0,\n    \"source\": \"<source-of-the-message>\"\n}","options":{"raw":{"language":"json"}}},"url":"https://apis.baat.ai/v1/whatsapp/messages"},"status":"Accepted","code":202,"_postman_previewlanguage":"","header":[{"key":"Server","value":"nginx/1.18.0 (Ubuntu)"},{"key":"Date","value":"Wed, 15 Apr 2026 16:49:27 GMT"},{"key":"Content-Length","value":"0"},{"key":"Connection","value":"keep-alive"},{"key":"Vary","value":"Origin"},{"key":"Vary","value":"Access-Control-Request-Method"},{"key":"Vary","value":"Access-Control-Request-Headers"},{"key":"Set-Cookie","value":"JSESSIONID=28915D2310921F92AD58CE696DB8C266; Path=/; HttpOnly"},{"key":"WWW-Authenticate","value":"Bearer"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"X-XSS-Protection","value":"0"},{"key":"Cache-Control","value":"no-cache, no-store, max-age=0, must-revalidate"},{"key":"Pragma","value":"no-cache"},{"key":"Expires","value":"0"},{"key":"X-Frame-Options","value":"DENY"},{"key":"X-Kong-Upstream-Latency","value":"26"},{"key":"X-Kong-Proxy-Latency","value":"0"},{"key":"Via","value":"kong/3.5.0"},{"key":"X-Kong-Request-Id","value":"c96a3e57cc3465079feafe3d07fbaf6d"}],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message_id\": \"6612a7e4f1a2b8c9d0e12345\",\n    \"status\": \"queued\"\n  }"},{"id":"9c4d1423-cf09-48a7-99ba-77168b791d04","name":"Send WhatsApp Template","originalRequest":{"method":"POST","header":[{"key":"X-API-KEY","value":"<your-api-key>","type":"text","disabled":true},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"phone_number\": \"91XXXXXXXXXX\",\n    \"contact_name\": \"<contact-name>\",\n    \"message\": {\n        \"template_name\": \"<name-of-the-template>\",\n        \"language_code\": \"<template-language-code>\",\n        \"body_params_by_name\": {\n            \"customer_name\": \"<value>\",\n            \"order_id\": \"<value>\"\n        },\n        \"header_params_by_name\": {\n            \"invoice_image\": \"https://example.com/invoices/42.png\"\n        },\n        \"button_params_by_name\": {\n            \"tracking_id\": \"<value>\"\n        }\n    },\n    \"template_id\": \"<template-id-provided-by-the-meta>\",\n    \"channel_id\": 0,\n    \"source\": \"<source-of-the-message>\"\n}","options":{"raw":{"language":"json"}}},"url":"https://apis.baat.ai/v1/whatsapp/messages"},"status":"Bad Request","code":400,"_postman_previewlanguage":"","header":[],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{\n    \"success\": false,\n    \"status\": \"Named button parameter 'no_such_param' does not match any URL button placeholder in template 'order_named'\"\n  }"},{"id":"f2c329f8-ec78-45eb-8258-caf3f30062d4","name":"Send WhatsApp Template","originalRequest":{"method":"POST","header":[{"key":"X-API-KEY","value":"<your-api-key>","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"phone_number\": \"91XXXXXXXXXX\",\n    \"contact_name\": \"<contact-name>\",\n    \"message\": {\n        \"template_name\": \"<name-of-the-template>\",\n        \"language_code\": \"<template-language-code>\",\n        \"body_params_by_name\": {\n            \"customer_name\": \"<value>\",\n            \"order_id\": \"<value>\"\n        },\n        \"header_params_by_name\": {\n            \"invoice_image\": \"https://example.com/invoices/42.png\"\n        },\n        \"button_params_by_name\": {\n            \"tracking_id\": \"<value>\"\n        }\n    },\n    \"template_id\": \"<template-id-provided-by-the-meta>\",\n    \"channel_id\": 0,\n    \"source\": \"<source-of-the-message>\"\n}","options":{"raw":{"language":"json"}}},"url":"https://apis.baat.ai/v1/whatsapp/messages"},"status":"Unauthorized","code":401,"_postman_previewlanguage":"","header":[],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{\n    \"success\": false,\n    \"status\": \"unauthorized\"\n  }"},{"id":"59aeaa1f-60b7-49a2-8cf0-04f5f5e5d76c","name":"Send WhatsApp Template","originalRequest":{"method":"POST","header":[{"key":"X-API-KEY","value":"<your-api-key>","type":"text","disabled":true},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"phone_number\": \"91XXXXXXXXXX\",\n    \"contact_name\": \"<contact-name>\",\n    \"message\": {\n        \"template_name\": \"<name-of-the-template>\",\n        \"language_code\": \"<template-language-code>\",\n        \"body_params_by_name\": {\n            \"customer_name\": \"<value>\",\n            \"order_id\": \"<value>\"\n        },\n        \"header_params_by_name\": {\n            \"invoice_image\": \"https://example.com/invoices/42.png\"\n        },\n        \"button_params_by_name\": {\n            \"tracking_id\": \"<value>\"\n        }\n    },\n    \"template_id\": \"<template-id-provided-by-the-meta>\",\n    \"channel_id\": 0,\n    \"source\": \"<source-of-the-message>\"\n}","options":{"raw":{"language":"json"}}},"url":"https://apis.baat.ai/v1/whatsapp/messages"},"status":"Internal Server Error","code":500,"_postman_previewlanguage":"","header":[],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{\n    \"success\": false,\n    \"status\": \"internal_server_error\"\n  }"},{"id":"3e8b4233-6d55-4873-9296-6458575d659a","name":"Send WhatsApp Template","originalRequest":{"method":"POST","header":[{"key":"X-API-KEY","value":"<your-api-key>","type":"text","disabled":true},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"phone_number\": \"91XXXXXXXXXX\",\n  \"contact_name\": \"<contact-name>\",\n  \"message\": {\n    \"body_params\": [\"<body-param-1>\", \"<body-param-2>\"],\n    \"header_params\": [\"<header-param-1>\"],\n    \"button_params\": [\"<button-param-1>\"],\n    \"language_code\": \"<template-language-code>\",\n    \"template_name\": \"<name-of-the-template>\"\n  },\n  \"template_id\": \"<template-id-provided-by-the-meta>\",\n  \"channel_id\": 0,\n  \"source\": \"<source-of-the-message>\"\n}","options":{"raw":{"language":"json"}}},"url":"https://apis.baat.ai/v1/whatsapp/messages"},"status":"Accepted","code":202,"_postman_previewlanguage":"","header":[],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message_id\": \"6612a7e4f1a2b8c9d0e12345\",\n    \"status\": \"queued\"\n  }"},{"id":"3dff8b1b-50be-4e6f-aacc-1c027b468bb9","name":"Send WhatsApp Template","originalRequest":{"method":"POST","header":[{"key":"X-API-KEY","value":"<your-api-key>","type":"text","disabled":true},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"phone_number\": \"91XXXXXXXXXX\",\n  \"contact_name\": \"<contact-name>\",\n  \"message\": {\n    \"body_params\": [\"<body-param-1>\", \"<body-param-2>\"],\n    \"header_params\": [\"<header-param-1>\"],\n    \"button_params\": [\"<button-param-1>\"],\n    \"language_code\": \"<template-language-code>\",\n    \"template_name\": \"<name-of-the-template>\"\n  },\n  \"template_id\": \"<template-id-provided-by-the-meta>\",\n  \"channel_id\": 0,\n  \"source\": \"<source-of-the-message>\"\n}","options":{"raw":{"language":"json"}}},"url":"https://apis.baat.ai/v1/whatsapp/messages"},"status":"Bad Request","code":400,"_postman_previewlanguage":"","header":[],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{\n    \"success\": false,\n    \"status\": \"Body parameter count mismatch for template 'order_created'\"\n  }"},{"id":"06aad061-86f0-48a1-ba52-ad5cbb3154e3","name":"Send WhatsApp Template","originalRequest":{"method":"POST","header":[{"key":"X-API-KEY","value":"<your-api-key>","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"phone_number\": \"91XXXXXXXXXX\",\n  \"contact_name\": \"<contact-name>\",\n  \"message\": {\n    \"body_params\": [\"<body-param-1>\", \"<body-param-2>\"],\n    \"header_params\": [\"<header-param-1>\"],\n    \"button_params\": [\"<button-param-1>\"],\n    \"language_code\": \"<template-language-code>\",\n    \"template_name\": \"<name-of-the-template>\"\n  },\n  \"template_id\": \"<template-id-provided-by-the-meta>\",\n  \"channel_id\": 0,\n  \"source\": \"<source-of-the-message>\"\n}","options":{"raw":{"language":"json"}}},"url":"https://apis.baat.ai/v1/whatsapp/messages"},"status":"Unauthorized","code":401,"_postman_previewlanguage":"","header":[],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{ \"success\": false, \"status\": \"unauthorized\" }"}],"_postman_id":"adac1a69-f51d-468c-89f2-22a3dad8b7bf"}]}