> ## 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.

# Location header

> Create and send templates with location headers

## 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: 'order_delivery_update',
    category: 'UTILITY',
    language: 'en_US',
    parameterFormat: 'NAMED',
    components: [
      {
        type: 'HEADER',
        format: 'LOCATION'
      },
      {
        type: 'BODY',
        text: 'Your order {{order_number}} is on the way! Track your delivery at the location above.',
        example: {
          body_text_named_params: [
            { param_name: 'order_number', example: 'ORD-12345' }
          ]
        }
      },
      {
        type: 'FOOTER',
        text: 'Estimated delivery: 30 minutes'
      }
    ]
  });
  ```

  ```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": "order_delivery_update",
      "category": "UTILITY",
      "language": "en_US",
      "parameter_format": "NAMED",
      "components": [
        {
          "type": "HEADER",
          "format": "LOCATION"
        },
        {
          "type": "BODY",
          "text": "Your order {{order_number}} is on the way! Track your delivery at the location above.",
          "example": {
            "body_text_named_params": [
              { "param_name": "order_number", "example": "ORD-12345" }
            ]
          }
        },
        {
          "type": "FOOTER",
          "text": "Estimated delivery: 30 minutes"
        }
      ]
    }'
  ```
</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: 'order_delivery_update',
      language: { code: 'en_US' },
      components: [
        {
          type: 'header',
          parameters: [
            {
              type: 'location',
              location: {
                latitude: 37.7749,
                longitude: -122.4194,
                name: 'Delivery Location',
                address: '123 Main St, San Francisco, CA'
              }
            }
          ]
        },
        {
          type: 'body',
          parameters: [
            { type: 'text', parameterName: 'order_number', text: 'ORD-12345' }
          ]
        }
      ]
    }
  });
  ```

  ```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": "order_delivery_update",
        "language": {
          "code": "en_US"
        },
        "components": [
          {
            "type": "header",
            "parameters": [
              {
                "type": "location",
                "location": {
                  "latitude": 37.7749,
                  "longitude": -122.4194,
                  "name": "Delivery Location",
                  "address": "123 Main St, San Francisco, CA"
                }
              }
            ]
          },
          {
            "type": "body",
            "parameters": [
              { "type": "text", "parameter_name": "order_number", "text": "ORD-12345" }
            ]
          }
        ]
      }
    }'
  ```
</CodeGroup>
