UC-006 — WhatsApp Template Lifecycle
- Goal
- Manage the full WhatsApp template lifecycle: creation, Meta approval, use in a campaign, editing, deletion
- Channel
- Estimated time
- 25 minutes
Real-world scenarios
- TechStore — Welcome template: The CRM team creates a template to greet new customers with a personalized message, discount code and action buttons.
- FashionOutlet — Marketing promo with tracked links: A promotional template with tracked clickable links to measure Black Friday campaign conversions.
- Studio Dentistico Bianchi — Appointment reminder with buttons: A UTILITY template with buttons to confirm, reschedule or call the office directly.
Prerequisites
Before you begin, make sure you have:
- Active API Key → How to get one
- Sufficient credit → Check in the Qlara Dashboard
- WhatsApp Business number of your account: its
idis thephoneNumberIdof a template and thewhatsappPhoneNumberIdof a campaign (see UC-005)
Campaigns have no simulation mode, but nothing is sent and no credit is used until you confirm one: the campaign of Step 4 stays a draft.
Template lifecycle
Meta approval can take from a few minutes up to 24 hours. Plan template creation well in advance of your campaign.
Step-by-step guide
Step 1 — Create a template
Create a welcome template with a text header, body with placeholders, footer and buttons:
curl -X POST "https://api.qlara.ai/api/message-server/whatsapp/templates?phoneNumberId=5" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "benvenuto_nuovo_cliente",
"lang": "it",
"category": "MARKETING",
"headerText": "Benvenuto in TechStore!",
"body": "Ciao {firstName}, siamo felici di averti con noi! Scopri le offerte riservate ai nuovi clienti e approfitta del codice sconto {codiceSconto} valido fino al {dataScadenza}.",
"footer": "TechStore - Tecnologia per tutti",
"buttons": [
{
"type": "URL",
"text": "Vai alle offerte",
"url": "https://techstore.it/offerte-benvenuto"
},
{
"type": "PHONE_NUMBER",
"text": "Chiamaci",
"phoneNumber": "+390212345678"
},
{
"type": "QUICK_REPLY",
"text": "Non mi interessa"
}
]
}'
Available categories:
| Category | When to use | Examples |
|---|---|---|
MARKETING | Promotions, offers, newsletters | Sales, new products, events |
UTILITY | Transactional communications | Order confirmation, tracking, reminders |
AUTHENTICATION | Identity verification | OTP, verification codes |
Placeholders must be contact fields: standard ones such as {firstName}, {lastName} or {city}, or the custom contact fields defined for your account, like codiceSconto and dataScadenza here. Tracked links use {shortLinkT1}–{shortLinkT4}. Any other name is rejected with 400 and INVALID_PLACEHOLDER.
Step 1b — Template with image header and tracked links
curl -X POST "https://api.qlara.ai/api/message-server/whatsapp/templates?phoneNumberId=5" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "promo_primavera_2026",
"lang": "it",
"category": "MARKETING",
"headerFormat": "IMAGE",
"headerMediaUrl": "https://cdn.techstore.it/img/promo-primavera.jpg",
"body": "Ciao {firstName}, i saldi di primavera sono arrivati! Fino al 30% di sconto su tutta la collezione. Clicca qui {shortLinkT1} per scoprire le offerte.",
"footer": "Offerta valida fino al 30 aprile 2026",
"placeholderFields": {
"WHATSAPP": {
"shortLinkT1": "https://techstore.it/saldi-primavera"
}
}
}'
When a campaign sends the template, the {shortLinkT1} placeholder in the body is replaced with a tracked short link to the URL the campaign carries as shortLinkT1 in its own placeholderFields, under WHATSAPP (see Step 4). The URL saved in the placeholderFields of the template is stored with it and returned when you read it: pass it again in the campaign. To track clicks on URL buttons, add "trackButtonLinks": true.
Step 1c — Reminder template with buttons
curl -X POST "https://api.qlara.ai/api/message-server/whatsapp/templates?phoneNumberId=5" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "promemoria_appuntamento",
"lang": "it",
"category": "UTILITY",
"headerText": "Promemoria appuntamento",
"body": "Gentile {firstName}, le ricordiamo il suo appuntamento del {dataAppuntamento} alle ore {oraAppuntamento} presso {nomeStudio}, {indirizzo}.",
"footer": "Per modifiche, contattaci almeno 24h prima",
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Confermo"
},
{
"type": "QUICK_REPLY",
"text": "Devo spostare"
},
{
"type": "PHONE_NUMBER",
"text": "Chiama lo studio",
"phoneNumber": "+390276543210"
}
]
}'
Step 2 — Wait for Meta approval
After creation, the template enters the PENDING state. Meta reviews it to verify compliance with its policies.
Possible statuses:
| Status | Meaning |
|---|---|
PENDING | Awaiting review by Meta |
APPROVED | Approved, available for sending |
REJECTED | Rejected (check Meta guidelines): rejectedReason gives Meta's reason |
PAUSED | Paused by Meta |
DISABLED | Disabled |
FLAGGED | Negative feedback from recipients: at risk of being disabled |
REINSTATED | No longer flagged or disabled |
IN_APPEAL | Rejection under appeal |
LIMIT_EXCEEDED | The WhatsApp Business account has reached its template limit |
LOCKED | Locked: it cannot be edited |
ARCHIVED | Archived |
PENDING_DELETION, DELETED | Being deleted, deleted |
Only APPROVED templates can be sent: use one in a campaign only after Meta has approved it.
Step 3 — Check the template status
Periodically check the status:
curl -X GET "https://api.qlara.ai/api/message-server/whatsapp/templates?status=PENDING&phoneNumberId=5&page=0&limit=20" \
-H "X-Api-Key: YOUR_API_KEY"
For details on a specific template:
curl -X GET "https://api.qlara.ai/api/message-server/whatsapp/templates/142" \
-H "X-Api-Key: YOUR_API_KEY"
| Filter parameter | Description |
|---|---|
category | MARKETING, UTILITY, AUTHENTICATION; several values comma-separated |
status | One or more of the statuses above, comma-separated (e.g. PENDING,REJECTED) |
templateId | Up to 25 template IDs, comma-separated |
phoneNumberId | Filter by associated phone number |
page | Page number (0-based) |
limit | Items per page (default 10) |
The response is a page: the templates in data, plus page, limit, totalCount and totalPages.
Step 4 — Use the approved template in a campaign
Once the status is APPROVED, a campaign sends the template to your contact lists. Pass the number and the template in the same request, as whatsappPhoneNumberId and whatsappTemplateId; the URL of a tracked link of the body goes in placeholderFields, under WHATSAPP:
curl -X POST "https://api.qlara.ai/api/partner-gateway/campaigns" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Promo primavera 2026",
"sendingMode": "WHATSAPP",
"destinationType": 0,
"whatsappPhoneNumberId": 5,
"whatsappTemplateId": 142,
"contactListIds": [412],
"placeholderFields": {
"WHATSAPP": {
"shortLinkT1": "https://techstore.it/saldi-primavera"
}
}
}'
Response: 201 Created with the campaign in DRAFT status. Nothing is sent yet: mark the campaign as ready, check its price and confirm it as shown in UC-008: Bulk WhatsApp Template Campaign.
The campaign carries no value per recipient: {firstName} and the other contact fields of the template are filled in for every recipient from the contact in the list. The campaign does not check the approval status either, so a template that is still PENDING or was REJECTED is accepted here: check its status (Step 3) before you confirm.
For templates with URL buttons and tracking enabled, add "trackButtonLinks": true when creating the template. The system will automatically generate a tracked link for each URL button.
Step 5 — Update a template
Edit an existing template with PATCH. The template will return to PENDING status for a new Meta review. The request replaces the whole content: send again the body, header, footer and buttons the template must keep (and otpExpirationMinutes for an AUTHENTICATION template), or they are removed, and "trackButtonLinks": true again to keep tracking its URL buttons. Only category and placeholderFields are kept when you leave them out:
curl -X PATCH "https://api.qlara.ai/api/message-server/whatsapp/templates/142" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"headerFormat": "IMAGE",
"headerMediaUrl": "https://cdn.techstore.it/img/promo-primavera.jpg",
"body": "Ciao {firstName}, i super saldi di primavera sono arrivati! Fino al 40% di sconto su tutta la collezione. Non perdere questa occasione!",
"footer": "Offerta valida fino al 15 maggio 2026"
}'
Response: 200 OK with the updated template, in PENDING status.
Any modification to the template resets it to PENDING status. You will need to wait for a new approval from Meta before you can use it again. Plan modifications in advance: an APPROVED template cannot be edited again within 24 hours of its last update, and its category can no longer be changed. The destinations of tracked URL buttons cannot be changed either: to change one, create a new template (see Update template).
Step 6 — Delete a template
When a template is no longer needed:
curl -X DELETE "https://api.qlara.ai/api/message-server/whatsapp/templates/142" \
-H "X-Api-Key: YOUR_API_KEY"
Template fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Template name, 3–512 characters: Meta receives it in lowercase, with every character other than letters, digits and underscores turned into _ (slug) |
lang | string | Yes | Language code (it, en, es, etc.) |
category | string | Yes | MARKETING, UTILITY, AUTHENTICATION |
body | string | Yes* | Text with {fieldName} placeholders, max 1028 characters (*not allowed for AUTHENTICATION) |
headerText | string | No | Header text, max 60 characters |
headerFormat | string | No | TEXT, or a media header: IMAGE, VIDEO, DOCUMENT |
headerMediaUrl | string | No | Media URL for the header |
headerMediaGalleryId | integer | No | Media of your media gallery for the header (alternative to headerMediaUrl) |
footer | string | No | Footer text, max 60 characters |
buttons | array | No | Interactive buttons |
otpExpirationMinutes | integer | AUTHENTICATION only | Code validity in minutes |
placeholderFields | object | No | Tracked link URLs saved with the template and returned when you read it. Pass them again in the placeholderFields of the campaign |
trackButtonLinks | boolean | No | Track clicks on URL buttons |
Button types
| Type | Fields | Description |
|---|---|---|
URL | text, url | Opens a URL in the browser |
PHONE_NUMBER | text, phoneNumber | Initiates a phone call |
QUICK_REPLY | text | Predefined quick reply |
Behind the scenes
The WhatsApp template approval flow involves both the Qlara platform and Meta:
- Creation -- The template is sent to Meta via the Business API. Meta takes it in for review.
- Meta Review -- Meta verifies that the template complies with its policies (no misleading content, spam, or terms violations). The review can be automatic (minutes) or manual (up to 24h).
- Status notification -- The Qlara platform receives the status update from Meta and makes it available through the API.
- Use -- When the template is
APPROVED, a campaign can send it to contacts who have not written to you, outside the 24h window. Placeholders are replaced for each recipient at send time. - Update -- A
PATCHmodifies the template and resubmits it to Meta. The status returns toPENDINGuntil the new approval. - Name rule -- Meta accepts only lowercase letters, numbers and underscores in the template name. The platform converts
nameinto theslugsent to Meta (lowercase, with every other character turned into_), and rejects a name that already exists on the number or that leaves no letters or digits. - Phone number association -- The
phoneNumberIdin the creation query string associates the template with a specific WhatsApp Business number. UseGET /whatsapp/phone-numbersto get the list of available numbers.
Expected result
| Aspect | Detail |
|---|---|
| Action completed | WhatsApp template created, approved by Meta, used in a campaign |
| Channel used | |
| Results | Counters of the campaign, with GET /campaigns/{id} |
Common errors
| Problem | Probable cause | Solution |
|---|---|---|
HTTP 401 | Missing or invalid API Key | Check X-Api-Key header |
Template REJECTED by Meta | Content violates Meta policies (rejectedReason gives Meta's reason) | Review Meta guidelines; avoid aggressive language, misleading content, or missing opt-out |
HTTP 400 — TEMPLATE_NAME_ALREADY_EXISTS or INVALID_TEMPLATE_NAME | The converted name already exists on the number, or has no letters or digits | Choose another name |
HTTP 400 — INVALID_PLACEHOLDER | A placeholder is not a contact field of your account | Use contact fields, or {shortLinkT1}–{shortLinkT4} for tracked links |
HTTP 429 | The template limit of your subscription is reached | Delete unused templates or upgrade the subscription |
Template stuck in PENDING | Meta review taking longer than expected | Wait up to 24 hours; if still pending, check Meta Business Manager for details |
HTTP 400 on POST /campaigns | whatsappTemplateId sent without whatsappPhoneNumberId, an AUTHENTICATION template, or a media header with no uploaded media | Send the number and the template in the same request, and use a MARKETING or UTILITY template |
HTTP 404 on POST /campaigns | whatsappTemplateId is not a template of your account ("Resource not found."), or whatsappPhoneNumberId is not a number of your account ("WhatsApp phone number not found") | Take the ids from GET /whatsapp/templates and GET /whatsapp/phone-numbers |
Next steps
- WhatsApp Templates Guide -- Complete reference on WhatsApp templates
- UC-008: Bulk WhatsApp Template Campaign -- Send the approved template to a contact list
- UC-007: Templates with Tracked Links -- Track the clicks on the buttons of a template
- UC-003: RCS Template Workflow -- Compare with the RCS template flow (no external approval)
- UC-015: Two-Way Conversation -- Handle replies to sent templates