Get WhatsApp Template Variables
curl --request GET \
--url https://api-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys \
--header 'x-api-key: <x-api-key>' \
--header 'x-workspace-id: <x-workspace-id>'import requests
url = "https://api-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys"
headers = {
"x-api-key": "<x-api-key>",
"x-workspace-id": "<x-workspace-id>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-workspace-id': '<x-workspace-id>'}
};
fetch('https://api-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys', 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-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <x-api-key>",
"x-workspace-id: <x-workspace-id>"
],
]);
$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://api-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-workspace-id", "<x-workspace-id>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys")
.header("x-api-key", "<x-api-key>")
.header("x-workspace-id", "<x-workspace-id>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-workspace-id"] = '<x-workspace-id>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Template variables retrieved successfully",
"data": {
"data": [
{
"keyName": "customer_name",
"label": "Customer Name",
"type": "TEXT"
},
{
"keyName": "order_number",
"label": "Order Number",
"type": "TEXT"
},
{
"keyName": "product_image",
"label": "Product Image",
"type": "IMAGE_URL"
},
{
"keyName": "otp_code",
"label": "OTP Code",
"type": "OTP"
}
]
}
}
{
"success": false,
"message": "Invalid phone_id, template_name, or language parameter"
}
{
"success": false,
"message": "Unauthorized. Please check your API key and workspace ID."
}
{
"success": false,
"message": "Internal server error. Please try again later."
}
WhatsApp
Get WhatsApp Template Variables
Retrieves the variable keys and types for a specific WhatsApp template
GET
/
api
/
data
/
whatsapp
/
v1
/
{phone_id}
/
variable-keys
Get WhatsApp Template Variables
curl --request GET \
--url https://api-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys \
--header 'x-api-key: <x-api-key>' \
--header 'x-workspace-id: <x-workspace-id>'import requests
url = "https://api-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys"
headers = {
"x-api-key": "<x-api-key>",
"x-workspace-id": "<x-workspace-id>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-workspace-id': '<x-workspace-id>'}
};
fetch('https://api-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys', 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-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <x-api-key>",
"x-workspace-id: <x-workspace-id>"
],
]);
$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://api-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-workspace-id", "<x-workspace-id>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys")
.header("x-api-key", "<x-api-key>")
.header("x-workspace-id", "<x-workspace-id>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-ai.zixflow.com/api/data/whatsapp/v1/{phone_id}/variable-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-workspace-id"] = '<x-workspace-id>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Template variables retrieved successfully",
"data": {
"data": [
{
"keyName": "customer_name",
"label": "Customer Name",
"type": "TEXT"
},
{
"keyName": "order_number",
"label": "Order Number",
"type": "TEXT"
},
{
"keyName": "product_image",
"label": "Product Image",
"type": "IMAGE_URL"
},
{
"keyName": "otp_code",
"label": "OTP Code",
"type": "OTP"
}
]
}
}
{
"success": false,
"message": "Invalid phone_id, template_name, or language parameter"
}
{
"success": false,
"message": "Unauthorized. Please check your API key and workspace ID."
}
{
"success": false,
"message": "Internal server error. Please try again later."
}
Description
This endpoint allows you to retrieve the variable keys and their types for a specific WhatsApp template. This is useful when you need to know what variables are required or available in a template before sending a message. Each variable includes its key name, type, and display label.Headers
Path Parameters
The unique Phone ID associated with your WhatsApp Business account. You can find this on the Zixflow WhatsApp Settings page or by calling the Get WhatsApp Accounts endpoint.
Query Parameters
The name of the WhatsApp template for which you want to retrieve variable information.
The language code of the template (e.g., “en”, “en_US”). This must match the language of the template you want to query.
Response
The variable key name that should be used when sending the template. This is the identifier you’ll use in your API request.
The display label for the variable, which provides a human-readable description of what the variable represents.
The type of the variable. Possible values: “IMAGE_URL”, “VIDEO_URL”, “DOCUMENT_URL”, “TEXT”, “OTP”.
{
"success": true,
"message": "Template variables retrieved successfully",
"data": {
"data": [
{
"keyName": "customer_name",
"label": "Customer Name",
"type": "TEXT"
},
{
"keyName": "order_number",
"label": "Order Number",
"type": "TEXT"
},
{
"keyName": "product_image",
"label": "Product Image",
"type": "IMAGE_URL"
},
{
"keyName": "otp_code",
"label": "OTP Code",
"type": "OTP"
}
]
}
}
{
"success": false,
"message": "Invalid phone_id, template_name, or language parameter"
}
{
"success": false,
"message": "Unauthorized. Please check your API key and workspace ID."
}
{
"success": false,
"message": "Internal server error. Please try again later."
}