Skip to main content

Messages API

Send, receive, and manage messages across channels (WhatsApp, Messenger, Telegram, etc.) with the Messages API endpoints.


Endpoints

1. Send WhatsApp Text Message

POST /v1/messages/whatsapp/sendtext

  • Description: Send a WhatsApp text message to a contact or direct phone number.
  • Authentication: Requires x-api-key header.

Request Body: WhatsAppTextMessageRequest (application/json)

Required Fields:

  • Either contact (existing WhautoChat contact with id) or recepient (object with phoneNumber).
  • workspace: The workspace object.
  • textMessage: The message text.
  • scheduleDateTime: (optional) Scheduled send time.

Note: You must provide either contact or recepient, not both. If using contact, provide the contact's id. If using recepient, provide the phoneNumber.

Response: [200 OK] - MessageResponse


2. Send WhatsApp Media Message

POST /v1/messages/whatsapp/sendmedia

  • Description: Send a WhatsApp media message to a contact.
  • Authentication: Requires x-api-key header.

Request Body: WhatsAppMediaMessageRequest (application/json)

Required Fields:

  • Either contact (existing WhautoChat contact with id) or recepient (object with phoneNumber).
  • workspace: The workspace object.
  • mediaUrl: The media file URL.
  • mimeType: The media file MIME type.
  • scheduleDateTime: (optional) Scheduled send time.

Response: [200 OK] - MessageResponse


3. Send WhatsApp Template Message

POST /v1/messages/whatsapp/sendtemplate

  • Description: Send a WhatsApp template message to a contact.
  • Authentication: Requires x-api-key header.

Request Body: WhatsAppTemplateMessageRequest (application/json)

Required Fields:

  • Either contact (existing WhautoChat contact with id) or recepient (object with phoneNumber).
  • workspace: The workspace object.
  • template: The template object identifying the approved WhatsApp template (name and language).

Template Parameters:

The following optional parameters are provided at the root level of the request body to populate the template's dynamic components:

ParameterTypeDescription
templateobjectThe approved WhatsApp template to send, identified by name and language.
headerMediaUrlstringURL of the media (image, video, or document) used in the template header.
headerTextParametersstring[]Values that replace the placeholders in the template header text.
bodyTextParametersstring[]Values that replace the placeholders in the template body text.
buttonUrlParametersstring[]Values appended to dynamic URL buttons defined in the template.
locationParametersobjectLocation details (latitude, longitude, address, name) for a location header.
flowParametersobjectFlow details (flowToken, flowData) for a template that triggers a WhatsApp Flow.

Response: [200 OK] - MessageResponse


4. Send Messenger Text Message

POST /v1/messages/messenger/sendtext

  • Description: Send a Messenger text message to a contact.
  • Authentication: Requires x-api-key header.

Request Body: TextMessageRequest (application/json)

Response: [200 OK] - MessageResponse


5. Send Messenger Media Message

POST /v1/messages/messenger/sendmedia

  • Description: Send a Messenger media message to a contact.
  • Authentication: Requires x-api-key header.

Request Body: MediaMessageRequest (application/json)

Response: [200 OK] - MessageResponse


6. Send Messenger Template Message

POST /v1/messages/messenger/sendtemplate

  • Description: Send a Messenger template message to a contact.
  • Authentication: Requires x-api-key header.

Request Body: MessengerTemplateMessageRequest (application/json)

Response: [200 OK] - MessageResponse


7. Send Instagram Text Message

POST /v1/messages/instagram/sendtext

  • Description: Send an Instagram text message to a contact.
  • Authentication: Requires x-api-key header.

Request Body: TextMessageRequest (application/json)

Response: [200 OK] - MessageResponse


8. Send Instagram Template Message

POST /v1/messages/instagram/sendtemplate

  • Description: Send an Instagram template message to a contact.
  • Authentication: Requires x-api-key header.

Request Body: InstagramTemplateMessageRequest (application/json)

Response: [200 OK] - MessageResponse


9. Send Telegram Template Message

POST /v1/messages/telegram/sendtemplate

  • Description: Send a Telegram template message to a contact.
  • Authentication: Requires x-api-key header.

Request Body: TelegramTemplateMessageRequest (application/json)

Response: [200 OK] - MessageResponse


Schemas

TextMessageRequest Schema

{
"contact": { "id": "string" },
"workspace": { "id": "string" },
"textMessage": "string",
"scheduleDateTime": "string"
}

WhatsAppTextMessageRequest Schema

{
// Option 1: Use contact
"contact": { "id": "string" },
// Option 2: Use recepient
// "recepient": { "phoneNumber": "string" },
"workspace": { "id": "string" },
"textMessage": "string",
"scheduleDateTime": "string"
}

You must provide either contact (with id) or recepient (with phoneNumber). Do not provide both.

WhatsAppMediaMessageRequest Schema

{
// Option 1: Use contact
"contact": { "id": "string" },
// Option 2: Use recepient
// "recepient": { "phoneNumber": "string" },
"workspace": { "id": "string" },
"mediaUrl": "string",
"mimeType": "string",
"scheduleDateTime": "string"
}

You must provide either contact (with id) or recepient (with phoneNumber). Do not provide both.

WhatsAppTemplateMessageRequest Schema

{
// Option 1: Use contact
"contact": { "id": "string" },
// Option 2: Use recepient
// "recepient": { "phoneNumber": "string" },
"workspace": { "id": "string" },
"template": {
"name": "text",
"language": "text"
},
"headerMediaUrl": "text",
"headerTextParameters": [
"text"
],
"bodyTextParameters": [
"text"
],
"buttonUrlParameters": [
"text"
],
"locationParameters": {
"latitude": 1,
"longitude": 1,
"address": "text",
"name": "text"
},
"flowParameters": {
"flowToken": "text",
"flowData": "text"
}
}

You must provide either contact (with id) or recepient (with phoneNumber). Do not provide both.

MessengerTemplateMessageRequest Schema

{
"contact": { "id": "string" },
"workspace": { "id": "string" },
"elements": [ { "buttons": [], "title": "string" } ]
}

InstagramTemplateMessageRequest Schema

{
"contact": { "id": "string" },
"workspace": { "id": "string" },
"elements": [ { "buttons": [], "title": "string" } ]
}

TelegramTemplateMessageRequest Schema

{
"contact": { "id": "string" },
"workspace": { "id": "string" },
"buttons": [],
"textMessage": "string"
}

MediaMessageRequest Schema

{
"contact": { "id": "string" },
"workspace": { "id": "string" },
"mediaUrl": "string",
"mimeType": "string",
"scheduleDateTime": "string"
}

MessageResponse Schema

{
"id": "string",
"status": "string",
"error": "string"
}