List templates
SDK platic.whatsapp.templates.list()
List workspace templates and filter by status or category. Check warnings to see whether each WhatsApp account could be read.
You need an approved template to start a conversation outside the 24-hour window.
Example
curl "https://api.platic.ai/v1/whatsapp/templates?status=APPROVED&category=UTILITY" \
-H "Authorization: Bearer $PLATIC_API_KEY" const { templates, warnings } = await platic.whatsapp.templates.list(); templates is the complete list; warnings identifies accounts that could not be read.
Query parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
workspace | string | Workspace ID. Required if your credential covers several workspaces (list workspaces); without it the answer is 400 | If the credential has several |
status | string | Only templates in these statuses, comma-separated: APPROVED or APPROVED,PAUSED | — |
category | string | Only these categories, comma-separated: MARKETING, UTILITY or AUTHENTICATION | — |
name | string | Only templates whose name contains this text, case-insensitive. For an exact name use get a template | — |
For example, ?status=APPROVED&category=UTILITY returns only the utility templates that can already be sent.
Response
data is the list of workspace templates. Each language version is a separate entry: order_update in es_MX and in en_US appears twice.
{
"status": "success",
"data": [
{
"id": "1234567890123456",
"name": "order_update",
"category": "UTILITY",
"status": "APPROVED",
"language": "es_MX",
"source": "meta",
"content": "Hi {{1}}, your order {{2}} is ready for pickup.",
"params": ["Ana", "A-1024"],
"header": { "type": "none", "requiresMedia": false },
"footer": "Acme",
"buttons": [],
"api_example": {
"name": "order_update",
"params": ["Ana", "A-1024"]
},
"dynamicButtonsCount": 0
}
],
"warnings": [
{
"code": "WHATSAPP_TOKEN_INVALID",
"message": "WhatsApp rejected the access token of this WhatsApp Business Account: it expired or was revoked. Reconnect the account in Platica and try again.",
"wabaId": "155598765432109",
"status": 409
}
]
} | Field | Description |
|---|---|
data | The templates that pass the filters, in the shape of get a template. Each carries api_example (the body to send it) and dynamicButtonsCount |
warnings | Only if something is missing from the list. Each warning carries code and message |
There are two kinds of warning:
WABA_NOT_FOUND: the workspace has no WhatsApp Business account (WABA) connected.datacomes back empty.- A WABA whose templates could not be read, with
wabaIdandstatus. Its templates are missing fromdata; those of the other WABAs are there.codeis the same one a write on that WABA would answer:WHATSAPP_TOKEN_INVALIDorWHATSAPP_PERMISSION_DENIED(reconnect the account in Platica),WHATSAPP_ACCOUNT_RESTRICTED(Meta restricted the account),RATE_LIMITED(wait a few minutes) orUPSTREAM_ERROR(try again in a moment).
Warning
warnings identifies WABAs that could not be read. If none could be read, the response is an error.
Errors
| Status | details.code | When |
|---|---|---|
400 | INVALID_REQUEST | A filter is not valid, such as a category that does not exist (details.issues says which). Also if your credential covers several workspaces and you did not send ?workspace=, or you sent one it does not cover: details.available has the IDs you can use |
401 | UNAUTHENTICATED | The credential is missing or not valid |
403 | FORBIDDEN | The person has no permission in Conversations or Campaigns. The message is Missing conversations or campaigns permission |
404 | WORKSPACE_NOT_FOUND | The workspace no longer exists |
409 | WHATSAPP_TOKEN_INVALID, WHATSAPP_PERMISSION_DENIED, WHATSAPP_ACCOUNT_RESTRICTED | No WABA of the workspace could be read through its WhatsApp account. The status and code are those of the first failure; details.wabaId says which and details.wabaErrors lists all of them |
429 | RATE_LIMITED | Same, because WhatsApp is rate limiting requests |
502 | UPSTREAM_ERROR | Same, because Platica could not reach WhatsApp. Also if the workspace uses MessageBird (legacy) and its templates could not be read |
503 | TEMPORARILY_UNAVAILABLE | Platica could not read the workspace or its WABAs. Try again in a moment |
{
"code": 409,
"error": "Conflict - The resource state conflicts with this request",
"details": {
"code": "WHATSAPP_TOKEN_INVALID",
"message": "WhatsApp rejected the access token of this WhatsApp Business Account: it expired or was revoked. Reconnect the account in Platica and try again.",
"wabaId": "155598765432109",
"wabaErrors": [
{
"wabaId": "155598765432109",
"code": "WHATSAPP_TOKEN_INVALID",
"message": "WhatsApp rejected the access token of this WhatsApp Business Account: it expired or was revoked. Reconnect the account in Platica and try again.",
"status": 409
}
]
}
} The general error format is in Errors.