Pular para o conteúdo

Edit a template on Meta

PATCH
/v1/templates/{id}
curl --request PATCH \
--url https://seu-endereco-da-api/v1/templates/example \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "category": "MARKETING", "components": [ {} ] }'

Sends the new components (and category) to Meta. Meta edits only APPROVED, REJECTED or PAUSED templates, never changes the name or the language, never changes the category of an APPROVED one, and edits an APPROVED template at most once a day and 10 times in 30 days. The template goes back to review with the status Meta reports.

Permissão que a Chave de acesso precisa: Gerenciar modelos e formulários (templates:manage).

id
required
string
Media typeapplication/json
object
category

The new category; Meta changes it only on a template that is not APPROVED

string
Allowed values: MARKETING UTILITY AUTHENTICATION
components
required

The whole new set of components, which replaces the current one. MARKETING and UTILITY take exactly one BODY { type, text, examples? } (up to 1024 characters, {{1}}, {{2}}… numbered from 1, examples is an array with one sample text per variable), an optional HEADER, an optional FOOTER { type, text } (up to 60 characters, no variable) and an optional BUTTONS { type, buttons }. HEADER is { type, format: “TEXT”, text, example? } (up to 60 characters, at most one variable, example is one text) or { type, format: “IMAGE” | “VIDEO” | “DOCUMENT” } with exactly one of: mediaUrl (a public https link to the file, downloaded and sent to Meta by the server), mediaId (a WhatsApp media id of the number, downloaded from Meta) or handle (a Meta upload handle, which may come with the mediaKey and mediaMime the media upload returned). IMAGE takes jpeg or png up to 5 MB, VIDEO mp4 up to 16 MB, DOCUMENT pdf up to 100 MB. BUTTONS takes 1 to 10 buttons, QUICK_REPLY grouped together: QUICK_REPLY { type, text }, URL { type, text, url, example? } (at most 2; a {{1}} goes at the end of the url and example is one text with the full URL, e.g. “https://loja.com/pedido/123”), PHONE_NUMBER { type, text, phoneNumber } (at most 1), COPY_CODE { type, example } (coupon code up to 15 characters, at most 1) and FLOW { type, text, flowId | flowName, flowAction?: “navigate” | “data_exchange”, navigateScreen? } (a published WhatsApp Flow, at most 1); button text up to 25 characters. Payment buttons stand alone: 1 to 3 PAYMENT_REQUEST { type, method: “pix” | “boleto” | “payment_link” } with distinct methods, or exactly one ORDER_DETAILS { type, text } (1 to 25 characters), in a UTILITY or MARKETING template with a NONE or TEXT header; an ORDER_DETAILS template is submitted with display_format ORDER_DETAILS. CAROUSEL { type, cards } turns the template into a carousel: only BODY and CAROUSEL, 2 to 10 cards, each { mediaFormat: “IMAGE” | “VIDEO”, mediaUrl | mediaId, body?, bodyExamples?, buttons } with a body up to 160 characters, 1 or 2 buttons, the same media format on every card and the same buttons, in the same order and of the same types, on every card. AUTHENTICATION takes { type: “BODY”, addSecurityRecommendation? } (Meta writes the text with the code), an optional { type: “FOOTER”, codeExpirationMinutes } (1 to 90) and { type: “BUTTONS”, buttons: [{ type: “OTP”, otpType: “COPY_CODE”, text? }] }, without header. A component outside these formats comes back as 400 with what is wrong and the right format, before anything goes to Meta.

Array<object>
object