Delete a template

SDK platic.whatsapp.templates.delete()

Delete a template at Meta. Without language, delete all its languages; with language, delete only that version. This cannot be undone.

Example

await platic.whatsapp.templates.delete("order_update", { language: "es_MX" });

Path parameters

ParameterTypeDescriptionRequired
namestringExact name of the template✓

Query parameters

ParameterTypeDescriptionRequired
workspacestringWorkspace ID. Required if your credential covers several workspaces (list workspaces); without it the answer is 400If the credential has several
languagestringDelete only this language version, such as es_MX. Without it all languages are deleted—
wabaIdstringThe template's WABA. Needed only if the same name exists in several WABAs of the workspace—

Request body

None.

Response

{
  "status": "success",
  "message": "Template deleted successfully",
  "data": {
    "name": "order_update",
    "wabaId": "155512345678901",
    "workspaceId": "K7u9rQ2LmZx18BvC5tNd",
    "deleted": [
      { "id": "1234567890123456", "language": "es_MX" },
      { "id": "6543210987654321", "language": "en_US" }
    ]
  }
}

With language, message is "Template version deleted successfully" and deleted has only that version.

FieldDescription
nameThe deleted template
wabaId, workspaceIdWhere it was
deletedThe deleted versions, with their Meta id and their language

Errors

Statusdetails.codeWhen
400INVALID_REQUESTThe name or language are not valid. details.issues says which
400INVALID_REQUESTYour 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
400WABA_REQUIREDThe name exists in several WABAs of the workspace. details.available lists the ones that have it
400TEMPLATE_INVALIDMeta rejected the deletion. details.message has the reason
401UNAUTHENTICATEDThe credential is missing or not valid
403FORBIDDENAn OAuth token without the platica:write scope, or the person has no delete permission in Campaigns. Conversations does not grant permission to delete templates. The message is Missing campaigns permission
404TEMPLATE_NOT_FOUNDNo template has that name, or it does not have that language. In the second case details.languages lists the ones it has
404NOT_FOUNDMeta did not find the template when deleting it
404WORKSPACE_NOT_FOUNDThe workspace does not exist
404WABA_NOT_FOUNDThe workspace has no connected WABA, or wabaId is not one of its own. details.available lists the ones it has
409LEGACY_PROVIDERThe workspace sends WhatsApp through MessageBird. Its templates are deleted in MessageBird
409WHATSAPP_TOKEN_INVALIDThe WABA's access token expired or was revoked, or Platica has none that works. Reconnect the account in Platica
409WHATSAPP_PERMISSION_DENIEDThe WABA's token is missing a permission. Reconnect the account accepting all the WhatsApp permissions and check in Meta Business Manager that the app still has access to the WABA
409WHATSAPP_ACCOUNT_RESTRICTEDMeta restricted the WABA. Check its status in WhatsApp Manager
429RATE_LIMITEDWhatsApp is rate limiting the account's template requests. Wait a few minutes and try again
502UPSTREAM_ERRORPlatica could not reach WhatsApp. Try again in a moment
503TEMPORARILY_UNAVAILABLEPlatica could not read the workspace or its WABAs. Try again in a moment
504UPSTREAM_TIMEOUTWhatsApp did not answer in time. The template may or may not have been deleted: check it with get a template before trying again

For WHATSAPP_TOKEN_INVALID, WHATSAPP_PERMISSION_DENIED, WHATSAPP_ACCOUNT_RESTRICTED, or RATE_LIMITED, check the WhatsApp account. details.metaCode contains Meta's code when available; details.upstreamMessage contains its message. Editing the template does not resolve these errors. UPSTREAM_ERROR may also include details.upstreamMessage.

{
  "code": 400,
  "error": "Bad Request - The request has validation errors",
  "details": {
    "code": "WABA_REQUIRED",
    "message": "Template \"order_update\" exists in 2 WhatsApp Business Accounts of this workspace. Send wabaId with one of them.",
    "available": ["155512345678901", "155598765432109"]
  }
}

The general error format is in Errors.

Notes

  • If the workspace has several WABAs and you do not send wabaId, Platica looks for the name in all of them and uses the only one that has it.