Enqueue Communications API Documentation
π Overview
The EnqueueCommunications API allows you to queue messages for delivery. Itβs used to schedule communications with recipient information and message content, which the system will later process and send.
π Endpoint
- URL:
https://api.wiraya.com/api/EnqueueCommunications - Method:
POST
Accepted Content Types (Request):
application/jsontext/jsonapplication/xmltext/xmlapplication/x-www-form-urlencoded
Supported Response Formats:
application/jsontext/jsonapplication/xmltext/xml
π Authentication
This API requires an API key, passed in the request header:
X-ApiKey: your_api_key_here
π₯ Request Format
{
"communications": [
{
"clientMessageId": "string",
"recipient": "string",
"content": {
"$type": "string"
}
}
]
}
π Request Fields
Field | Type | Required | Description |
|---|---|---|---|
communications | Array | Yes | List of messages to be enqueued |
clientMessageId | String | Yes | Unique message ID provided by the client |
recipient | String | Yes | The recipientβs contact details |
content | Object | Yes | The content of the message. The $type field is mandatory |
βοΈ Content Types ($type)
Each communication must define its type using the $type field. Required fields vary by type:
$type Value | Required Fields | Optional Fields |
|---|---|---|
VoiceProject | projectId (integer), placeholders (array of strings) | nextAttemptUtc (iso format date string in UTC) |
SMSProject | projectId, placeholders | nextAttemptUtc (iso format date string in UTC) |
WhatsappProject | projectId, placeholders | nextAttemptUtc (iso format date string in UTC) |
SMSFromAlpha | sender (max 11 characters), text (string) | β |
β Response
{
"results": {
"clientMessageId1": {
"trackingId": "32-character-hexadecimal-string",
"success": true,
"isTransientError": false
}
}
}
Field | Type | Description |
|---|---|---|
trackingId | String | Unique 32-character ID for the enqueued message |
success | Boolean | Indicates whether the request succeeded |
isTransientError | Boolean | Present only if success is false. true means retry is possible; false means permanent failure |
π§ Template Content Requirements
For SMSProject and WhatsappProject:
- Content (excluding placeholders) must match a pre-approved template.
- Placeholders should only be used for dynamic values (e.g., name, appointment time).
- This ensures compliance with template-based messaging rules on external platforms.
π Example Requests & Responses
VoiceProject
Request:
{
"communications": [
{
"clientMessageId": "12345",
"recipient": "46701234567",
"content": {
"$type": "VoiceProject",
"projectId": 123,
"placeholders": ["John", "Order #5678"]
}
}
]
}
Response:
{
"results": {
"12345": {
"trackingId": "abcdef1234567890abcdef1234567890",
"success": true,
"isTransientError": false
}
}
}
SMSProject
Request:
{
"communications": [
{
"clientMessageId": "12345",
"recipient": "46701234567",
"content": {
"$type": "SMSProject",
"projectId": 123,
"placeholders": ["John", "Order #5678"]
}
}
]
}
WhatsappProject
Request:
{
"communications": [
{
"clientMessageId": "67890",
"recipient": "46709876543",
"content": {
"$type": "WhatsappProject",
"projectId": 789,
"placeholders": ["Jane", "Delivery on Monday"]
}
}
]
}
SMSFromAlpha
Request:
{
"communications": [
{
"clientMessageId": "54321",
"recipient": "46705678901",
"content": {
"$type": "SMSFromAlpha",
"sender": "Wiraya",
"text": "Your verification code is 123456"
}
}
]
}
π¨ Error Handling
HTTP Status Code | Error Message | Description |
|---|---|---|
400 | Invalid input format | Malformed or missing fields in request |
401 | Invalid API Key | Missing or incorrect API key |
500 | Server error | Unexpected server-side error |
π Notes
clientMessageIdmust be unique per request to avoid duplicate sends.- When
isTransientError = true, retrying the same request may succeed. - The
$typefield is mandatory and defines how thecontentis interpreted. - The
senderfield forSMSFromAlphamust be max 11 characters.
Updated on: 04/03/2026
Thank you!
