List WhatsApp templates
curl --request GET \
--url https://www.chatbase.co/api/v2/agents/{agentId}/whatsapp/templates \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chatbase.co/api/v2/agents/{agentId}/whatsapp/templates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.chatbase.co/api/v2/agents/{agentId}/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://www.chatbase.co/api/v2/agents/{agentId}/whatsapp/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.chatbase.co/api/v2/agents/{agentId}/whatsapp/templates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.chatbase.co/api/v2/agents/{agentId}/whatsapp/templates")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chatbase.co/api/v2/agents/{agentId}/whatsapp/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"templates": [
{
"id": "<string>",
"name": "<string>",
"language": "<string>",
"category": "<string>",
"status": "<string>",
"parameterFormat": "POSITIONAL",
"wabaId": "<string>",
"variables": {
"header": [
"1"
],
"body": [
"1",
"2"
]
},
"components": [
{
"type": "<string>",
"format": "<string>",
"text": "<string>",
"buttons": [
{
"type": "<string>",
"text": "<string>",
"url": "<string>"
}
]
}
]
}
],
"complete": true,
"unavailableWabaIds": [],
"senders": [
{
"from": "14155552671",
"wabaId": "<string>",
"verifiedName": "<string>"
}
]
}{
"error": {
"code": "AUTH_MISSING_API_KEY",
"message": "Authentication required"
}
}{
"error": {
"code": "WHATSAPP_NOT_CONNECTED",
"message": "WhatsApp is not connected for this agent"
}
}{
"error": {
"code": "AGENT_NOT_FOUND",
"message": "Agent not found"
}
}{
"error": {
"code": "RATE_LIMIT_TOO_MANY_REQUESTS",
"message": "Too many requests, please try again later"
}
}{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Something went wrong, please try again"
}
}WhatsApp
List WhatsApp templates
Lists the approved WhatsApp templates available to the agent, across all of its connected WhatsApp Business Accounts. Each template’s variables object is the shape a send request must provide. A template can only be sent from a number on its own Business Account, so pair its wabaId with a matching entry in senders to pick the from value. Check complete before treating the list as exhaustive: it is false when one of the agent’s Business Accounts could not be read.
GET
/
agents
/
{agentId}
/
whatsapp
/
templates
List WhatsApp templates
curl --request GET \
--url https://www.chatbase.co/api/v2/agents/{agentId}/whatsapp/templates \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chatbase.co/api/v2/agents/{agentId}/whatsapp/templates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.chatbase.co/api/v2/agents/{agentId}/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://www.chatbase.co/api/v2/agents/{agentId}/whatsapp/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.chatbase.co/api/v2/agents/{agentId}/whatsapp/templates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.chatbase.co/api/v2/agents/{agentId}/whatsapp/templates")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chatbase.co/api/v2/agents/{agentId}/whatsapp/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"templates": [
{
"id": "<string>",
"name": "<string>",
"language": "<string>",
"category": "<string>",
"status": "<string>",
"parameterFormat": "POSITIONAL",
"wabaId": "<string>",
"variables": {
"header": [
"1"
],
"body": [
"1",
"2"
]
},
"components": [
{
"type": "<string>",
"format": "<string>",
"text": "<string>",
"buttons": [
{
"type": "<string>",
"text": "<string>",
"url": "<string>"
}
]
}
]
}
],
"complete": true,
"unavailableWabaIds": [],
"senders": [
{
"from": "14155552671",
"wabaId": "<string>",
"verifiedName": "<string>"
}
]
}{
"error": {
"code": "AUTH_MISSING_API_KEY",
"message": "Authentication required"
}
}{
"error": {
"code": "WHATSAPP_NOT_CONNECTED",
"message": "WhatsApp is not connected for this agent"
}
}{
"error": {
"code": "AGENT_NOT_FOUND",
"message": "Agent not found"
}
}{
"error": {
"code": "RATE_LIMIT_TOO_MANY_REQUESTS",
"message": "Too many requests, please try again later"
}
}{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Something went wrong, please try again"
}
}Path Parameters
Response
The available templates