This single API provides a multitude of functionality for multi-channel outbound messaging.
Headers
Request Header | Description |
---|---|
key | Service Key |
content-type | Application/JSON |
{
"correlationid": "<Unique transaction ID from the client end>", //Optional
"notifyurl": "<Notifications will be sent to the URL specified here>", //Optional
"callbackData": "<Identifier sent alongside notifications to the notifyurl>", //Optional
"expiry": "<Expiry time in UTC format, after which messages will not be pushed. For example, 2015-04-12T13:00:19.456Z or 2015-04-12T18:30:19.456+5:30.>", //Optional
"priority": "<Accepts numbers 1-low, 2-medium, and 3-high>", //Optional
"message": { //Optional
"template": "<Message template ID.>",
"parameters": {
"parameter1": "<value>",
"parameter2": "<value>",
"parameter3": "<value>"
}
},
"deliverychannel": "appmessaging", //Mandatory
"channels": {
"appmessaging": {
"message": {
"text": "RTM_message",
"attachment": {
"file": "<URL of resource, e.g. http://ip/image.jpg>",
"contentType": "image",
"size": "10"
}
},
"notification": {
"web_extras": {
"collapse_key": "web_col_key",
"action": "web_col_key",
"url": "<Valid http URL>"
},
"title": "notification_title",
"text": "notification_text",
"windows_extras": {
"logo": "<URL of resource, e.g. http://ip/image.jpg>",
"sound": "wind_not_sound",
"image": "<URL of resource, e.g. http://ip/image.jpg>",
"badge": "wnd_badge",
"notificationaction": {
"action": "OPEN_URL",
"value": "<Valid HTTP URL>"
}
},
"interactive": {
"category": "DOUBLE_YES_NO",
"pushref": "pu_ref",
"actions": [{
"action": "OPEN_APP",
"identifier": "YES",
"pos": 1
}, {
"action": "OPEN_APP",
"identifier": "NO",
"pos": 2
}
]
},
"ios_extras": {
"attachmenturl": "<URL of resource, e.g. http://ip/image.jpg>",
"collapse_key": "ios_col_key",
"sound": "ios_ex_sound",
"badge": "ios_badge_",
"notificationaction": {
"action": "OPEN_URL",
"value": "<Valid HTTP URL>"
}
},
"android_extras": {
"collapse_key": "and_col_key",
"sound": "android_not_sound",
"iconurl": "<URL of resource, e.g. http://ip/image.jpg>",
"customtags": {
"imageurl": "and_not_image"
},
"notificationaction": {
"action": "OPEN_URL",
"value": "<Valid HTTP URL>"
}
}
},
"thread_type": "conversation",
"thread_title": "thread_title",
"thread_id": "please enter the thread id for the message"
}
},
"destination": [//Mandatory
{
"msisdn/customerid": [
"<value1>",
"<value2>"
],
"correlationid": "<A unique transaction ID up to 50 bytes used by Client to match requests with responses. Will override correlationid given in request body.>"
}, {
"customerid": [
"<value1>",
"<value2>"
],
"correlationid": "<A unique transaction ID up to 50 bytes used by Client to match requests with responses. Will override correlationid given in request body.>"
}
]
}
Response
This API may return the following response codes:
Response Code | Message | Description |
---|---|---|
1001 | Queued | Returned when the request is accepted by IMIconnect. |
7000 | Invalid JSON | Returned when an invalid JSON request is sent. |
7001 | Authentication failed | Returned when an invalid service key or profile key is provided in the request. |
7002 | Service key missing | Returned when the parameter key is missing in the message request. |
7003 | Mandatory parameters missing | Returned when the mandatory parameters configured in custom event are missing. |
7004 | Invalid parameters | Returned when the parameters are invalid. |
7006 | Internal error occurred | Returned when an internal error occurs. |
7007 | Service inactive | Returned when the service is in inactive state. |
7009 | Max number of destinations | Returned when an API request exceeds the limit (1000) to send messages using messaging API. |
Parameters
The following are the parameters of the request body:
Parameter | Type | Mandatory | Description |
---|---|---|---|
deliverychannel | String | Yes | Specifies the channel to send a message.Real Time channel sends messages to enable mobile apps to provide App-Messaging. It supports rich multimedia messages with text and optional multimedia items. |
JSONArray | Yes | The destination parameter is an array of up to 1,000 entries. Messages can be sent to single or multiple recipients in a single request. For more details, refer to destination array. | |
JSONArray | Yes | For more details, refer to channels array. | |
message | JSONObject | No | The message parameter block references a template via the template ID which is created within the IMIconnect platform. The amount of sub-parameters in the parameters block depends on the number of parameters expected in the template. These parameters are supplied to the template for substitution in the final message.
Note: If you use message templates, then the parameter name should match with the parameter specified in the template. The parameters in this message block are overridden if a channel specific parameter block is also used. |
expiry | String | No | Expiry time in UTC format, after which messages will not be pushed. For example, 2015-04-12T13:00:19.456Z or 2015-04-12T18:30:19.456+5:30. |
correlationid | String | No | A client-side identifier chosen by the Service Provider to correlate requests and their subsequent responses. The correlationid can be up to 50 bytes long. |
notifyurl | String | No | The IMIconnect platform will send notifications to the URL specified in the notifyurl parameter. The URL is used to retrieve the status of the message sent. The notifyurl can also be configured while creating a service. If the URL is specified in both the service and the messaging API, preference will be given to the messaging API request. For more information on notify URL formats, click Message Receipts. |
callbackData | String | No | An identifier or data that will be sent alongside notifications to the notifyurl. This can serve as identifying notifications. |
priority | String | No | This parameter is used to specify the message priority. The priority is defined while creating the client in the admin screen. All the services that are created under this client will have same priority. Messages of equal priorities are delivered in the natural order of their arrival at their destinations. The options for this parameter are:
|
Channels
The channels parameter block configures channel communication parameters and will override the service's default values and the parameters in the base request.
appmessaging
The following parameters are part of the appmessaging.
Parameter | Type | Mandatory | Description |
---|---|---|---|
message | JSONObject | Yes | For more information, see message. |
notification | JSONObject | No | For more information, see notification. |
thread_type | String | Yes | Specifies the thread type. |
thread_title | String | Yes | Specifies the thread title. |
- message
The following table defines the parameters in the message object block.
Parameter | Type | Mandatory | Description |
---|---|---|---|
text | String | Yes | Specifies the message. |
attachment | JSONObject | No | The attachments parameter is in itself an object parameter block for the following sub-parameters:
For more information on attachment, see attachment. |
attachment
The following parameters are part of the attachment block.
Parameter | Type | Mandatory | Description |
---|---|---|---|
contentType | String | Yes | MIME content type, such as image/jpg for JPEG images. Supported content types:
|
file | String | Yes | Complete URL of file. |
preview | String | No, unless contentType is video. | A base64 string of a JPEG image to display as a preview for video. |
size | Integer | No | Size of content in bytes. |
duration | String | No, unless contentType audio or video | Duration of audio or video in seconds. |
latitude | String | No, unless contentType is location | Specifies the latitude of the location. |
longitude | String | No, unless contentType is location | Specifies the longitude of the location. |
- notification
The following table defines the parameters in the notification block object block.
Parameter | Type | Mandatory | Description |
---|---|---|---|
title | String | Yes | Specifies the notification title. |
text | String | Yes | Specifies the notification text. |
android_extras | JSONObject | No | The following keys are available under android_extras:
For detailed information, see Push:Android. |
ios_extras | JSONObject | No | The following keys are available under ios_extras:
For detailed information, see |
windows_extras | JSONObject | No | The following keys are available under windows_extras:
For detailed information, see |
web_extras | JSONObject | No | The following keys are available under web_extras:
For detailed information, see |
interactive | JSONObject | No | For more information, see Section: Interactive. |
notificationaction
The following parameters are part of the notificationaction parameter block.
Parameter | Type | Mandatory | Description |
---|---|---|---|
action | String | No | Following are the actions you can configure:
|
value | String | No | Specifies the value that is used to complete the action configured. For example, if you configure action as OPEN_URL, then you have to configure value with a URL such as www.bbc.com.**Note: If the action is set to OPENAPP**, value is not required. |
It is not mandatory to define notificationaction. But if you set an action, you must specify a _value _that is used to complete the configured action.
interactive
The following parameters are part of the interactive block.
Parameter | Type | Mandatory | Description |
---|---|---|---|
pushref | String | No | Define if the sender intends to use the message interaction result as a trigger for rules. |
category | String | Yes | The category can be one of the following:
Where the option is prefixed with SINGLE, only one choice is available. In the case of DOUBLE, two choices are available. In either case the actions parameter depends on the parameter set for category. |
actions | JSONArray | Yes | Using the actions parameter, interactive actions can be built. The actions parameter is a parameter array block consisting of:
Note: Depending on the category choice, the outcome of the actions parameter varies. |
interactive > actions parameter array block
The following parameters are part of the actions array
Parameter | Type | Mandatory | Description |
---|---|---|---|
pos | String | Yes | A numerical value that places the interactive element in the position specified. |
action | String | Yes | Action to perform when interaction takes place, for instance:
|
value | String | Yes, depending on action parameter. | For certain actions, the value of value is used to complete the action. |
smartlinks
An array that contains the parameters of Smartlink. This is an optional parameter. To use Smartlinks, you must create a smartlink and use the link id in messaging API. These smartlinks can be used in SMS, RT and OTT messaging channels.
Following are the parameters of smartlinks:
Parameter | Type | Mandatory | Description |
---|---|---|---|
linkid | Number | Yes | This parameter is mandatory when the smartlinks parameter is configured. The linkid gets generated for a smartlink created using IMIconnect. |
validity | Number | No | Specifies the time in minutes after which the link will expire. |
{
"smartlinks":[
{
"linkid": "<specifies the link id that is generated for a Smartlink using IMIconnect. >",
"validity": "<Specifies the time in minutes after which the link will expire>"
}
]
}