Setting Expiry
For time sensitive messages you can specify a expiry date and time where Comapi won't deliver you message after. Where a channel supports message expiry the expiry time will be passed on automatically.
To set an expiry set the following property:
Property | Type | Description |
---|---|---|
expiresOn | date-time | Date/Time (in UTC, ISO 8601 format) |
SMS Expiry times
Please ensure that your expiry time is more than 1 minute from the current UTC time, as when processed if the time difference between UTC and the expiry time is less than a minute then the default expiry will be applied. 1 minute is the minimum validity for an SMS expiry.
{
"body": "Test from Comapi",
"to": {
"phoneNumber": "447123123123"
},
"expiresOn": "2017-03-16T17:05:02Z",
"rules": [
"sms"
]
}
"expiresOn": "2017-03-16T17:05:02Z"
Others...
These other properties may be of use:
Property | Type | Description |
---|---|---|
title | string | The title to use to describe the message (if supported by the channel) |
conversationId | string | Optional conversationId, used to correlate messages within Comapi and on any external channels, if supported |
metadata | object | Custom metadata relating to the message that will be echoed back to you on any webhook events related to the message. Can be used to correlate events back to sends, and aid webhook processing efficiency. Ideal for use with webhooks for reporting and billing data collection. |
channelOptions | object | Allows easy configuration of popular options for a channel without the need for a full customBody. See each channels details for further details. |
requireOptIn | boolean | If requireOptIn is set to true, the message will be rejected if the target profile has not opted-in to any of the specified channels |
{
"body": "Hi, just letting you know that your order #1234 has been dispatched",
"to": {
"phoneNumber": "447123123123"
},
"rules": [
"sms"
],
"metadata": {
"data": "My correlation data",
"moreData": "You can hold any structured JSON data!"
}
}