BusinessAccount or directly via the client.
List templates
approved, pending, rejected.
Documentation Index
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 or directly via the client.
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
| Property | Type | Description |
|---|---|---|
id | string | WhatsRB template ID |
metaTemplateId | string | Meta template ID |
name | string | Template name |
category | string | UTILITY, MARKETING, AUTHENTICATION |
status | string | approved, pending, rejected |
language | string | Language code (e.g. en_US) |
headerType | string | TEXT, IMAGE, VIDEO, DOCUMENT |
components | unknown[] | Template components |
rejectionReason | string | Reason if rejected |
tpl.isApproved; // true
tpl.isPending; // false
tpl.isRejected; // false
