#Push message

#Path

[POST] https://pushapi.twibida.com/v1/message/push/{AppID}
Content-Type: application/json

#Request body

json string,detail as following.

typefield namemandatorynote
booleandry_runnotest mode,not actual send message when true, default false
inttypeyesmessage type,1-notification,2-data
inttime_to_liveyesmessage time to live,in second
intcondition.typeyestargeting 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_idsnoarray of Client ID
List<String>condition.targeting.countrynoISO-3166-1 two digital code,targeting all when empty
List<String>condition.targeting.languagenolanguage(example:zh,zh-CN),targeting all when empty
List<String>condition.targeting.brandnobrand,targeting all when empty
List<String>condition.targeting.modelnomodel,targeting all when empty
List<String>condition.targeting.os_versionnoAndroid API level targeting, targeting all when empty
List<String>condition.targeting.app_versionnoapp version targeting,targeting all when empty
intnotification.notification_typenonotification type, 1-system, 3-button, default 1
Stringnotification.titlenonotification title
Stringnotification.descnonotification describe
Stringnotification.iconnonotification icon, valid when notification type is button
Stringnotification.small_iconnoleft up corner small icon, valid when notification type is system
Stringnotification.small_icon_colornoleft up corner small icon color, valid when notification type is system,hex,example:#FF0000
Stringnotification.open_typenonotification click action type,1-open app,2-open link
Stringnotification.open_contentnoaddress to open,Activity or URL
Stringnotification.button_textnobutton text, valid when notification type is button
Map<String, String>datanodata,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.

typefield namenote
intstatuserror code
Stringmessageerror message
Stringresult.message_idmessage ID

#Error code

error codeerror message
21005message illegal
21006Client ID too much
21007App 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"
  }
}