Create Template

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

Endpoint

POST /api/message-templates/official-templates

Base 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

HeaderTypeRequiredDescription
Content-TypestringYesapplication/json
x-api-keystringYesYour Rampwin API key
CookiestringYesAWS load balancer session cookie

Request Body

FieldTypeRequiredDescription
channel_idstringYesWhatsApp channel ID
template_jsonobjectYesTemplate configuration

Template Components

1. HEADER

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

Formats Supported:

  • TEXT
  • IMAGE
  • VIDEO
  • DOCUMENT

Media Header Example

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

2. BODY

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

3. FOOTER

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

4. BUTTONS

{
  "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 --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)

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

Error (400)

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