Skip to content
Last updated

Send a Message

Use this endpoint to send text, media, or template-based messages across SMS, WhatsApp, Messenger, and RCS.

Most message types support personalisation using injected_fields, allowing you to dynamically insert values into message text.

WhatsApp Template Messages use template parameters, which must match the placeholder structure of the Meta-approved template.


Required fields

FieldDescription
channel"sms", "whatsapp", "messenger", "rcs"
toE.164 formatted number (+447...)
message_type"text", "template", "image", "video", "audio", "file", "location", "custom" (RCS rich content)
ContentDepends on message_type (e.g. text, image.url, template.parameters)

Channel rules

SMS

  • Supports text messages
  • Supports personalisation via injected_fields
  • No template approval required
  • Media not supported

WhatsApp

  • Supports text, media, and approved Templates
  • Business-initiated messages must use a WhatsApp Template
  • Free-form messages allowed only within the 24-hour customer service window
  • Supports delivered and read receipts

Messenger

  • Supports text & media
  • Business cannot initiate the conversation — the customer must message first
  • Supports read receipts

RCS

  • Supports text, image, video, file and custom (rich cards, carousels, suggested replies)
  • Templates and audio are not supported
  • Sent from your verified RCS agent; no sender field
  • Business may initiate conversations
  • See Getting Started – RCS

Examples

Example — SMS text message

curl -X POST "POST https://api.instamessage.com/v1/messages" \
  -H "Authorization: Bearer $IM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "sms",
    "to": "+447123456789",
    "message_type": "text",
    "text": "Your delivery is on its way."
  }'

SMS personalised message

{
  "channel": "sms",
  "to": "+447123456789",
  "message_type": "text",
  "text": "Hi {{name}}, your parcel {{tracking}} is out for delivery.",
  "injected_fields": {
    "name": "Alex",
    "tracking": "ZX123456"
  }
}

WhatsApp image message (free-form)

{
  "channel": "whatsapp",
  "to": "+447123456789",
  "message_type": "image",
  "image": { "url": "https://example.com/photo.jpg" }
}

Note: free-form WhatsApp messages can only be sent within the 24-hour customer session window.

WhatsApp template message (business-initiated)

{
  "channel": "whatsapp",
  "to": "+447123456789",
  "message_type": "template",
  "template": {
    "name": "order_confirmation",
    "parameters": ["Alex", "12345"]
  }
}

RCS text with suggested replies (custom)

{
  "channel": "rcs",
  "to": "+447123456789",
  "message_type": "custom",
  "custom": {
    "contentMessage": {
      "text": "Your delivery is booked for tomorrow. Does that work?",
      "suggestions": [
        { "reply": { "text": "Yes, thanks", "postbackData": "CONFIRM" } }
      ]
    }
  }
}

See Rich messages for rich cards, carousels and limits.

Messenger media message (after customer initiates)

{
  "channel": "messenger",
  "to": "+447123456789",
  "message_type": "image",
  "image": { "url": "https://example.com/menu.png" }
}

Personalisation using injected_fields

Injected fields allow you to replace placeholders inside your message text with real values at send time.

{
  "channel": "sms",
  "to": "+447123456789",
  "message_type": "text",
  "text": "Hello {{firstname}}, your booking {{bookingId}} is confirmed.",
  "injected_fields": {
    "firstname": "Sam",
    "bookingId": "BR-128547"
  }
}

WhatsApp Template Messages use template parameters, not injected_fields.

Response example

{
  "message_id": "msg_67890",
  "status": "queued",
  "created_at": "2025-06-01T14:22:00Z"
}

Common errors

  • Invalid phone number format
  • Unsupported message_type for channel
  • Messenger outbound attempted without prior inbound
  • WhatsApp free-form sent outside 24-hour window
  • Missing template parameters
  • RCS custom content breaks a rich content limit (4044)
  • Incorrect JSON structure

Next steps