目录

Sending Receipts for Downlink Messages

Function

This API is used by the Push Kit server to send receipts to your server.

Scenario

None.

Restrictions

You need to enable the message receipt function in AppGallery Connect. For details about how to enable the function, please refer to Preparations.

Prototype

Protocol

HTTPS POST

Direction

Push Kit server -> Your server for receiving receipts

URL

URL of your server for receiving receipts, which you defined and is the same as the callback address in AppGallery Connect.

Data Format

Request: Content-Type: application/json

Response: Content-Type: application/json

Request Parameters

Request Header

Parameter

Description

Example

X-HUAWEI-CALLBACK-ID

Message header authentication parameter, which is optional. This parameter is mandatory when both the callback user name and key have been set in the receipt configuration.

timestamp=1563105451261; nonce=a07bfa17-6d82-4b53-a9a2-07cfef5ceef1; value=E4YeOsnMtHZ6592U8B9S37238E+Hwtjfrmpf8AQXF+c=

  • timestamp: standard Unix timestamp
  • nonce: random UUID
  • value: Base64-encoded string that has been HMAC-SHA256 encrypted using the callback key. The string before encryption consists of the value of timestamp, value of nonce, and callback user name, without plus signs (+).

Request Body

Parameter

Mandatory (M)/Optional (O)

Type

Description

statuses

M

array

Receipt content. A single receipt can contain 100 statuses structures.

statuses Structure

Parameter

Mandatory (M)/Optional (O)

Type

Description

token

M

string

Token of the user to which a message is sent. The token is sent to your server.

biTag

M

string

The value is the same as that of biTag contained in the message you send. If bi_tag is not set for sending a notification message, biTag is left empty.

status

M

integer

Returned receipt status code. For details, please refer to receipt status codes.

timestamp

M

Long

Standard Unix timestamp when a message arrives at the device.

appid

M

string

App ID.

requestId

M

string

Request ID, which is returned by the downlink message sending API.

subStatus

O

integer

Sub-status code that explains why the message sending is controlled. The options are as follows:

  • 2: The app has been uninstalled.
  • 5: The token specified in the message does not match the current sign-in user. (This may occur on a device where the multi-user function is enabled. On the device, different users match different tokens.)
  • 6: The user has disabled the notification message display function.

Request Example

{
    "statuses": [
        {
            "biTag": "131415",
            "appid": "0000000013",
            "token": "14889646529623230000000013000001",
            "status": 0,
            "timestamp": 1489993883189,
            "requestId": "1234567890"
        },
        {
            "biTag": "131415",
            "appid": "0000000013",
            "token": "14889646529623230000000113000001",
            "status": 2,
            "timestamp": 1489993888189,
            "requestId": "1234567890"
        }
    ]
}

Response Parameters

Response Body

Parameter

Mandatory (M)/Optional (O)

Type

Description

code

M

string

Processing result code returned by your server.

message

M

string

Description of the processing result code returned by your server.

Response Example

{
    "code": "0",
    "message": "success"
}