Experia Docs

Send Message API Documentation

Overview

The /v2/send endpoint allows you to send messages through various channels, supporting both direct messages and template-based messages. It supports attachments, variable substitution via templates, and advanced message customization.

Note:
Each successful call to /v2/send will return a unique message key for the sent message. Any updates regarding the status or delivery of that message (such as delivered, failed, read, etc.) will be sent asynchronously to your webhook endpoint.
See Webhook Documentation for details on webhook payloads and message status updates.


Endpoint

  • Method: POST
  • Path: /v2/send
  • Content-Type: multipart/form-data

Form Fields

FieldTypeRequiredDescription
messagestringNo*Message text. Required unless using tempMsgID with template auto-fill
messageTypestringYesType of message (e.g., "whatsapp", etc.)
tempMsgIDstringNoTemplate message ID. If provided, can auto-fill json and message
usernamestringNoUsername of the sender
jsonstringNo*JSON payload for advanced/template messages. Required unless using tempMsgID
paramsstringNoComma-separated values to substitute template variables ({{N}}) in json/message
attachmentListfile[]NoOne or more files to attach to the message

* Either message or json must be provided unless tempMsgID is used to auto-fill them.


Validation & Business Rules

  • If tempMsgID is present and both json and message are missing, the handler will retrieve them from the template.
  • If the template contains variables ({{N}}), the params field must be provided. The number of params must match the number of unique variables in the template.
  • Each {{N}} in the template will be replaced by the corresponding value from params (in order).
  • If the number of params does not match the number of variables, the request will be rejected.
  • Attachments are supported via the attachmentList field (multiple files allowed).
  • messageOutKey is auto-generated for each message.
  • All form fields are sent as part of a multipart/form-data request.

Example Requests

1. Simple Direct Message - WhatsApp

Form Data:

  • message: Hello, this is a direct message!
  • messageType: whatsapp
  • username: 966500000000

2. Template Message with Variable Substitution - WhatsApp

Form Data:

  • tempMsgID: TEMPLATE_ID
  • params: John,ORD-12345
  • messageType: whatsapp
  • username: 966500000000

Behavior: The handler will fetch the template by tempMsgID, substitute {{1}} with "John" and {{2}} with "ORD-12345" in the template's JSON/message, and send the result.

3. Message with Attachments - WhatsApp

Form Data:

  • message: Here is your document.
  • messageType: whatsapp
  • username: 966500000000
  • attachmentList: [file1.pdf, file2.jpg]

4. direct Message For instagram

Form Data:

  • message: Hello, this is a direct message!
  • messageType: instagram
  • username: instagram_user
  • attachmentList: [image1.jpg, video1.mp4]

Error Handling

  • 400 Bad Request:
    • Failed to parse multipart form data
    • Params count does not match number of variables in template
  • 500 Internal Server Error:
    • Failed to retrieve template by tempMsgID
    • Failed to marshal or process data
  • 502 Bad Gateway:
    • Failed to call upstream service

References

On this page