π 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/json
text/json
application/xml
text/xml
application/x-www-form-urlencoded
Supported Response Formats:
application/json
text/json
application/xml
text/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 |
βοΈ Content Types ($type
)
Each communication must define its type using the $type
field. Required fields vary by type:
| Required Fields |
|
|
|
|
|
|
|
|
β 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. |
π§ 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
clientMessageId
must be unique per request to avoid duplicate sends.When
isTransientError = true
, retrying the same request may succeed.The
$type
field is mandatory and defines how thecontent
is interpreted.The
sender
field forSMSFromAlpha
must be max 11 characters.