curl --request POST \
--url https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"category": "AUTHENTICATION",
"language": "example",
"name": "example"
}
'import requests
url = "https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates"
payload = {
"category": "AUTHENTICATION",
"language": "example",
"name": "example"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({category: 'AUTHENTICATION', language: 'example', name: 'example'})
};
fetch('https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'category' => 'AUTHENTICATION',
'language' => 'example',
'name' => 'example'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates"
payload := strings.NewReader("{\n \"category\": \"AUTHENTICATION\",\n \"language\": \"example\",\n \"name\": \"example\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"category\": \"AUTHENTICATION\",\n \"language\": \"example\",\n \"name\": \"example\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"category\": \"AUTHENTICATION\",\n \"language\": \"example\",\n \"name\": \"example\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"template": {
"category": "<string>",
"id": "<string>",
"language": "<string>",
"message_send_ttl_seconds": 123,
"name": "<string>",
"status": "<string>"
}
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "<string>",
"retryable": true,
"type": "<string>"
}
}Create template
WhatsApp. Create a new message template. Supports two modes:
Custom template: Provide components with your own content. Submitted to Meta for review (can take up to 24h).
Library template: Provide library_template_name instead of components to use a pre-built template from Meta’s template library. Library templates are pre-approved (no review wait). You can optionally customize parameters and buttons via library_template_body_inputs and library_template_button_inputs.
A write: needs messaging:write and is audited.
curl --request POST \
--url https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"category": "AUTHENTICATION",
"language": "example",
"name": "example"
}
'import requests
url = "https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates"
payload = {
"category": "AUTHENTICATION",
"language": "example",
"name": "example"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({category: 'AUTHENTICATION', language: 'example', name: 'example'})
};
fetch('https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'category' => 'AUTHENTICATION',
'language' => 'example',
'name' => 'example'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates"
payload := strings.NewReader("{\n \"category\": \"AUTHENTICATION\",\n \"language\": \"example\",\n \"name\": \"example\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"category\": \"AUTHENTICATION\",\n \"language\": \"example\",\n \"name\": \"example\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"category\": \"AUTHENTICATION\",\n \"language\": \"example\",\n \"name\": \"example\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"template": {
"category": "<string>",
"id": "<string>",
"language": "<string>",
"message_send_ttl_seconds": 123,
"name": "<string>",
"status": "<string>"
}
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "<string>",
"retryable": true,
"type": "<string>"
}
}Request contract
- Method and path: POST /apis/v1/social/messaging/whatsapp/templates
- Availability: enabled
- Request URL template:
https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates - connectionId: query; required
{
"operationId": "post_aisa_messaging_apis_v1_social_messaging_what_d4bd65",
"method": "POST",
"path": "/apis/v1/social/messaging/whatsapp/templates",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [
{
"description": "Your messaging connection (msc_...), from GET /apis/v1/social/messaging/connections. On a request with a JSON body it may be sent as a top-level body member instead.",
"in": "query",
"name": "connectionId",
"required": true,
"schema": {
"pattern": "^msc_[0-9A-Za-z]+$",
"type": "string"
}
}
],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"example": {
"category": "AUTHENTICATION",
"language": "example",
"name": "example"
},
"schema": {
"additionalProperties": false,
"properties": {
"category": {
"description": "Template category",
"enum": [
"AUTHENTICATION",
"MARKETING",
"UTILITY"
],
"type": "string"
},
"components": {
"description": "Template components (header, body, footer, buttons, carousel, limited_time_offer). Required for custom templates, omit when using library_template_name.",
"items": {
"oneOf": [
{
"properties": {
"example": {
"properties": {
"header_handle": {
"description": "When the header format is a media type (image, video, gif, document), provide a public URL here.",
"items": {
"format": "uri",
"type": "string"
},
"maxItems": 1,
"minItems": 1,
"type": "array"
},
"header_text": {
"description": "Sample values for header text variables",
"items": {
"type": "string"
},
"type": "array"
},
"header_text_named_params": {
"description": "Sample values for NAMED header variables (templates using {{customer_name}}-style tokens with parameter_format: NAMED).",
"items": {
"properties": {
"example": {
"description": "Sample value for this variable.",
"type": "string"
},
"param_name": {
"description": "Variable name as it appears in the text, without braces (e.g. customer_name for {{customer_name}}).",
"pattern": "^[a-z0-9_]+$",
"type": "string"
}
},
"required": [
"param_name",
"example"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
},
"format": {
"enum": [
"text",
"image",
"video",
"gif",
"document",
"location"
],
"type": "string"
},
"text": {
"description": "Header text (may include {{1}} variable). Used when format is TEXT.",
"type": "string"
},
"type": {
"enum": [
"header"
],
"type": "string"
}
},
"required": [
"type",
"format"
],
"type": "object"
},
{
"properties": {
"add_security_recommendation": {
"description": "Add security recommendation text (authentication templates only)",
"type": "boolean"
},
"example": {
"properties": {
"body_text": {
"description": "Sample values for body variables (array of arrays)",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
"body_text_named_params": {
"description": "Sample values for NAMED body variables (templates using {{customer_name}}-style tokens with parameter_format: NAMED).",
"items": {
"properties": {
"example": {
"description": "Sample value for this variable.",
"type": "string"
},
"param_name": {
"description": "Variable name as it appears in the text, without braces (e.g. customer_name for {{customer_name}}).",
"pattern": "^[a-z0-9_]+$",
"type": "string"
}
},
"required": [
"param_name",
"example"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
},
"text": {
"description": "Body text with optional {{n}} variables",
"type": "string"
},
"type": {
"enum": [
"body"
],
"type": "string"
}
},
"required": [
"type",
"text"
],
"type": "object"
},
{
"properties": {
"code_expiration_minutes": {
"description": "OTP code expiry in minutes (authentication templates only)",
"minimum": 1,
"type": "integer"
},
"text": {
"description": "Static footer text",
"type": "string"
},
"type": {
"enum": [
"footer"
],
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
},
{
"properties": {
"buttons": {
"items": {
"properties": {
"autofill_text": {
"type": "string"
},
"example": {
"description": "Example value(s). Accepts either a string or an array of strings. For URL buttons, an array of URL-suffix samples; for copy_code (marketing) buttons, the coupon code as a single string. Left untyped (string | string[]) on purpose: a typed oneOf of string-vs-array breaks several SDK code generators."
},
"flow_action": {
"type": "string"
},
"flow_id": {
"type": "string"
},
"flow_json": {
"type": "string"
},
"flow_name": {
"type": "string"
},
"navigate_screen": {
"type": "string"
},
"otp_type": {
"description": "Required when type is otp",
"enum": [
"copy_code",
"one_tap",
"zero_tap"
],
"type": "string"
},
"package_name": {
"type": "string"
},
"phone_number": {
"description": "Required when type is phone_number",
"type": "string"
},
"signature_hash": {
"type": "string"
},
"text": {
"description": "Visible button label. Required for all types except copy_code (whose label is fixed by WhatsApp) and otp (omit it and WhatsApp supplies its own label, localized to the template language; an English label on a non-English template is rejected).",
"type": "string"
},
"type": {
"enum": [
"quick_reply",
"url",
"phone_number",
"otp",
"copy_code",
"flow",
"mpm",
"catalog"
],
"type": "string"
},
"url": {
"description": "Required when type is URL",
"format": "uri",
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
},
"minItems": 1,
"type": "array"
},
"type": {
"enum": [
"buttons"
],
"type": "string"
}
},
"required": [
"type",
"buttons"
],
"type": "object"
},
{
"properties": {
"cards": {
"description": "2-10 cards. Meta requires all cards to share the same component structure; a mismatch surfaces as a rejected_reason. MARKETING category only.",
"items": {
"properties": {
"components": {
"description": "Per-card components. Each card carries its own media header + optional body + up to 2 buttons. Footer and nested carousel are not allowed inside cards.",
"items": {
"oneOf": [
{
"properties": {
"example": {
"properties": {
"header_handle": {
"description": "When the header format is a media type (image, video, gif, document), provide a public URL here.",
"items": {
"format": "uri",
"type": "string"
},
"maxItems": 1,
"minItems": 1,
"type": "array"
},
"header_text": {
"description": "Sample values for header text variables",
"items": {
"type": "string"
},
"type": "array"
},
"header_text_named_params": {
"description": "Sample values for NAMED header variables (templates using {{customer_name}}-style tokens with parameter_format: NAMED).",
"items": {
"properties": {
"example": {
"description": "Sample value for this variable.",
"type": "string"
},
"param_name": {
"description": "Variable name as it appears in the text, without braces (e.g. customer_name for {{customer_name}}).",
"pattern": "^[a-z0-9_]+$",
"type": "string"
}
},
"required": [
"param_name",
"example"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
},
"format": {
"enum": [
"text",
"image",
"video",
"gif",
"document",
"location"
],
"type": "string"
},
"text": {
"description": "Header text (may include {{1}} variable). Used when format is TEXT.",
"type": "string"
},
"type": {
"enum": [
"header"
],
"type": "string"
}
},
"required": [
"type",
"format"
],
"type": "object"
},
{
"properties": {
"add_security_recommendation": {
"description": "Add security recommendation text (authentication templates only)",
"type": "boolean"
},
"example": {
"properties": {
"body_text": {
"description": "Sample values for body variables (array of arrays)",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
"body_text_named_params": {
"description": "Sample values for NAMED body variables (templates using {{customer_name}}-style tokens with parameter_format: NAMED).",
"items": {
"properties": {
"example": {
"description": "Sample value for this variable.",
"type": "string"
},
"param_name": {
"description": "Variable name as it appears in the text, without braces (e.g. customer_name for {{customer_name}}).",
"pattern": "^[a-z0-9_]+$",
"type": "string"
}
},
"required": [
"param_name",
"example"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
},
"text": {
"description": "Body text with optional {{n}} variables",
"type": "string"
},
"type": {
"enum": [
"body"
],
"type": "string"
}
},
"required": [
"type",
"text"
],
"type": "object"
},
{
"properties": {
"buttons": {
"items": {
"properties": {
"autofill_text": {
"type": "string"
},
"example": {
"description": "Example value(s). Accepts either a string or an array of strings. For URL buttons, an array of URL-suffix samples; for copy_code (marketing) buttons, the coupon code as a single string. Left untyped (string | string[]) on purpose: a typed oneOf of string-vs-array breaks several SDK code generators."
},
"flow_action": {
"type": "string"
},
"flow_id": {
"type": "string"
},
"flow_json": {
"type": "string"
},
"flow_name": {
"type": "string"
},
"navigate_screen": {
"type": "string"
},
"otp_type": {
"description": "Required when type is otp",
"enum": [
"copy_code",
"one_tap",
"zero_tap"
],
"type": "string"
},
"package_name": {
"type": "string"
},
"phone_number": {
"description": "Required when type is phone_number",
"type": "string"
},
"signature_hash": {
"type": "string"
},
"text": {
"description": "Visible button label. Required for all types except copy_code (whose label is fixed by WhatsApp) and otp (omit it and WhatsApp supplies its own label, localized to the template language; an English label on a non-English template is rejected).",
"type": "string"
},
"type": {
"enum": [
"quick_reply",
"url",
"phone_number",
"otp",
"copy_code",
"flow",
"mpm",
"catalog"
],
"type": "string"
},
"url": {
"description": "Required when type is URL",
"format": "uri",
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
},
"minItems": 1,
"type": "array"
},
"type": {
"enum": [
"buttons"
],
"type": "string"
}
},
"required": [
"type",
"buttons"
],
"type": "object"
}
]
},
"minItems": 1,
"type": "array"
}
},
"required": [
"components"
],
"type": "object"
},
"maxItems": 10,
"minItems": 2,
"type": "array"
},
"type": {
"enum": [
"carousel"
],
"type": "string"
}
},
"required": [
"type",
"cards"
],
"type": "object"
},
{
"properties": {
"limited_time_offer": {
"properties": {
"has_expiration": {
"description": "Toggles the countdown timer. The actual coupon code + expiry are bound at SEND time, not here.",
"type": "boolean"
},
"text": {
"description": "Short offer label (<=16 chars). MARKETING only.",
"maxLength": 16,
"minLength": 1,
"type": "string"
}
},
"required": [
"text"
],
"type": "object"
},
"type": {
"enum": [
"limited_time_offer"
],
"type": "string"
}
},
"required": [
"type",
"limited_time_offer"
],
"type": "object"
}
]
},
"minItems": 1,
"type": "array"
},
"connectionId": {
"description": "The connection, when not sent as the connectionId query parameter.",
"pattern": "^msc_[0-9A-Za-z]+$",
"type": "string"
},
"language": {
"description": "Template language code (e.g., en_US)",
"type": "string"
},
"library_template_body_inputs": {
"description": "Optional body customizations for library templates. Available options depend on the\ntemplate (e.g., add_contact_number, add_learn_more_link, add_security_recommendation,\nadd_track_package_link, code_expiration_minutes).",
"type": "object"
},
"library_template_button_inputs": {
"description": "Optional button customizations for library templates. Each item specifies button type\nand configuration (e.g., URL, phone number, quick reply).",
"items": {
"properties": {
"phone_number": {
"type": "string"
},
"type": {
"enum": [
"quick_reply",
"url",
"phone_number"
],
"type": "string"
},
"url": {
"properties": {
"base_url": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"type": "array"
},
"library_template_name": {
"description": "Name of a pre-built template from Meta's template library (e.g., \"appointment_reminder\",\n\"auto_pay_reminder_1\", \"address_update\"). When provided, the template is pre-approved\nby Meta with no review wait. Omit components when using this field.",
"type": "string"
},
"message_send_ttl_seconds": {
"description": "Delivery validity window in seconds: a message not delivered within it is dropped. Range by category:\n\n- AUTHENTICATION: 30 to 900. - UTILITY: 30 to 43200 (12h). - MARKETING: 43200 to 2592000 (30 days).\n\n-1 (create only) keeps the 30-day default on AUTHENTICATION and UTILITY. Meta defaults to 600 for AUTHENTICATION and 30 days otherwise. If Meta later recategorises the template, it clears the TTL (read it back to check).",
"type": "integer"
},
"name": {
"description": "Template name (lowercase, letters/numbers/underscores, must start with a letter)",
"pattern": "^[a-z][a-z0-9_]*$",
"type": "string"
},
"parameter_format": {
"description": "Variable style: POSITIONAL ({{1}}, the default) or NAMED ({{customer_name}}). Named templates provide examples via body_text_named_params / header_text_named_params. Inferred as NAMED when omitted but a named-params example is present.",
"enum": [
"POSITIONAL",
"NAMED",
"positional",
"named"
],
"type": "string"
}
},
"required": [
"name",
"category",
"language"
],
"type": "object"
}
}
},
"required": true
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
Cost and request rules
No additional charge for this operation.Authorizations
Query Parameters
Body
Delivery validity window in seconds: a message not delivered within it is dropped. Range by category:
- AUTHENTICATION: 30 to 900. - UTILITY: 30 to 43200 (12h). - MARKETING: 43200 to 2592000 (30 days).
-1 (create only) keeps the 30-day default on AUTHENTICATION and UTILITY. Meta defaults to 600 for AUTHENTICATION and 30 days otherwise. If Meta later recategorises the template, it clears the TTL (read it back to check).
Variable style: POSITIONAL ({{1}}, the default) or NAMED ({{customer_name}}). Named templates provide examples via body_text_named_params / header_text_named_params. Inferred as NAMED when omitted but a named-params example is present.
POSITIONAL, NAMED, positional, named