Skip to main content

WhatsApp Templates

WhatsApp templates are messages pre-approved by Meta that can be sent at any time, even outside the 24-hour window. They are required to initiate a conversation with a user.

Endpoint​

MethodPathDescription
GET/api/message-server/whatsapp/templatesList templates
GET/api/message-server/whatsapp/templates/{id}Template details
POST/api/message-server/whatsapp/templates?phoneNumberId={id}Create template
PATCH/api/message-server/whatsapp/templates/{id}Update template
DELETE/api/message-server/whatsapp/templates/{id}Delete template

The phoneNumberId query parameter in the creation request specifies which WhatsApp Business number to associate the template with.

Template creation fields​

FieldTypeReq.Description
namestringYesTemplate name (snake_case, lowercase letters, numbers, and underscores only)
langstringYesLanguage code (e.g. it, en, es)
categorystringYesCategory: MARKETING, UTILITY, AUTHENTICATION
bodystringYesBody text with placeholders {placeholderName}
headerTextstringNoHeader text (exclusive with headerFormat)
headerFormatstringNoMedia header format: IMAGE, VIDEO, DOCUMENT
headerMediaUrlstringNoMedia URL for the header
footerstringNoFooter text
buttonsarrayNoList of interactive buttons
placeholderFieldsobjectNoTracked link definition
trackButtonLinksbooleanNoTrack clicks on URL buttons

Categories​

CategoryWhen to useExamples
MARKETINGPromotions, offers, newslettersSales, new products, events
UTILITYTransactional communicationsOrder confirmation, tracking, reminders
AUTHENTICATIONIdentity verificationOTP, verification codes

Template statuses​

StatusMeaning
APPROVEDApproved by Meta, available for sending
PENDINGAwaiting review by Meta
REJECTEDRejected by Meta (check the guidelines)
PAUSEDPaused
DISABLEDDisabled

Buttons​

FieldTypeReq.Description
typestringYesType: URL, PHONE_NUMBER, QUICK_REPLY
textstringYesDisplayed text
urlstringURL onlyURL to open
phoneNumberstringPHONE_NUMBER onlyNumber to call

Tracked links allow you to monitor user clicks.

In the template body​

Insert the {shortLinkT1} placeholder in the text and define the actual URL in placeholderFields:

{
"body": "Ciao {firstName}, clicca qui {shortLinkT1} per la tua offerta.",
"placeholderFields": {
"WHATSAPP": {
"shortLinkT1": "https://example.com/offerta"
}
}
}

In buttons​

Add "trackButtonLinks": true to the request:

{
"buttons": [
{ "type": "URL", "text": "Apri offerta", "url": "https://example.com/offerta" }
],
"trackButtonLinks": true
}

Examples​

Simple text template​

{
"name": "marketing_Welcome",
"lang": "it",
"category": "MARKETING",
"headerText": "Welcome",
"body": "Ciao {firstName} siamo contentissimi di averti tra noi",
"footer": "Per info visita il sito"
}

Template with buttons​

{
"name": "marketing_Welcome",
"lang": "it",
"category": "MARKETING",
"headerText": "Welcome",
"body": "Ciao {firstName} siamo contentissimi di averti tra noi",
"footer": "Per info visita il sito",
"buttons": [
{ "type": "URL", "text": "Apri il sito", "url": "https://agiletelecom.com/" },
{ "type": "PHONE_NUMBER", "text": "Chiamaci", "phoneNumber": "+39 123123123" },
{ "type": "QUICK_REPLY", "text": "Voglio essere contattato" }
]
}

Template with image header​

{
"name": "marketing_Welcome",
"lang": "it",
"category": "MARKETING",
"headerFormat": "IMAGE",
"headerMediaUrl": "https://example.com/image.jpg",
"body": "Ciao {firstName} siamo contentissimi di averti tra noi",
"footer": "Per info visita il sito"
}
{
"name": "marketing_Welcome",
"lang": "it",
"category": "MARKETING",
"headerFormat": "IMAGE",
"headerMediaUrl": "https://example.com/image.jpg",
"body": "Ciao {firstName} siamo contentissimi di averti tra noi. Clicca qui {shortLinkT1} per accedere all'area riservata.",
"footer": "Per info visita il sito",
"placeholderFields": {
"WHATSAPP": {
"shortLinkT1": "https://www.example.com/landing-page"
}
}
}
{
"name": "marketing_Welcome",
"lang": "it",
"category": "MARKETING",
"headerFormat": "IMAGE",
"headerMediaUrl": "https://example.com/image.jpg",
"body": "Ciao {firstName} siamo contentissimi di averti tra noi.",
"footer": "Per info visita il sito",
"buttons": [
{ "type": "URL", "text": "Apri il sito", "url": "https://agiletelecom.com/" }
],
"trackButtonLinks": true
}

Template list filters​

ParameterDescription
categoryMARKETING, UTILITY, AUTHENTICATION
statusAPPROVED, PENDING, REJECTED, PAUSED, DISABLED
phoneNumberIdFilter by associated number
pagePage number (0-based)
limitItems per page

Updating​

With PATCH /templates/{id} you can update only the fields you want to modify. The template will return to PENDING status for re-approval by Meta.