---
agentTools:
  projectIndex: https://rampwin-api.readme.io/llms.txt
---

# Create Template

Creates a WhatsApp message template and submits it to Meta for approval.

## Endpoint

`POST /api/message-templates/official-templates`

**Base URL**

```bash URL
https://api.rampwin.com
```

***

## Description

Creates a WhatsApp message template and submits it to Meta for approval.

### Supports

* Text & media headers
* Dynamic variables
* Footer
* Buttons (URL, Phone, Quick Reply)

***

## Headers

| Header       | Type   | Required | Description                      |
| ------------ | ------ | -------- | -------------------------------- |
| Content-Type | string | Yes      | application/json                 |
| x-api-key    | string | Yes      | Your Rampwin API key             |
| Cookie       | string | Yes      | AWS load balancer session cookie |

***

## Request Body

| Field          | Type   | Required | Description            |
| -------------- | ------ | -------- | ---------------------- |
| channel\_id    | string | Yes      | WhatsApp channel ID    |
| template\_json | object | Yes      | Template configuration |

***

## Template Components

### 1. HEADER

```json
{
  "type": "HEADER",
  "format": "TEXT", 
  "text": "Payment Receipt"
}
```

**Formats Supported:**

* TEXT
* IMAGE
* VIDEO
* DOCUMENT

#### Media Header Example

```json
{
  "type": "HEADER",
  "format": "IMAGE",
  "example": {
    "header_handle": ["<header_handle_from_upload_api>"]
  }
}
```

***

### 2. BODY

```json
{
  "type": "BODY",
  "text": "Hi {{1}}, your payment of {{2}} for invoice #{{3}}",
  "example": {
    "body_text": [["John", "$150.00", "INV-4321"]]
  }
}
```

***

### 3. FOOTER

```json
{
  "type": "FOOTER",
  "text": "Keep this for your records"
}
```

***

### 4. BUTTONS

```json
{
  "type": "BUTTONS",
  "buttons": [
    {
      "type": "URL",
      "text": "View Invoice",
      "url": "https://yourapp.com/invoice/{{1}}",
      "example": ["INV-4321"]
    }
  ]
}
```

***

## Button Types

* URL
* PHONE\_NUMBER
* QUICK\_REPLY

***

## Example Request

```curl
curl --location 'https://api.rampwin.com/api/message-templates/official-templates' \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_API_KEY' \
--data '{
  "channel_id": "YOUR_CHANNEL_ID",
  "template_json": {
    "name": "payment_receipt",
    "language": "en_US",
    "category": "UTILITY",
    "components": [
      {
        "type": "HEADER",
        "format": "TEXT",
        "text": "Payment Receipt"
      },
      {
        "type": "BODY",
        "text": "Hi {{1}}, your payment of {{2}} was received.",
        "example": {
          "body_text": [["John", "$150.00"]]
        }
      },
      {
        "type": "FOOTER",
        "text": "Keep this for your records"
      }
    ]
  }
}'
```

***

## Response

### Success (200)

```json
{
  "success": true,
  "template_id": "template_abc123",
  "status": "PENDING",
  "message": "Template submitted for Meta approval"
}
```

***

### Error (400)

```json
{
  "success": false,
  "message": "Template name already exists"
}
```