curl --request POST \
--url https://{subdomain}.mihu.ai/api/v1/whatsapp/template \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agentId": "32d8fc98-be1e-4d32-a12e-146f397fb1cb",
"templateId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"phoneNumber": "+12345678900",
"parameters": {
"field1": "John Doe",
"field2": "Order #12345",
"field3": "2024-01-15"
},
"header": {
"type": "image",
"url": "https://example.com/image.jpg",
"filename": "invoice.pdf"
}
}
'import requests
url = "https://{subdomain}.mihu.ai/api/v1/whatsapp/template"
payload = {
"agentId": "32d8fc98-be1e-4d32-a12e-146f397fb1cb",
"templateId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"phoneNumber": "+12345678900",
"parameters": {
"field1": "John Doe",
"field2": "Order #12345",
"field3": "2024-01-15"
},
"header": {
"type": "image",
"url": "https://example.com/image.jpg",
"filename": "invoice.pdf"
}
}
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({
agentId: '32d8fc98-be1e-4d32-a12e-146f397fb1cb',
templateId: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
phoneNumber: '+12345678900',
parameters: {field1: 'John Doe', field2: 'Order #12345', field3: '2024-01-15'},
header: {type: 'image', url: 'https://example.com/image.jpg', filename: 'invoice.pdf'}
})
};
fetch('https://{subdomain}.mihu.ai/api/v1/whatsapp/template', 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://{subdomain}.mihu.ai/api/v1/whatsapp/template",
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([
'agentId' => '32d8fc98-be1e-4d32-a12e-146f397fb1cb',
'templateId' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'phoneNumber' => '+12345678900',
'parameters' => [
'field1' => 'John Doe',
'field2' => 'Order #12345',
'field3' => '2024-01-15'
],
'header' => [
'type' => 'image',
'url' => 'https://example.com/image.jpg',
'filename' => 'invoice.pdf'
]
]),
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://{subdomain}.mihu.ai/api/v1/whatsapp/template"
payload := strings.NewReader("{\n \"agentId\": \"32d8fc98-be1e-4d32-a12e-146f397fb1cb\",\n \"templateId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"phoneNumber\": \"+12345678900\",\n \"parameters\": {\n \"field1\": \"John Doe\",\n \"field2\": \"Order #12345\",\n \"field3\": \"2024-01-15\"\n },\n \"header\": {\n \"type\": \"image\",\n \"url\": \"https://example.com/image.jpg\",\n \"filename\": \"invoice.pdf\"\n }\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://{subdomain}.mihu.ai/api/v1/whatsapp/template")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentId\": \"32d8fc98-be1e-4d32-a12e-146f397fb1cb\",\n \"templateId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"phoneNumber\": \"+12345678900\",\n \"parameters\": {\n \"field1\": \"John Doe\",\n \"field2\": \"Order #12345\",\n \"field3\": \"2024-01-15\"\n },\n \"header\": {\n \"type\": \"image\",\n \"url\": \"https://example.com/image.jpg\",\n \"filename\": \"invoice.pdf\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.mihu.ai/api/v1/whatsapp/template")
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 \"agentId\": \"32d8fc98-be1e-4d32-a12e-146f397fb1cb\",\n \"templateId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"phoneNumber\": \"+12345678900\",\n \"parameters\": {\n \"field1\": \"John Doe\",\n \"field2\": \"Order #12345\",\n \"field3\": \"2024-01-15\"\n },\n \"header\": {\n \"type\": \"image\",\n \"url\": \"https://example.com/image.jpg\",\n \"filename\": \"invoice.pdf\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "WhatsApp template message sent successfully",
"data": {
"messageId": "wamid.HBgMOTA1NDM1NTA2Njc3FQIAEhggRDdBQjlFM0Q2Q0E4OEJBMDE5NkMyNEZBNjVCNzE2MzYA",
"templateName": "order_confirmation",
"recipientPhone": "+12345678900",
"conversationId": 456
}
}{
"success": false,
"message": "Template parameter mismatch: provided 3 parameters but template expects 0 parameters",
"data": [
"<unknown>"
]
}{
"success": false,
"message": "Agent not found | Template not found | WhatsApp not configured for this agent",
"data": [
"<unknown>"
]
}{
"success": false,
"message": "The agentId field is required. | The phoneNumber field is required.",
"data": [
"<unknown>"
]
}{
"success": false,
"message": "Failed to send WhatsApp message",
"data": [
"<unknown>"
]
}Send WhatsApp template message
Sends a WhatsApp template message to a specified phone number using an agent’s configured WhatsApp Business API. The template must be pre-approved by WhatsApp and the agent must have WhatsApp channel configured.
curl --request POST \
--url https://{subdomain}.mihu.ai/api/v1/whatsapp/template \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agentId": "32d8fc98-be1e-4d32-a12e-146f397fb1cb",
"templateId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"phoneNumber": "+12345678900",
"parameters": {
"field1": "John Doe",
"field2": "Order #12345",
"field3": "2024-01-15"
},
"header": {
"type": "image",
"url": "https://example.com/image.jpg",
"filename": "invoice.pdf"
}
}
'import requests
url = "https://{subdomain}.mihu.ai/api/v1/whatsapp/template"
payload = {
"agentId": "32d8fc98-be1e-4d32-a12e-146f397fb1cb",
"templateId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"phoneNumber": "+12345678900",
"parameters": {
"field1": "John Doe",
"field2": "Order #12345",
"field3": "2024-01-15"
},
"header": {
"type": "image",
"url": "https://example.com/image.jpg",
"filename": "invoice.pdf"
}
}
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({
agentId: '32d8fc98-be1e-4d32-a12e-146f397fb1cb',
templateId: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
phoneNumber: '+12345678900',
parameters: {field1: 'John Doe', field2: 'Order #12345', field3: '2024-01-15'},
header: {type: 'image', url: 'https://example.com/image.jpg', filename: 'invoice.pdf'}
})
};
fetch('https://{subdomain}.mihu.ai/api/v1/whatsapp/template', 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://{subdomain}.mihu.ai/api/v1/whatsapp/template",
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([
'agentId' => '32d8fc98-be1e-4d32-a12e-146f397fb1cb',
'templateId' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'phoneNumber' => '+12345678900',
'parameters' => [
'field1' => 'John Doe',
'field2' => 'Order #12345',
'field3' => '2024-01-15'
],
'header' => [
'type' => 'image',
'url' => 'https://example.com/image.jpg',
'filename' => 'invoice.pdf'
]
]),
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://{subdomain}.mihu.ai/api/v1/whatsapp/template"
payload := strings.NewReader("{\n \"agentId\": \"32d8fc98-be1e-4d32-a12e-146f397fb1cb\",\n \"templateId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"phoneNumber\": \"+12345678900\",\n \"parameters\": {\n \"field1\": \"John Doe\",\n \"field2\": \"Order #12345\",\n \"field3\": \"2024-01-15\"\n },\n \"header\": {\n \"type\": \"image\",\n \"url\": \"https://example.com/image.jpg\",\n \"filename\": \"invoice.pdf\"\n }\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://{subdomain}.mihu.ai/api/v1/whatsapp/template")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentId\": \"32d8fc98-be1e-4d32-a12e-146f397fb1cb\",\n \"templateId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"phoneNumber\": \"+12345678900\",\n \"parameters\": {\n \"field1\": \"John Doe\",\n \"field2\": \"Order #12345\",\n \"field3\": \"2024-01-15\"\n },\n \"header\": {\n \"type\": \"image\",\n \"url\": \"https://example.com/image.jpg\",\n \"filename\": \"invoice.pdf\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.mihu.ai/api/v1/whatsapp/template")
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 \"agentId\": \"32d8fc98-be1e-4d32-a12e-146f397fb1cb\",\n \"templateId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"phoneNumber\": \"+12345678900\",\n \"parameters\": {\n \"field1\": \"John Doe\",\n \"field2\": \"Order #12345\",\n \"field3\": \"2024-01-15\"\n },\n \"header\": {\n \"type\": \"image\",\n \"url\": \"https://example.com/image.jpg\",\n \"filename\": \"invoice.pdf\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "WhatsApp template message sent successfully",
"data": {
"messageId": "wamid.HBgMOTA1NDM1NTA2Njc3FQIAEhggRDdBQjlFM0Q2Q0E4OEJBMDE5NkMyNEZBNjVCNzE2MzYA",
"templateName": "order_confirmation",
"recipientPhone": "+12345678900",
"conversationId": 456
}
}{
"success": false,
"message": "Template parameter mismatch: provided 3 parameters but template expects 0 parameters",
"data": [
"<unknown>"
]
}{
"success": false,
"message": "Agent not found | Template not found | WhatsApp not configured for this agent",
"data": [
"<unknown>"
]
}{
"success": false,
"message": "The agentId field is required. | The phoneNumber field is required.",
"data": [
"<unknown>"
]
}{
"success": false,
"message": "Failed to send WhatsApp message",
"data": [
"<unknown>"
]
}Authorizations
Use a Bearer token to access these API endpoints. Example: "Bearer {your-token}"
Body
UUID of the Agent. Must exist and have WhatsApp configured.
"32d8fc98-be1e-4d32-a12e-146f397fb1cb"
UUID of the approved WhatsApp template to send. You can get the templateId from the templates section.
"a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Phone number of the recipient in E.164 format (e.g., +1234567890).
"+12345678900"
Optional object containing parameters to fill template placeholders. Keys should be field1, field2, etc. corresponding to {{1}}, {{2}}, etc. in the template. Omit this field if template has no placeholders.
{
"field1": "John Doe",
"field2": "Order #12345",
"field3": "2024-01-15"
}Optional header media definition. Supports image, video, or document with a publicly accessible URL.
Show child attributes
Show child attributes
Response
Success
Indicates whether the request completed successfully. True for successful responses; false for documented error responses.
true
Human-readable response message. Safe to display in logs or simple client notifications; use structured fields for program logic.
"WhatsApp template message sent successfully"
Show child attributes
Show child attributes