Update a template

SDK platic.whatsapp.templates.update()

Edit the components, category, or both for one language version. Meta reviews the edit, and the template cannot be sent until approved again.

If your credential covers several workspaces, add ?workspace=<id> (list workspaces); without it the answer is 400.

Example

await platic.whatsapp.templates.update("order_update", {
  components: [{ type: "BODY", text: "Your order {{1}} has shipped.", example: { body_text: [["1001"]] } }],
});

Path parameters

ParameterTypeDescriptionRequired
namestringExact name of the template✓

Request body

Send components, category or both.

{
  "language": "es_MX",
  "components": [
    {
      "type": "BODY",
      "text": "Hi {{1}}, your order {{2}} is waiting for you at the store.",
      "example": { "body_text": [["Ana", "A-1024"]] }
    },
    { "type": "FOOTER", "text": "Acme" }
  ]
}
ParameterTypeRequiredDescription
componentsarray—All the components, from 1 to 20, in the format of create a template. They replace the current ones
categorystring—New category: MARKETING, UTILITY or AUTHENTICATION
languagestring—The language version to edit, such as es_MX. Needed if the template exists in several languages
wabaIdstring—The template's WABA. Needed only if the same name exists in several WABAs of the workspace

You can also send language and wabaId in the query (?language=, ?wabaId=). If the query and body both include them, the body takes priority. language selects a version; it does not change its language.

Change only the category

Send category alone to reuse the current components. For authentication templates, carousels, or image, video, or document headers, send components too. Omitting them returns 400 COMPONENTS_REQUIRED.

Response

{
  "status": "success",
  "message": "Template updated and sent back to Meta's review",
  "data": {
    "name": "order_update",
    "category": "UTILITY",
    "status": "PENDING",
    "language": "es_MX",
    "components": [
      {
        "type": "BODY",
        "text": "Hi {{1}}, your order {{2}} is waiting for you at the store.",
        "example": { "body_text": [["Ana", "A-1024"]] }
      },
      { "type": "FOOTER", "text": "Acme" }
    ],
    "source": "meta",
    "content": "Hi {{1}}, your order {{2}} is waiting for you at the store.",
    "params": ["Ana", "A-1024"],
    "header": { "type": "none", "requiresMedia": false },
    "footer": "Acme",
    "buttons": [],
    "id": "1234567890123456",
    "api_example": {
      "name": "order_update",
      "params": ["Ana", "A-1024"]
    },
    "dynamicButtonsCount": 0,
    "wabaId": "155512345678901",
    "workspaceId": "K7u9rQ2LmZx18BvC5tNd",
    "nextStep": "The edit goes back to Meta's review; the template cannot be sent until it is APPROVED again. Check its status with GET /v1/whatsapp/templates/order_update and, once it is APPROVED, send it with POST /v1/messages/template."
  }
}

data is the updated version from Meta, with the fields from create a template. If Platica cannot read it after the change, it returns the previous version with the values you sent.

Errors

Statusdetails.codeWhen
400INVALID_REQUESTThe name or the body is not valid, the body has an unknown field, or it has neither components nor category. details.issues says what
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
400TEMPLATE_LANGUAGE_REQUIREDThe template exists in several languages and you did not send language. details.languages lists them
400COMPONENTS_REQUIREDYou changed only category on a template whose components cannot be resent. Send components too
400WABA_REQUIREDThe name exists in several WABAs of the workspace. details.available lists the ones that have it
400TEMPLATE_INVALIDMeta or Platica rejected the edit. 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 write permission in Conversations or Campaigns. The message is Missing conversations or 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 editing 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 edited 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
409TEMPLATE_NOT_EDITABLEMeta does not let you edit the version in its current status (PENDING, IN_APPEAL, DISABLED…): only APPROVED, REJECTED or PAUSED ones can be edited. details.status says which one it is in, if known
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 edit may or may not have been applied: check the template 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": 409,
  "error": "Conflict - The resource state conflicts with this request",
  "details": {
    "code": "TEMPLATE_NOT_EDITABLE",
    "message": "This template cannot be edited while it is PENDING: Meta only lets you edit templates that are APPROVED, REJECTED or PAUSED.",
    "status": "PENDING"
  }
}

The general error format is in Errors.

Notes

  • While Meta reviews the edit, the template cannot be sent. The template.status.updated event tells you when Meta decides; you can also check its status with get a template.
  • 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.