> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kapso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Text header

> Create and send templates with text header, body, and footer

## Create

<CodeGroup>
  ```typescript Create template - TypeScript SDK icon="square-js" theme={null}
  import { WhatsAppClient } from '@kapso/whatsapp-cloud-api';

  const client = new WhatsAppClient({
    baseUrl: 'https://api.kapso.ai/meta/whatsapp',
    kapsoApiKey: process.env.KAPSO_API_KEY!
  });

  await client.templates.create({
    businessAccountId: '123456789',
    name: 'seasonal_promotion',
    category: 'MARKETING',
    language: 'en_US',
    parameterFormat: 'NAMED',
    components: [
      {
        type: 'HEADER',
        format: 'TEXT',
        text: '{{sale_name}} is here!',
        example: {
          header_text_named_params: [
            { param_name: 'sale_name', example: 'Black Friday Sale' }
          ]
        }
      },
      {
        type: 'BODY',
        text: 'Save big with code {{discount_code}}. Offer ends {{end_date}}.',
        example: {
          body_text_named_params: [
            { param_name: 'discount_code', example: 'BF2024' },
            { param_name: 'end_date', example: 'November 30th' }
          ]
        }
      },
      {
        type: 'FOOTER',
        text: 'Terms and conditions apply'
      }
    ]
  });
  ```

  ```bash Create template - REST API icon="code" theme={null}
  curl -X POST 'https://api.kapso.ai/meta/whatsapp/v24.0/123456789/message_templates' \
    -H 'X-API-Key: YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "name": "seasonal_promotion",
      "category": "MARKETING",
      "language": "en_US",
      "parameter_format": "NAMED",
      "components": [
        {
          "type": "HEADER",
          "format": "TEXT",
          "text": "{{sale_name}} is here!",
          "example": {
            "header_text_named_params": [
              { "param_name": "sale_name", "example": "Black Friday Sale" }
            ]
          }
        },
        {
          "type": "BODY",
          "text": "Save big with code {{discount_code}}. Offer ends {{end_date}}.",
          "example": {
            "body_text_named_params": [
              { "param_name": "discount_code", "example": "BF2024" },
              { "param_name": "end_date", "example": "November 30th" }
            ]
          }
        },
        {
          "type": "FOOTER",
          "text": "Terms and conditions apply"
        }
      ]
    }'
  ```
</CodeGroup>

## Send

<CodeGroup>
  ```typescript Send template - TypeScript SDK icon="square-js" theme={null}
  import { WhatsAppClient } from '@kapso/whatsapp-cloud-api';

  const client = new WhatsAppClient({
    baseUrl: 'https://api.kapso.ai/meta/whatsapp',
    kapsoApiKey: process.env.KAPSO_API_KEY!
  });

  await client.messages.sendTemplate({
    phoneNumberId: '647015955153740',
    to: '15551234567',
    template: {
      name: 'seasonal_promotion',
      language: { code: 'en_US' },
      components: [
        {
          type: 'header',
          parameters: [
            { type: 'text', parameterName: 'sale_name', text: 'Black Friday Sale' }
          ]
        },
        {
          type: 'body',
          parameters: [
            { type: 'text', parameterName: 'discount_code', text: 'BF2024' },
            { type: 'text', parameterName: 'end_date', text: 'November 30th' }
          ]
        }
      ]
    }
  });
  ```

  ```bash Send template - REST API icon="code" theme={null}
  curl -X POST 'https://api.kapso.ai/meta/whatsapp/v24.0/647015955153740/messages' \
    -H 'X-API-Key: YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "messaging_product": "whatsapp",
      "to": "15551234567",
      "type": "template",
      "template": {
        "name": "seasonal_promotion",
        "language": {
          "code": "en_US"
        },
        "components": [
          {
            "type": "header",
            "parameters": [
              { "type": "text", "parameter_name": "sale_name", "text": "Black Friday Sale" }
            ]
          },
          {
            "type": "body",
            "parameters": [
              { "type": "text", "parameter_name": "discount_code", "text": "BF2024" },
              { "type": "text", "parameter_name": "end_date", "text": "November 30th" }
            ]
          }
        ]
      }
    }'
  ```
</CodeGroup>
