API to get WhatsApp Template Variables
Fetch the template variables (parameters) for a specific WhatsApp template. Use this endpoint to discover what placeholders a template expects before building column_mappings and default_values for a campaign.
Endpoint
GET /engage/v1/wa-templates/{templateId}/variables| Property | Value |
|---|---|
| Method | GET |
| Base path | /engage/v1/wa-templates |
| Full URL | https://client-api.e-so.in/engage/v1/wa-templates/{templateId}/variables |
| Authentication | Required |
| Rate limiting | defaultRateLimiter middleware applies |
Authentication
All requests must include a business access token. You can send it in either header — if both are present, Authorization is used.
| Header | Format | Example |
|---|---|---|
Authorization | Bearer <token> | Authorization: Bearer abc123... |
auth-key | <token> | auth-key: abc123... |
- The template must belong to your business (businessId from the token). - If the token is missing, invalid, or expired the API returns 401 Unauthorized.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
templateId | integer | Yes | ID of the WhatsApp template. Must belong to your business. |
Request
Headers
| Header | Required | Description |
|---|---|---|
Authorization or auth-key | Yes | Business access token (see Authentication). |
Body
No request body.
GET /engage/v1/wa-templates/123/variables HTTP/1.1
Host: client-api.e-so.in
Authorization: Bearer YOUR_TOKENResponses
Success — 200 OK
{
"status": 200,
"success": true,
"message": "success",
"payload": [
{ "name": "1", "type": "TEXT", "example": "John" },
{ "name": "2", "type": "TEXT", "example": "Delhi" }
]
}Payload shape — the returned payload is the result of WaTemplateUtils.getTemplateParameters(components, category), where components and category are fetched via WaTemplateService.getById(templateId, businessId, ["components", "category"]). The array describes each placeholder the template expects (e.g. {{1}}, {{2}} in BODY/HEADER components).
| Field | Type | Description |
|---|---|---|
status | number | 200 |
success | boolean | true |
message | string | "success" |
payload | array | Template parameters/placeholders. Empty array if the template has no variables. Each entry typically contains the placeholder index, type, and example. |
Error Responses
| HTTP Status | When it happens | What to do |
|---|---|---|
401 | Token missing/invalid/expired. | Verify the header and token. |
404 | Template not found for your business. | Confirm the templateId from GET /engage/v1/wa-templates and that it belongs to your business. |
429 | Rate limited by defaultRateLimiter. | Back off and retry. |
500 | Unexpected server error (e.g. template components malformed). | Retry with backoff; contact support if persistent. |
Behavior Notes
- Business scoping — WaTemplateService.getById(templateId, businessId, ["components", "category"]) ensures only your business's templates are accessible. - Variables vs components — WaTemplateUtils.getTemplateParameters(components, category) parses the template's components (e.g. HEADER, BODY, BUTTONS) and returns the indexed parameters needed to populate the template. Use these to build column_mappings and default_values when calling POST /engage/v1/campaigns. - No pagination — single-resource fetch, no page/limit.
Code Examples
cURL
curl -X GET "https://client-api.e-so.in/engage/v1/wa-templates/123/variables" \
-H "Authorization: Bearer YOUR_TOKEN"JavaScript — fetch
const host = "https://client-api.e-so.in";
const templateId = 123;
const response = await fetch(`${host}/engage/v1/wa-templates/${templateId}/variables`, {
headers: { Authorization: "Bearer YOUR_TOKEN" },
});
const body = await response.json();
if (!response.ok) {
console.error(`Error ${body.status}: ${body.message}`);
} else {
console.log(`Template ${templateId} expects ${body.payload.length} variables:`);
body.payload.forEach((param, i) => {
console.log(` {{${i + 1}}} —`, param);
});
// Use this to build column_mappings for POST /engage/v1/campaigns
}Python — requests
import requests
host = "https://client-api.e-so.in"
template_id = 123
headers = {"Authorization": "Bearer YOUR_TOKEN"}
resp = requests.get(f"{host}/engage/v1/wa-templates/{template_id}/variables", headers=headers)
if resp.status_code == 200:
params = resp.json()["payload"]
print(f"Template {template_id} has {len(params)} variables:")
for p in params:
print(p)
else:
print(f"Error {resp.status_code}: {resp.text}")Related Endpoints
| Method | Path | Purpose |
|---|---|---|
GET | /engage/v1/wa-templates | List templates to find templateId. |
POST | /engage/v1/campaigns | Create a campaign — supply wa_template_id and column_mappings derived from these variables. |
Support
Include the templateId, the response status/message, and the UTC timestamp when contacting support.