Messaging API
Send Message
This endpoint allows you to send one or multiple messages (SMS or email) using a predefined template. It supports personalized payloads per recipient.
- URL:
/api/SendMessages
- Method:
POST
- Authentication: Basic Auth
- Content-Type:
application/json
Request Parameters
Field | Type | Required | Description |
---|---|---|---|
templateId | integer | ✅ Yes | ID of the SMS or email template to use. |
scheduleDate | datetime | ❌ Optional | Date/time to send the message (ISO 8601 format, e.g. 2023-06-10T10:00:00+03:00 ). |
recipients | array | ✅ Yes | List of recipient objects (see structure below). |
Each recipient object includes:
Field | Type | Required | Description |
---|---|---|---|
uniqueId | string | ✅ Yes | Unique identifier for this recipient (e.g. customer ID). Must be unique per call. |
cardNumber | string | ❌ Optional | Loyalty card number or customer code. If set, message will be recorded in CRM. |
email | string | ✔ If email | Required if sending an email. |
mobilePhone | string | ✔ If SMS | Required if sending an SMS. Must be a valid mobile number according to allowed countries list. |
payload | object | ❌ Optional | Key-value pairs for personalization tag replacement in the template. |
Sample Request - Promo Code
{
"templateId":71,
"scheduleDate":"2016-05-12T10:00:00+03:00",
"recipients":
[
{
"uniqueId":"CustomerIdA",
"email":"[email protected]",
"mobilePhone":"6936862208",
"password":"ABC123",
"payload":
{
"voucherCode": "SPRING19",
"voucherAmount": "100 €",
"expirationDate": "28/09/2019"
}
},
{
"uniqueId":"CustomerIdB",
"email":"[email protected]",
"mobilePhone":"1936862208",
"password":"XXXYYY",
"payload":
{
"voucherCode": "VIP-SALES",
"voucherAmount": "200 €",
"expirationDate": "28/09/2019"
}
}
]
}
Response Properties
Field | Type | Description |
---|---|---|
dispatch | long | Unique ID assigned to this message dispatch. |
totalRecipients | integer | Total number of recipients included in the request. |
totalRecipientsSent | integer | Number of recipients that passed validation and will receive the message. |
invalidRecipients | integer | Number of recipients that failed validation and were excluded. |
sendDate | datetime | Scheduled time for message delivery (in ISO 8601 format with timezone). |
invalidEmails | array | Array of invalid email addresses (if message type is email). |
invalidMobiles | array | Array of objects with uniqueId and mobile fields for invalid phone numbers. |
Sample Response
{
"dispatch": 180249,
"totalRecipients": 2,
"totalRecipientsSent": 1,
"invalidRecipients": 1,
"sendDate": "2016-05-12T10:00:00+03:00",
"invalidEmails": [],
"invalidMobiles": [
{
"uniqueId": "CustomerIdB",
"mobile": "1936862208"
}
]
}
Get Dispatch Results
This endpoint returns the status and metadata of a previously submitted message dispatch.
- URL:
/api/Dispatches/{DispatchId}
- Method:
GET
- Authentication: Basic Auth
Replace {DispatchId}
with the dispatch
ID returned from the /api/SendMessages
call.
Response Properties
Field | Type | Description |
---|---|---|
dispatchId | long | The ID of the requested dispatch. |
campaignMessageId | integer | ID of the message template used in the dispatch. |
createdAt | datetime | Timestamp when the dispatch request was received. |
startedQueuingAt | datetime | Timestamp when message queuing started. |
finishedQueuingAt | datetime | Timestamp when message queuing finished. |
messageTypeId | integer | Message type: 1 = SMS , 2 = Email . |
hasStartedQueuing | boolean | Indicates if the queuing process has started. |
hasFinishedQueuing | boolean | Indicates if the queuing process has completed. |
totalRecipients | integer | Total number of recipients included in the dispatch. |
sendStatusId | integer | Dispatch status: - 1 : Draft - 2 : Pending - 3 : Queued - 7 : Error |
errorMessage | string | Error message, if the dispatch encountered a failure. |
queueAt | datetime | When messages were requested to be queued. |
sendAt | datetime | When messages were scheduled to be sent. |
isTest | boolean | Indicates whether this was a test dispatch. |
isInitialized | boolean | True if the dispatch initialization is complete. |
lastUpdate | datetime | Timestamp of the last update (if applicable). |
legacyCode1 | string | Optional legacy identifier. |
gatewayId | string | Optional gateway identifier. |
gatewayId1 | string | Optional second gateway identifier. |
creationDate | datetime | Date the dispatch was originally created. |
modifiedDate | datetime | Date the dispatch was last modified. |
Sample Response
{
"dispatchId": 180249,
"campaignMessageId": 71,
"scheduleId": null,
"createdAt": "2017-08-18T11:17:50.26",
"startedQueuingAt": "2017-08-18T11:17:51.837",
"finishedQueuingAt": "2017-08-18T11:17:51.97",
"messageTypeId": 1,
"isTest": false,
"isInitialized": true,
"hasStartedQueuing": true,
"hasFinishedQueuing": true,
"totalRecipients": 1,
"sendStatusId": 3,
"errorMessage": null,
"lastUpdate": null,
"queueAt": "2016-05-12T10:00:00",
"sendAt": "2016-05-12T10:00:00",
"legacyCode1": null,
"gatewayId": "",
"gatewayId1": "",
"creationDate": "2016-05-12T10:00:00",
"modifiedDate": "2016-05-12T10:00:00"
}