Documentation

API to get WhatsApp Template Variables

Last updated on October 22, 2026

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

text
GET /engage/v1/wa-templates/{templateId}/variables
PropertyValue
MethodGET
Base path/engage/v1/wa-templates
Full URLhttps://client-api.e-so.in/engage/v1/wa-templates/{templateId}/variables
AuthenticationRequired
Rate limitingdefaultRateLimiter 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.

HeaderFormatExample
AuthorizationBearer <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

ParameterTypeRequiredDescription
templateIdintegerYesID of the WhatsApp template. Must belong to your business.

Request

Headers

HeaderRequiredDescription
Authorization or auth-keyYesBusiness access token (see Authentication).

Body

No request body.

http
GET /engage/v1/wa-templates/123/variables HTTP/1.1
Host: client-api.e-so.in
Authorization: Bearer YOUR_TOKEN

Responses

Success — 200 OK

json
{
  "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).

FieldTypeDescription
statusnumber200
successbooleantrue
messagestring"success"
payloadarrayTemplate parameters/placeholders. Empty array if the template has no variables. Each entry typically contains the placeholder index, type, and example.

Error Responses

HTTP StatusWhen it happensWhat to do
401Token missing/invalid/expired.Verify the header and token.
404Template not found for your business.Confirm the templateId from GET /engage/v1/wa-templates and that it belongs to your business.
429Rate limited by defaultRateLimiter.Back off and retry.
500Unexpected 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

bash
curl -X GET "https://client-api.e-so.in/engage/v1/wa-templates/123/variables" \
  -H "Authorization: Bearer YOUR_TOKEN"

JavaScript — fetch

javascript
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

python
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}")

MethodPathPurpose
GET/engage/v1/wa-templatesList templates to find templateId.
POST/engage/v1/campaignsCreate 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.