WhatsApp templates
Official Cloud API only. Setup: setup.
Steps
- Ask what the message is for, then pick the category honestly:
- UTILITY: about an existing order, booking or account (shipping update, reminder)
- MARKETING: anything promotional; Meta re-categorises promotional utility drafts
- AUTHENTICATION: one-time passcodes only
- Create a folder and skeleton:
node scripts/templates.mjs --init --dir wa-tpl-<name> --name <name> - Edit
template.json: body text with{{1}},{{2}}variables in order, an example value for every variable, optional header, footer and buttons. Apply socialkit-social-core voice. - Validate:
node scripts/templates.mjs --check --dir wa-tpl-<name>and fix every error. - Stop. Show the template and ask the user to run, in their own terminal:
node scripts/templates.mjs --approve --dir wa-tpl-<name> - Submit:
node scripts/templates.mjs --submit --dir wa-tpl-<name> - Check review status later:
node scripts/templates.mjs --status --name <name>
Output contract
template.json, the check report, and after submission the template id and status.
Failure handling
APPROVAL_REQUIRED: the template changed or was never approved; ask again.- REJECTED status: show
rejected_reason, revise, and go through approval again. - Error 100 with subcode 2388024: a template with this name and language exists; pick a new name.
