Skip to content
Last updated

WhatsApp Templates

WhatsApp Templates are pre-approved message formats required for sending business-initiated WhatsApp messages.

This page explains what WhatsApp Templates are, how they work in InstaMessage, how placeholders map to parameters, and how to send a template message via the API.


What is a WhatsApp Template?

A WhatsApp Template is a structured message that must be:

  • Created in advance
  • Submitted to Meta for approval
  • Categorised (Marketing, Utility, Authentication)

Template categories are defined by Meta and determine how messages are classified and billed.

Once a customer replies, a 24-hour customer service window opens and you may send free-form messages without templates.


When are templates required?

ScenarioTemplate required
Business sends first message✅ Yes
Customer replies (within 24h)❌ No
Sending marketing notifications✅ Yes
Transactional updates (outside 24h window)✅ Yes

If you attempt to send a free-form WhatsApp message outside the 24-hour window, the API will return an error.


Creating WhatsApp Templates

You can create and manage WhatsApp Templates in InstaMessage from the Template screen.

You can:

  • Create new Templates
  • Define placeholder variables
  • Choose a category
  • Submit templates for Meta approval
  • View approval status

Template creation is handled in the UI rather than via the API.


Template placeholders

Templates may contain numbered placeholders, for example:

Hi {{1}}, your order {{2}} has been confirmed.

Key rules:

  • Placeholders are positional
  • They are numbered starting from {{1}}
  • The order matters

Template parameters (API)

When sending a Template message via the API, you must supply a parameters array.

Parameters:

  • Are ordered
  • Must match the placeholders exactly
  • Are mapped by position, not name

Mapping placeholders to parameters

Template:

Hi {{1}}, your order {{2}} has been confirmed.

API parameters:

"parameters": ["Alex", "12345"]

Resulting message:

Hi Alex, your order 12345 has been confirmed.


Sending a WhatsApp Template message

WhatsApp Templates are sent using the unified Messages API.

Endpoint

POST https://api.instamessage.co.uk/v1/messages

If a WhatsApp Journey sends the first message in a conversation, that message must also be a Template.


Required fields for template messages

FieldDescription
channelMust be "whatsapp"
toRecipient number in E.164 format
message_typeMust be "template"
template_idApproved template id
template_parametersOrdered array of values

Example — WhatsApp Template message

curl -X POST "https://api.instamessage.co.uk/v1/messages" \
  -H "Authorization: Bearer $IM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "whatsapp",
    "to": "+447123456789",
    "message_type": "template",
    "template": {
      "id": "PfjZ****************",
      "parameters": ["Alex", "12345"]
    }
  }'

Templates vs injected_fields

FeatureTemplate parametersinjected_fields
Used with WhatsApp Templates✅ Yes❌ No
Ordered values✅ Yes❌ No
Stored on contact❌ No❌ No
Used in free-form messages❌ No✅ Yes
Requires Meta approval✅ Yes❌ No

injected_fields cannot be used inside WhatsApp Templates.


Common template errors

Missing parameters

{
  "error": "missing_template_parameters",
  "message": "Template requires 2 parameters but only 1 was provided"
}

Template not approved

{
  "error": "template_not_approved",
  "message": "The template 'order_confirmation' is not approved"
}

Key points to remember

  • Templates are mandatory for business-initiated WhatsApp messages
  • Placeholders are positional, not named
  • Parameters must be supplied in the correct order
  • Free-form WhatsApp messages are only allowed inside the 24-hour window
  • Templates are created and approved in the UI, not via API

Next steps

WhatsApp Templates ensure compliance with Meta policies while enabling reliable, scalable outbound messaging.