Interaction Example
Request a batch of messages from the queue
GET /queue?take=10
Response:
[
{
"id": 6637960,
"settingsId": 2441,
"customerId": 34521212,
"variables": {
"tid.0": "HH3FqOXdQ0V",
"var1": 10
}
},
{
"id": 6637961,
"settingsId": 2442,
"customerId": 546564534,
"variables": {
"tid.0": "HInH72wy6Fw"
}
},
{
"id": 6637962,
"settingsId": 2442,
"customerId": 234345635,
"variables": {
"tid.0": "HJXKLfcZUex"
}
}
]
Report dequeued status
POST /events
Request:
[
{
"timestamp": "2021-11-03T19:00:00.123456Z",
"messageId": 6637960,
"status": "dequeued"
},
{
"timestamp": "2021-11-03T19:00:00.234567Z",
"messageId": 6637961,
"status": "dequeued"
},
{
"timestamp": "2021-11-03T19:00:00.345678Z",
"messageId": 6637962,
"status": "dequeued"
}
]
Get settings for messages
It is recommended to cache settings in a local database and request settings from the API only if there is no local copy.
GET /settings/2441
{
"content": {
"en": {
"greetings": {
"general": "Happy new year!",
"personal": "Happy new year, {customer.name}!"
},
"sms": {
"text": "{greeting} Personal variable {var1}! Details: https://s1mpl.to/{tid.0}"
}
}
}
}
GET /settings/2442
{
"content": {
"en": {
"greetings": {
"general": "Dear customer!",
"personal": "Hello, {customer.name}!"
},
"sms": {
"text": "{greeting} Text #2! Details: https://s1mpl.to/{tid.0}"
}
}
}
}
- Customer 34521212 has the
customer.namevalueJohn - Customer 546564534 has the
customer.namevalueMr. Edwards - Customer 234345635 does not have a
customer.namevalue defined
SMS text for customer 34521212:
Happy new year, John! Personal variable 10! Details: https://s1mpl.to/HH3FqOXdQ0V
SMS text for customer 546564534:
Hello, Mr. Edwards! Text #2! Details: https://s1mpl.to/HInH72wy6Fw
SMS text for customer 234345635:
Dear customer! Text #2! Details: https://s1mpl.to/HJXKLfcZUex
Report sent status
Intermediate statuses can also be reported, e.g. sending, accepted.
POST /events
Request:
[
{
"timestamp": "2021-11-03T19:10:00.123456Z",
"messageId": 6637960,
"status": "sent"
},
{
"timestamp": "2021-11-03T19:10:03.234567Z",
"messageId": 6637961,
"status": "sent"
},
{
"timestamp": "2021-11-03T19:10:11.345678Z",
"messageId": 6637962,
"status": "sent"
}
]
Report delivered status on update from a provider
POST /events
Request:
[
{
"timestamp": "2021-11-03T20:03:10.123456Z",
"messageId": 6637960,
"status": "delivered",
"channel": "sms",
"reportedAt": "2021-11-03T21:00:00.234567Z"
},
{
"timestamp": "2021-11-03T20:15:47.345678Z",
"messageId": 6637961,
"status": "delivered",
"channel": "sms",
"reportedAt": "2021-11-03T21:00:00.456789Z"
},
{
"timestamp": "2021-11-03T20:16:12.567890Z",
"messageId": 6637962,
"status": "delivered",
"channel": "sms",
"reportedAt": "2021-11-03T21:00:00.678901Z"
}
]