Skip to main content

Send a template

import { buildTemplateSendPayload } from '@kapso/whatsapp-cloud-api';

const template = buildTemplateSendPayload({
  name: 'order_confirmation',
  language: 'en_US',
  // Optional components
  components: [
    {
      type: 'body',
      parameters: [
        { type: 'text', text: 'Ada' },
        { type: 'text', text: '#1234' }
      ]
    }
  ]
});

await client.messages.sendTemplate({
  phoneNumberId: '123',
  to: '56961567267',
  template
});
The SDK validates structures with Zod and converts your keys to snake_case for the Meta API.

Tips

  • Ensure the template name and language match what’s approved in your WABA.
  • Provide parameters in the same order they appear in the template body and buttons.
I