Examples
Response examples
The following is an example result in JSON format.
{
"requestId": "D1ABDD934260284DAE68550826DACDF3",
"status": "SUCCESS",
"response": {
"requestedPeriod": {
"sentSince": "2024-04-04T00:00:00Z",
"sentUntil": "2024-04-05T23:59:59Z"
},
"totalRows": 6,
"columns": [
{"columnName": "CHANNEL_CODE", "columnDataType": "STRING"},
{"columnName": "HOUR", "columnDataType": "DATE_TIME"},
{"columnName": "STATUS_GROUP", "columnDataType": "STRING"},
{"columnName": "STATUS", "columnDataType": "STRING"},
{"columnName": "COMMUNICATION", "columnDataType": "INTEGER"},
{"columnName": "TOTAL_TRAFFIC_COUNT", "columnDataType": "INTEGER"},
{"columnName": "DELIVERED_TRAFFIC_COUNT", "columnDataType": "INTEGER"},
{"columnName": "FAILED_TRAFFIC_COUNT", "columnDataType": "INTEGER"},
{"columnName": "TOTAL_SENT_TRAFFIC_COUNT", "columnDataType": "INTEGER"},
{"columnName": "TOTAL_RECEIVED_TRAFFIC_COUNT", "columnDataType": "INTEGER"},
{"columnName": "TRAFFIC_DELIVERY_RATE", "columnDataType": "NUMBER"},
{"columnName": "SEEN_OPENED_TRAFFIC_COUNT", "columnDataType": "INTEGER"},
{"columnName": "TRAFFIC_SEEN_OPEN_RATE", "columnDataType": "NUMBER"}
],
"rows": [
["SMS", "2024-04-04T13:00:00.000+0000", "DELIVERED", "DELIVERED_TO_HANDSET", 200000022475266, 1, 1, 0, 1, 0, 1.0, "N/A", "N/A"],
["EMAIL", "2024-04-05T11:00:00.000+0000", "REJECTED", "REJECTED_VALIDATION_FAILED", "N/A", 3, 0, 3, 3, 0, 0.0, 0, 0.0],
["EMAIL", "2024-04-05T12:00:00.000+0000", "UNDELIVERABLE", "UNDELIVERABLE_REJECTED_OPERATOR", 200000023016143, 1, 0, 1, 0, 0, 0.0, 0, 0.0],
["EMAIL", "2024-04-05T12:00:00.000+0000", "DELIVERED", "DELIVERED_TO_HANDSET", "N/A", 1, 1, 0, 1, 0, 1.0, 0, 0.0],
["EMAIL", "2024-04-05T12:00:00.000+0000", "REJECTED", "REJECTED_VALIDATION_FAILED", "N/A", 1, 0, 1, 1, 0, 0.0, 0, 0.0],
["ZALOZNS", "2024-04-04T13:00:00.000+0000", "UNDELIVERABLE", "UNDELIVERABLE_REJECTED_OPERATOR", 200000022475266, 1, 0, 1, 1, "N/A", 0.0, "N/A", "N/A"]
]
}
}
The JSON structure consists of a top-level object with three main keys: requestId, status, and response. The requestId key uniquely identifies the request. The status key indicates whether the request was successful or not. The response key contains the actual data returned by the query.
Within the response object, there are several key pieces of information. The requestedPeriod parameter specifies the time period for which the data was requested, typically denoted by a start and end timestamp. The totalRows parameter indicates the total number of rows returned in the response.
The columns array provides information about the structure of the data, including the names and data types of each column. Finally, the rows array contains the actual data returned by the query. Each row represents a single communication instance, with values corresponding to the columns specified in the columns array.
In the provided example, there are six rows of data, each representing a communication event. The data includes details such as the channel code, timestamp, status group, status, communication count, traffic counts, delivery rates, and open rates. Some values may be N/A, indicating unavailable data.
Sum of message counts
Query for the sum of SMS message counts over the last day aggregated per hour.
Request body:
{
"callbackUrl": "https://example.com/receive",
"request": {
"filterBy": {
"sentSince": "2024-03-19T00:00:00Z",
"sentUntil": "2024-03-19T23:59:59Z",
"includeSubaccounts": false,
"channelCodes": [
"SMS"
]
},
"aggregateBy": [
"HOUR"
],
"metrics": [
"TOTAL_TRAFFIC_COUNT",
"TOTAL_SENT_TRAFFIC_COUNT",
"DELIVERED_TRAFFIC_COUNT",
"FAILED_TRAFFIC_COUNT"
]
}
}
Sample result:
{
"requestId": "44AA99124DA4BE29AE518A3F82DCBD5D",
"status": "SUCCESS",
"response": {
"requestedPeriod": {
"sentSince": "2024-03-19T00:00:00Z",
"sentUntil": "2024-03-19T23:59:59Z"
},
"totalRows": 1,
"columns": [
{"columnName": "CHANNEL_CODE", "columnDataType": "STRING"},
{"columnName": "HOUR", "columnDataType": "DATE_TIME"},
{"columnName": "TOTAL_TRAFFIC_COUNT", "columnDataType": "INTEGER"},
{"columnName": "TOTAL_SENT_TRAFFIC_COUNT", "columnDataType": "INTEGER"},
{"columnName": "DELIVERED_TRAFFIC_COUNT", "columnDataType": "INTEGER"},
{"columnName": "FAILED_TRAFFIC_COUNT", "columnDataType": "INTEGER"}
],
"rows": [
["SMS", "2024-03-19T11:00:00.000+0000", 17, 17, 16, 1]
]
}
}
CHANNEL_CODE |
SMS |
---|---|
HOUR |
2024-03-19T11:00:00.000Z |
TOTAL_TRAFFIC_COUNT |
17 |
TOTAL_SENT_TRAFFIC_COUNT |
17 |
DELIVERED_TRAFFIC_COUNT |
16 |
FAILED_TRAFFIC_COUNT |
1 |
Aggregating by applicationId and entityId
Request body:
{
"callbackUrl": "https://example.com/receive",
"request": {
"filterBy": {
"sentSince": "2024-04-01T00:00:00Z",
"sentUntil": "2024-04-30T23:59:59Z",
"includeSubaccounts": false,
"directions": [
"OUTBOUND",
"INBOUND"
],
"channelCodes": [
"WHATSAPP",
"VIBER",
"SMS"
]
},
"aggregateBy": [
"APPLICATION_ID",
"ENTITY_ID"
],
"metrics": [
"TOTAL_TRAFFIC_COUNT",
"TOTAL_SENT_TRAFFIC_COUNT",
"DELIVERED_TRAFFIC_COUNT",
"TRAFFIC_DELIVERY_RATE"
]
}
}
Sample result:
{
"requestId": "C127668A9BF7B564E8DEE1DE78CE0A94",
"status": "SUCCESS",
"response": {
"requestedPeriod": {
"sentSince": "2024-04-01T00:00:00Z",
"sentUntil": "2024-04-30T23:59:59Z"
},
"totalRows": 7,
"columns": [
{"columnName": "CHANNEL_CODE", "columnDataType": "STRING"},
{"columnName": "APPLICATION_ID", "columnDataType": "STRING"},
{"columnName": "ENTITY_ID", "columnDataType": "STRING"},
{"columnName": "TOTAL_TRAFFIC_COUNT", "columnDataType": "INTEGER"},
{"columnName": "TOTAL_SENT_TRAFFIC_COUNT", "columnDataType": "INTEGER"},
{"columnName": "DELIVERED_TRAFFIC_COUNT", "columnDataType": "INTEGER"},
{"columnName": "TRAFFIC_DELIVERY_RATE", "columnDataType": "NUMBER"}
],
"rows": [
["SMS", "PROMOTION", "BrandA", 250, 230, 210, 0.91304],
["SMS", "PROMOTION", "BrandB", 500, 480, 430, 0.89583],
["SMS", "NOTIFICATION", "BrandA", 100, 91, 85, 0.93407],
["SMS", "NOTIFICATION", "BrandB", 420, 390, 370, 0.94872],
["VIBER", "PROMOTION", "BrandA", 200, 191, 180, 0.94241],
["VIBER", "PROMOTION", "BrandB", 350, 299, 280, 0.93646],
["WHATSAPP", "PROMOTION", "BrandB", 800, 499, 450, 0.90281]
]
}
}
CHANNEL_CODE |
SMS | SMS | SMS | SMS | VIBER | VIBER | |
---|---|---|---|---|---|---|---|
APPLICATION_ID |
PROMOTION | PROMOTION | NOTIFICATION | NOTIFICATION | PROMOTION | PROMOTION | PROMOTION |
ENTITY_ID |
BrandA | BrandB | BrandA | BrandB | BrandA | BrandB | BrandB |
TOTAL_TRAFFIC_COUNT |
250 | 500 | 100 | 420 | 200 | 350 | 800 |
TOTAL_SENT_TRAFFIC_COUNT |
230 | 480 | 91 | 390 | 191 | 299 | 499 |
DELIVERED_TRAFFIC_COUNT |
210 | 430 | 85 | 370 | 180 | 280 | 450 |
TRAFFIC_DELIVERY_RATE (%) |
91.30 | 89.58 | 93.41 | 94.87 | 94.24 | 93.65 | 90.28 |