cURL
curl --request POST \
--url https://api.buildwithchirp.com/v1/whatsapp/templates/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "+15551234567",
"to": "+15559876543",
"templateName": "order_confirmation",
"languageCode": "en_US",
"variables": {
"customer_name": "John",
"order_id": "12345"
},
"headerVariables": {
"header_text": "Order Update"
},
"buttonVariables": {
"button_0": [
"https://example.com/track/12345"
]
}
}
'import requests
url = "https://api.buildwithchirp.com/v1/whatsapp/templates/send"
payload = {
"from": "+15551234567",
"to": "+15559876543",
"templateName": "order_confirmation",
"languageCode": "en_US",
"variables": {
"customer_name": "John",
"order_id": "12345"
},
"headerVariables": { "header_text": "Order Update" },
"buttonVariables": { "button_0": ["https://example.com/track/12345"] }
}
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({
from: '+15551234567',
to: '+15559876543',
templateName: 'order_confirmation',
languageCode: 'en_US',
variables: {customer_name: 'John', order_id: '12345'},
headerVariables: {header_text: 'Order Update'},
buttonVariables: {button_0: ['https://example.com/track/12345']}
})
};
fetch('https://api.buildwithchirp.com/v1/whatsapp/templates/send', 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.buildwithchirp.com/v1/whatsapp/templates/send",
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([
'from' => '+15551234567',
'to' => '+15559876543',
'templateName' => 'order_confirmation',
'languageCode' => 'en_US',
'variables' => [
'customer_name' => 'John',
'order_id' => '12345'
],
'headerVariables' => [
'header_text' => 'Order Update'
],
'buttonVariables' => [
'button_0' => [
'https://example.com/track/12345'
]
]
]),
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.buildwithchirp.com/v1/whatsapp/templates/send"
payload := strings.NewReader("{\n \"from\": \"+15551234567\",\n \"to\": \"+15559876543\",\n \"templateName\": \"order_confirmation\",\n \"languageCode\": \"en_US\",\n \"variables\": {\n \"customer_name\": \"John\",\n \"order_id\": \"12345\"\n },\n \"headerVariables\": {\n \"header_text\": \"Order Update\"\n },\n \"buttonVariables\": {\n \"button_0\": [\n \"https://example.com/track/12345\"\n ]\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://api.buildwithchirp.com/v1/whatsapp/templates/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"+15551234567\",\n \"to\": \"+15559876543\",\n \"templateName\": \"order_confirmation\",\n \"languageCode\": \"en_US\",\n \"variables\": {\n \"customer_name\": \"John\",\n \"order_id\": \"12345\"\n },\n \"headerVariables\": {\n \"header_text\": \"Order Update\"\n },\n \"buttonVariables\": {\n \"button_0\": [\n \"https://example.com/track/12345\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buildwithchirp.com/v1/whatsapp/templates/send")
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 \"from\": \"+15551234567\",\n \"to\": \"+15559876543\",\n \"templateName\": \"order_confirmation\",\n \"languageCode\": \"en_US\",\n \"variables\": {\n \"customer_name\": \"John\",\n \"order_id\": \"12345\"\n },\n \"headerVariables\": {\n \"header_text\": \"Order Update\"\n },\n \"buttonVariables\": {\n \"button_0\": [\n \"https://example.com/track/12345\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "msg_wa_abc123",
"messaging_product": "whatsapp",
"contacts": [
{
"input": "<string>",
"wa_id": "<string>"
}
],
"messages": [
{
"id": "wamid.HBgLMTUwMzMwNzk5NzQVAgARGBI...",
"message_status": "<string>"
}
]
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}WhatsApp Templates
Send app template message
Send a WhatsApp template message. The template must be approved by Meta and linked to this app. Variables can be passed using named keys that will be automatically mapped to positional indices.
POST
/
v1
/
whatsapp
/
templates
/
send
cURL
curl --request POST \
--url https://api.buildwithchirp.com/v1/whatsapp/templates/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "+15551234567",
"to": "+15559876543",
"templateName": "order_confirmation",
"languageCode": "en_US",
"variables": {
"customer_name": "John",
"order_id": "12345"
},
"headerVariables": {
"header_text": "Order Update"
},
"buttonVariables": {
"button_0": [
"https://example.com/track/12345"
]
}
}
'import requests
url = "https://api.buildwithchirp.com/v1/whatsapp/templates/send"
payload = {
"from": "+15551234567",
"to": "+15559876543",
"templateName": "order_confirmation",
"languageCode": "en_US",
"variables": {
"customer_name": "John",
"order_id": "12345"
},
"headerVariables": { "header_text": "Order Update" },
"buttonVariables": { "button_0": ["https://example.com/track/12345"] }
}
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({
from: '+15551234567',
to: '+15559876543',
templateName: 'order_confirmation',
languageCode: 'en_US',
variables: {customer_name: 'John', order_id: '12345'},
headerVariables: {header_text: 'Order Update'},
buttonVariables: {button_0: ['https://example.com/track/12345']}
})
};
fetch('https://api.buildwithchirp.com/v1/whatsapp/templates/send', 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.buildwithchirp.com/v1/whatsapp/templates/send",
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([
'from' => '+15551234567',
'to' => '+15559876543',
'templateName' => 'order_confirmation',
'languageCode' => 'en_US',
'variables' => [
'customer_name' => 'John',
'order_id' => '12345'
],
'headerVariables' => [
'header_text' => 'Order Update'
],
'buttonVariables' => [
'button_0' => [
'https://example.com/track/12345'
]
]
]),
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.buildwithchirp.com/v1/whatsapp/templates/send"
payload := strings.NewReader("{\n \"from\": \"+15551234567\",\n \"to\": \"+15559876543\",\n \"templateName\": \"order_confirmation\",\n \"languageCode\": \"en_US\",\n \"variables\": {\n \"customer_name\": \"John\",\n \"order_id\": \"12345\"\n },\n \"headerVariables\": {\n \"header_text\": \"Order Update\"\n },\n \"buttonVariables\": {\n \"button_0\": [\n \"https://example.com/track/12345\"\n ]\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://api.buildwithchirp.com/v1/whatsapp/templates/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"+15551234567\",\n \"to\": \"+15559876543\",\n \"templateName\": \"order_confirmation\",\n \"languageCode\": \"en_US\",\n \"variables\": {\n \"customer_name\": \"John\",\n \"order_id\": \"12345\"\n },\n \"headerVariables\": {\n \"header_text\": \"Order Update\"\n },\n \"buttonVariables\": {\n \"button_0\": [\n \"https://example.com/track/12345\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buildwithchirp.com/v1/whatsapp/templates/send")
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 \"from\": \"+15551234567\",\n \"to\": \"+15559876543\",\n \"templateName\": \"order_confirmation\",\n \"languageCode\": \"en_US\",\n \"variables\": {\n \"customer_name\": \"John\",\n \"order_id\": \"12345\"\n },\n \"headerVariables\": {\n \"header_text\": \"Order Update\"\n },\n \"buttonVariables\": {\n \"button_0\": [\n \"https://example.com/track/12345\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "msg_wa_abc123",
"messaging_product": "whatsapp",
"contacts": [
{
"input": "<string>",
"wa_id": "<string>"
}
],
"messages": [
{
"id": "wamid.HBgLMTUwMzMwNzk5NzQVAgARGBI...",
"message_status": "<string>"
}
]
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}Authorizations
App API key (format: sk_live_app_* or sk_test_app_*) for app-level operations
Body
application/json
Your WhatsApp phone number to send from (E.164 format)
Pattern:
^\+[1-9]\d{1,14}$Example:
"+15551234567"
Recipient phone number in E.164 format
Pattern:
^\+[1-9]\d{1,14}$Example:
"+15559876543"
Name of the approved template to send
Example:
"order_confirmation"
Language code of the template
Example:
"en_US"
Body variables as key-value pairs
Show child attributes
Show child attributes
Example:
{
"customer_name": "John",
"order_id": "12345"
}
Header variables as key-value pairs
Show child attributes
Show child attributes
Example:
{ "header_text": "Order Update" }
Button URL variables by button index (e.g., button_0: ['value'])
Show child attributes
Show child attributes
Example:
{
"button_0": ["https://example.com/track/12345"]
}
⌘I