Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create, sync, and manage WhatsApp message templates.
BusinessAccount
const accounts = await client.businessAccounts.list(); const account = accounts.data[0]; const templates = account.templates(); // or: const templates = client.templates(account.id);
const result = await templates.list(); result.data; // Template[] // Filter by status or category const result = await templates.list({ status: 'approved' }); const result = await templates.list({ status: 'approved', category: 'MARKETING' });
approved
pending
rejected
const tpl = await templates.findByName('order_confirmation'); tpl?.isApproved; // true
const tpl = await templates.retrieve('tpl_01hx...'); tpl.name; // "order_confirmation" tpl.status; // "approved" tpl.language; // "en_US" tpl.category; // "UTILITY"
const tpl = await templates.create({ name: 'order_confirmation', category: 'UTILITY', language: 'en_US', components: [ { type: 'BODY', text: 'Your order {{1}} has been confirmed.', }, ], }); tpl.status; // "pending" (awaiting Meta approval)
const result = await templates.sync(); result.data; // Template[]
const clone = await templates.clone('tpl_01hx...'); clone.name; // "order_confirmation_copy"
const msg = await templates.sendTest('tpl_01hx...', { to: '+33699887766', variables: ['ORDER-123'], }); msg.status; // "queued"
await templates.delete('tpl_01hx...'); // true
id
metaTemplateId
name
category
UTILITY
MARKETING
AUTHENTICATION
status
language
en_US
headerType
TEXT
IMAGE
VIDEO
DOCUMENT
components
rejectionReason
tpl.isApproved; // true tpl.isPending; // false tpl.isRejected; // false