Send a template

이 페이지는 아직 한국어 언어로 제공되지 않습니다. 기본 언어(English)로 표시합니다.

Send a template

POSThttps://api.cekat.ai/templates/send

Sends an approved WhatsApp template to one phone number. Cekat creates the contact and conversation if they don’t exist yet.

Check success in the body, not only the HTTP status. If Meta rejects the message (for example, an invalid number or insufficient balance), the endpoint still returns HTTP 200, with success: false, status_code: 400, data.status: failed, and the reason in data.error.

Authorization

api_keystringheaderrequired

Your Cekat API key, from Settings → Developers & API in the Cekat dashboard.

Body application/jsonrequired

wa_template_idstringrequired

The template's wa_template_id. The template must be APPROVED.

inbox_idstring<uuid>required

The WhatsApp inbox that owns the template and sends the message.

phone_numberstringrequired

Recipient's number, digits only with country code.

phone_namestring

Contact name to save if the contact is new. Defaults to the phone number.

template_body_variablesstring[]

One value per body variable, in order ({{1}}, {{2}}, ...). The count must match the template. Send [] for templates without variables.

otp_codestring

One-time code, for AUTHENTICATION templates only.

max length: 15
file_urlstring<uri>

Header media URL to use instead of the template's default, for templates with a media header.

assign_agent_idstring<uuid>

Optional agent ID. The conversation is assigned to this agent after sending.

Response

200
400
401
404
429

The message was processed. Check success to see whether it was sent.

successboolean

False when Meta rejected the message.

status_codeinteger

200 when sent, 400 when the message failed.

dataSentMessage
Show child attributes
idstring<uuid>

Message ID.

messagestring

The text that was sent, with variables filled in.

conversation_idstring<uuid>
statusstring
Available options: sent, failed
errorstring | null

Why the message failed, when status is failed.

platform_midstring | null

WhatsApp message ID returned by Meta.

media_typestring
media_urlstring | null
is_templateboolean
template_idstring

The template's wa_template_id.

template_categorystring
sent_bystring

ID of the agent the message is sent as.

sent_by_namestring
sent_by_typestring
additional_dataobject | null

Billing details for the message.

business_idstring<uuid>

A required field is missing, the template is not approved, the variable count does not match, or the message contains a blocked phrase.

successboolean
status_codeinteger
errorobject
Show child attributes
messagestring

The API key is missing or invalid.

successboolean
status_codeinteger
errorobject
Show child attributes
messagestring

The inbox or template was not found.

successboolean
status_codeinteger
errorobject
Show child attributes
messagestring

Rate limit exceeded. Wait and retry.

messagestring
POST/templates/send
cURL
JavaScript
Python
PHP
curl --request POST \
  --url 'https://api.cekat.ai/templates/send' \
  --header 'api_key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "wa_template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "inbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "phone_number": "6281234567890"
}'
const response = await fetch('https://api.cekat.ai/templates/send', {
  method: 'POST',
  headers: { 'api_key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "wa_template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "inbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "phone_number": "6281234567890"
  })
});

const data = await response.json();
console.log(data);
import requests

url = "https://api.cekat.ai/templates/send"
headers = {"api_key": "YOUR_API_KEY"}
payload = {
    "wa_template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "inbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "phone_number": "6281234567890"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://api.cekat.ai/templates/send',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => ['api_key: YOUR_API_KEY', 'Content-Type: application/json'],
  CURLOPT_POSTFIELDS => json_encode([
    'wa_template_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    'inbox_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    'phone_number' => '6281234567890'
  ]),
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
Response
200
400
401
404
429
{
  "success": true,
  "status_code": 1,
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "message": "<string>",
    "conversation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "status": "sent",
    "error": "<string>",
    "platform_mid": "<string>",
    "media_type": "<string>",
    "media_url": "https://example.com",
    "is_template": true,
    "template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "template_category": "<string>",
    "sent_by": "<string>",
    "sent_by_name": "example_name",
    "sent_by_type": "<string>",
    "additional_data": {},
    "business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  }
}
{
  "success": true,
  "status_code": 1,
  "error": {
    "message": "<string>"
  }
}
{
  "success": true,
  "status_code": 1,
  "error": {
    "message": "<string>"
  }
}
{
  "success": true,
  "status_code": 1,
  "error": {
    "message": "<string>"
  }
}
{
  "message": "<string>"
}