ข้ามไปยังเนื้อหา

Message inbox API

getInboxMessages

Anchor link to

ส่งคืนรายการข้อความ Inbox สำหรับ HWID ที่ระบุ

POST https://api.pushwoosh.com/json/1.3/getInboxMessages

Request headers

Anchor link to
ชื่อจำเป็นค่าคำอธิบาย
Authorizationใช่Token XXXXAPI Device Token เพื่อเข้าถึง Device API แทนที่ XXXX ด้วย Device API token จริงของคุณ

Request Body

Anchor link to
ชื่อประเภทคำอธิบาย
application*stringPushwoosh application code
userId*stringหากไม่ได้ตั้งค่า User ID แบบกำหนดเอง ให้ใช้ HWID
hwidstringHardware ID ของอุปกรณ์ ที่จะดึงข้อความ Inbox
last_codestringรหัสของข้อความล่าสุดที่ดึงมาในการตอบกลับครั้งก่อน หากว่างเปล่า จะส่งคืนข้อความแรกสุด
countintegerจำนวนข้อความที่จะแสดงในการตอบกลับเดียว ใช้สำหรับการแบ่งหน้า (pagination) ใส่ 0 เพื่อโหลดข้อความทั้งหมดใน Inbox
{
"response": {
"messages": [{ // array of messages currently stored in user's Inbox
"inbox_id": "avde1c792cd",
"rt": "146078676", // date to remove the message from Inbox
"send_date": "1459758676", // date when the message was saved to Inbox
"order": "59138176", // position in Inbox presentation order
"title": "New Rich Media in inbox!",
"text": "Hi! New feature is available right now!",
"action_type": "RichMedia",
"action_params": { // payload describing the actions on push opening
"rm": "{\"url\":\"https:\/\/richmedia.pushwoosh.com\/C82F7-51FC1.zip\",\"ts\":\"1459758676\",\"tags\":{\"tagName\":\"tagValue\"}}"
},
"status": 1, // 1 - delivered, 2 - read, 3 - opened,
// 4 - deleted(by a user), 5 - deleted from Control Panel
"hash":"1C" // hash code of push notification
}, {
...
}],
"next":"afarew511", // the next Inbox code to be returned by
// the following /getInboxMessages request
"deleted": ["bbaf85ab", "a41957b"], // the list of messages deleted from Control Panel
"new_inbox": 6 // the number of delivered Inbox messages for that user (can be used for badge)
}
}
Example Request
{
"request": {
"application": "XXXXX-XXXXX", // required. Pushwoosh app code
"userId": "user_name_1", // required. User ID registered in Pushwoosh
"device_type": 1 // optional. For device types refer to /registerDevice
}
}

inboxStatus

Anchor link to

อัปเดตสถานะของข้อความ Inbox ที่ระบุ

POST https://api.pushwoosh.com/json/1.3/inboxStatus

Request headers

Anchor link to
ชื่อจำเป็นค่าคำอธิบาย
Authorizationใช่Token XXXXAPI Device Token เพื่อเข้าถึง Device API แทนที่ XXXX ด้วย Device API token จริงของคุณ

Request Body

Anchor link to
ชื่อประเภทคำอธิบาย
application*stringPushwoosh application code
inbox_code*stringสามารถรับได้จากรายละเอียดข้อความใน Control Panel หรือจากพารามิเตอร์ “order” ของคำขอ /getInboxMessages
hashstringรหัส Hash ของข้อความ Inbox
hwidstringHardware ID ของอุปกรณ์ ที่จะอัปเดตสถานะ Inbox
timestringTimestamp ของวันที่ส่ง
userID*stringหากไม่ได้ตั้งค่า User ID แบบกำหนดเอง ให้ใช้ HWID
status*integer1 - ส่งแล้ว (delivered), 2 - อ่านแล้ว (read), 3 - เปิดแล้ว (opened), 4 - ลบโดยผู้ใช้ (deleted by a user)
device_typeintegerดูค่าที่เป็นไปได้
{
"status_code": 200,
"status_message": "OK",
"response": null
}
Example
{
"request": {
"application": "XXXXX-XXXXX", // required. Pushwoosh application code
"inbox_code": "874393934032909", // required. "order" parameter of /getInboxMessages request
"hash": "1C", // optional.
"userId": "some_user", // required.
"status": 2, // required. status to set: 1-delivered, 2-read, 3-opened, 4-deleted (by a user)
"device_type": 3 // optional.
}
}