Create and Manage Templates
Authentication Templates
Starting May 29, 2023, all newly created authentication templates must
be authentication templates with one-time password buttons.
Starting June 1, 2023 for Cloud API and July 11, 2023 for On-Premises API v2.49 or
later, attempting to send an existing authentication template will return error
code 100 or 1009, respectively, if:
• supplied variable values exceed 15 characters
• supplied variable values contain links or emojis
• the template body text component contains a link
Starting October 2, 2023, any existing authentication template that is not
an authentication template with a one-time password button cannot be sent,
edited, or appealed.
Templates are used when sending template messages with either the Cloud API,
hosted by Meta, or the On-Premises API. Cloud API reviews templates and variable
parameters using machine learning to protect the security and integrity of Cloud API
services. When Cloud API reviews templates and variable text, no information is
shared with WhatsApp.
Templates can be created using the Business Management API or the WhatsApp
Business Manager. The number of templates a WhatsApp Business Account can
have is determined by its parent business. If a parent business is unverified, each of
its WhatsApp Business Accounts is limited to 250 templates. However, if the parent
business is verified and at least one of its WhatsApp Business Accounts has a
business phone number with an approved display name, each of its WhatsApp
Business Accounts can have up to 6,000 templates.
Before You Start
You will need:
• A System User access token that is linked to the business
• The whatsapp_business_management permission
• The WhatsApp Business Account ID for the business
• The media asset handle for any document, image, or video file to be used in a
media template. To get a media asset handle you must upload the media
asset using the Resumable Upload API.
Limitations
• The message template name field is limited to 512 characters.
• The message template content field is limited to 1024 characters.
• A template can only be edited when it is in a state of Approved, Rejected,
or Paused. A template can be edited once per day, up to 10 times per month.
• WhatsApp Business Accounts can only create 100 message templates per
hour.
Localization
You can add a message template in a specific language when creating a template.
These templates count against your limit. Be consistent when providing
translations. See the Why am I seeing 'structure unavailable' errors in my
callback? help center article for more information.
Creating Templates
Send a POST request to the WhatsApp Business Account > Message
Templates endpoint to create a template. You can also create templates manually
using the WhatsApp Manager > Account tools > Message templates panel.
Request Syntax
POST /<WHATSAPP_BUSINESS_ACCOUNT_ID>/message_templates
Post Body
"name": "<NAME>",
"category": "<CATEGORY>",
"allow_category_change": "<ALLOW_CATEGORY_CHANGE>",
"language": "<LANGUAGE>",
"components": [<COMPONENTS>]
}
Properties
Placeholder Description Sample Value
Optional.
Set to true to allow us to
assign a category based
<ALLOW_CATEGORY_CHANGE> on our template
guidelines and the true
Boolean template's contents.
This can prevent your
template from being
rejected for
miscategorization.
See Categories below.
Required.
<CATEGORY>
UTILITY
Enum Template category.
See Categories below.
Required.
<COMPONENTS>
See Components below.
Array of objects Components that make
up the template.
See Components below.
Required.
<LANGUAGE>
en_US
Enum Template language and
locale code.
<NAME> Required.
order_confirmation
String
Placeholder Description Sample Value
Template name.
Maximum 512
characters.
Categories
Templates must be categorized. The category you select at the time of template
creation will be validated during template review. Templates will be rejected if there
is a mismatch between the selected category and the category we determine based
on template content.
Refer to our Template Categorization document to learn how we categorize
templates and how to select the right category when creating your templates to
avoid potential template rejection.
Templates support the following categories:
• AUTHENTICATION
• MARKETING
• UTILITY
You can include the allow_category_change property set to true in your template
creation POST body to have us categorize your template based on its content and
our template categorization guidelines automatically. This can prevent your
template from being rejected for miscategorization.
Templates can be used to open conversations and their categories factor into
pricing. See Pricing.
Components
Templates are composed of various text, media, and interactive components, based
on your business needs. When creating a template, define its components by
assigning an array of component objects to the components property in the body of
the request.
For example, here's an array containing a text body component with two variables
and sample values, a phone number button component, and a URL
button component:
"type": "BODY",
"text": "Thank you for your order, {{1}}! Your confirmation number is {{2}}. If you
have any questions, please use the buttons below to contact support. Thank you for
being a customer!",
"example": {
"body_text": [
"Pablo","860198-230332"
},
"type": "BUTTONS",
"buttons": [
"type": "PHONE_NUMBER",
"text": "Call",
"phone_number": "15550051310"
},
"type": "URL",
"text": "Contact Support",
"url": "https://www.luckyshrub.com/support"
Refer to the Template Components document for a list of all possible components
and their requirements as well as samples and example queries.
Note that templates categorized as AUTHENTICATION have unique component
requirements. See Authentication Templates.
Example Request
Here's an example request to create a seasonal promotion template composed of
the following components:
• a text header
• a text body
• a footer
• two quick-reply buttons
For additional examples, see Example Requests.
curl 'https://graph.facebook.com/v17.0/102290129340398/message_templates' \
-H 'Authorization: Bearer EAAJB...' \
-H 'Content-Type: application/json' \
-d '
"name": "seasonal_promotion",
"language": "en_US",
"category": "MARKETING",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "Our {{1}} is on!",
"example": {
"header_text": [
"Summer Sale"
},
"type": "BODY",
"text": "Shop now through {{1}} and use code {{2}} to get {{3}} off of all
merchandise.",
"example": {
"body_text": [
"the end of August","25OFF","25%"
},
"type": "FOOTER",
"text": "Use the buttons below to manage your marketing subscriptions"
},
{
"type":"BUTTONS",
"buttons": [
"type": "QUICK_REPLY",
"text": "Unsubscribe from Promos"
},
"type":"QUICK_REPLY",
"text": "Unsubscribe from All"
}'
On success, the API responds with your newly created template ID and information
about its approval status. For example:
"id": "594425479261596",
"status": "PENDING",
"category": "MARKETING"
Sending Templates
Use the Cloud API or On-Premises API to send a template in a template message.