We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
ReferencesPush KitRESTSending Receipts for Downlink Messages

Sending Receipts for Downlink Messages

NOTICE

To ensure network security, Push Kit disabled the TLS 1.0 and TLS 1.1 protocols and unsupported cipher suites for push-related domains on February 28, 2023. After the date, your app is unable to send push messages using the TLS protocol earlier than version 1.2 or unspecified cipher suites.

If your app uses TLS 1.0 or TLS 1.1 to access push-related domains, ensure that the protocol is updated to TLS 1.2 or later.

For details, please refer to Notice on Disabling the TLS 1.0 and TLS 1.1 Protocols for Push Kit Domains. If you have any questions, contact our technical support for help.

Function

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

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

API Version

The receipt API versions include V1 and V2. The request header and response parameters are the same for receipt messages of different API versions. The only difference lies in the request body.

The downlink message APIs for the V1 version are as follows:

https://push-api.cloud.huawei.com/v1/[clientid]/messages:send

https://push-api.cloud.huawei.com/v2/[projectid]/messages:send

The V2 version supports the above APIs and new APIs added subsequently. You are advised to switch to the V2 version by following instructions here.

Request Parameters

Request Header

Expand

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

Expand

Parameter

Mandatory (M)/Optional (O)

Type

Description

statuses

M

Array [statuses Object ]

Receipt message content, which is an array of up to 100 statuses structures. This parameter is different for V1 and V2.

statuses for V1

Expand

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 the receipt status codes.

timestamp

M

Long

Standard Unix timestamp when a message arrives at the device.

clientId

M

String

App client ID or project ID returned based on the receipt configuration.

NOTE
  • If only the project-level receipt is set in Receipt Enabling, only the project ID is returned.
  • If only the app-level receipt is set in Receipt Enabling, only the client ID is returned.
  • If both the project-level and app-level receipts are set in Receipt Enabling, only the client ID is returned.

projectid

M

String

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.

statuses for V2

Expand

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.

appPackageName

M

String

App package name of the message sender.

biTag

M

String

biTag contained in the message you send. If bi_tag is not set for sending a notification message, biTag is left empty.

requestId

M

String

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

deliveryStatus

O

deliveryStatus Object

Message delivery status (deliveryStatus).

NOTICE

In the V2 version, the subStatus field is removed and the deliveryStatus.result field will contain content of the subStatus field.

deliveryStatus

Expand

Parameter

Mandatory (M)/Optional (O)

Type

Description

result

M

Integer

Receipt status code indicating the message delivery status. For details, please refer to the receipt status codes.

timestamp

M

Long

Standard Unix timestamp when the message successfully arrives at the client. If the message fails to arrive at the client, the value of this parameter is the timestamp when the receipt message is generated.

Request Example

V1

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "statuses": [
  3. {
  4. "biTag": "131415",
  5. "clientId": "132****013",
  6. "token": "148896*******000001",
  7. "status": 0,
  8. "timestamp": 1489993883189,
  9. "requestId": "1*******0"
  10. },
  11. {
  12. "biTag": "131415",
  13. "projectid": "60*******13",
  14. "token": "14889646*******13000001",
  15. "status": 2,
  16. "timestamp": 1489993888189,
  17. "requestId": "1*******890"
  18. }
  19. ]
  20. }

V2

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "statuses": [
  3. {
  4. "biTag": "131415",
  5. "appPackageName": "com.****",
  6. "token": "148896*******000001",
  7. "requestId": "1*******0",
  8. "deliveryStatus":{
  9. "result": 0,
  10. "timestamp": 1607832761768
  11. }
  12. }
  13. ]
  14. }

Response Parameters

Response Body

Expand

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

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "code": "0",
  3. "message": "success"
  4. }
Search in References
Enter a keyword.