#Push message
#Path
[POST] https://pushapi.twibida.com/v1/message/push/{AppID}
Content-Type: application/json
#Request body
json string,detail as following.
type | field name | mandatory | note |
---|---|---|---|
boolean | dry_run | no | test mode,not actual send message when true, default false |
int | type | yes | message type,1-notification,2-data |
int | time_to_live | yes | message time to live,in second |
int | condition.type | yes | targeting type 0-all 1-condition targeting,then condition.targeting is effective and mandatory 2-user tageting,then condition.client_ids is effective and mandatory |
List<String> | condition.client_ids | no | array of Client ID |
List<String> | condition.targeting.country | no | ISO-3166-1 two digital code,targeting all when empty |
List<String> | condition.targeting.language | no | language(example:zh,zh-CN),targeting all when empty |
List<String> | condition.targeting.brand | no | brand,targeting all when empty |
List<String> | condition.targeting.model | no | model,targeting all when empty |
List<String> | condition.targeting.os_version | no | Android API level targeting, targeting all when empty |
List<String> | condition.targeting.app_version | no | app version targeting,targeting all when empty |
int | notification.notification_type | no | notification type, 1-system, 3-button, default 1 |
String | notification.title | no | notification title |
String | notification.desc | no | notification describe |
String | notification.icon | no | notification icon, valid when notification type is button |
String | notification.small_icon | no | left up corner small icon, valid when notification type is system |
String | notification.small_icon_color | no | left up corner small icon color, valid when notification type is system,hex,example:#FF0000 |
String | notification.open_type | no | notification click action type,1-open app,2-open link |
String | notification.open_content | no | address to open,Activity or URL |
String | notification.button_text | no | button text, valid when notification type is button |
Map<String, String> | data | no | data,all content including key, value should be string, non-string value should be convert to string. Size does not exceed 2kb |
#Response body
json string,detail as following.
type | field name | note |
---|---|---|
int | status | error code |
String | message | error message |
String | result.message_id | message ID |
#Error code
error code | error message |
---|---|
21005 | message illegal |
21006 | Client ID too much |
21007 | App push SDK disabled |
#Example
Request example:
POST /v1/message/push/{APP_ID} HTTP/1.1
Host: pushapi.twibida.com
Content-Type: application/json
Authorization: {APP_SECRET}
{
"dry_run": false,
"condition": {
"type": 0,
"client_ids": [
"abc",
"xyz"
],
"targeting": {
"country": [
"CN",
"IN"
],
"language": [],
"brand": [],
"model": [],
"os_version": [],
"app_version": []
}
},
"time_to_live": 123,
"type": 0,
"notification": {
"title": "abcd",
"desc": "zzzz",
"open_type": 1,
"open_content": "abc"
},
"data": {
"double": "1.23",
"number": "123",
"string": "xyz"
}
}
Response example:
{
"status": 200,
"message": "OK",
"result": {
"message_id": "123456"
}
}