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

Request Body Structure

API Prototype

  • Protocol: HTTPS POST

  • Direction: Your server -> Huawei Push Kit server

  • URL: https://push-api.cloud.huawei.com/v3/[projectId]/messages:send

  • Data format: Content-Type: application/json

NOTE

[projectId]: project ID. To obtain the value, sign in to AppGallery Connect, click Development and services, click the desired project, and go to Project settings.

Request Header

Expand
Parameter Description Example
Authorization

Authentication mode: JWT

Note:

HarmonyOS 5 and later versions no longer support OAuth 2.0-based authentication.

For details, please refer to Generating a JWT Based on a Service Account.

Note:

You are advised to set the JWT validity period to 3600 seconds, within which a JWT can be reused.

This parameter value is Bearer followed by a space character and then the obtained authentication information.

Bearer eyJr*****OiIx---****.eyJh*****iJodHR--***.QRod*****4Gp---****
push-type

Message type. The options are as follows:

0: alert message (notification message and badge message)

1: widget update message

2: text-to-speech message

6: background message

7: live view message

10: in-app call message

0

Request Body

Expand
Parameter Mandatory Type Description
payload Yes Object

Push message struct. Different push-type scenarios have different payload definitions.

0: AlertPayload (notification message)

0: BadgePayload (badge app icon update message)

1: FormUpdatePayload (widget update message)

2: ExtensionPayload (text-to-speech message)

6: BackgroundPayload (background message)

7: LiveViewPayload (live view message)

10: VoIPCallPayload (in-app call message)

pushOptions No Object Sending control parameter. For details, please refer to pushOptions.
target Yes Object Sending target. For details, please refer to target.
Collapse
Word wrap
Dark theme
Copy code
  1. Request Header
  2. ├── Content-Type: application/json
  3. ├── Authorization: API authentication token
  4. └── push-type: Scenario-specific message type
  5. Request Body
  6. ├── pushOptions
  7. │ ├── testMessage: Indicates whether a message is a test message
  8. │ └── Other parameters...
  9. ├── payload
  10. │ # Type 1: Notification message. For details, please refer to AlertPayload.
  11. │ └── notification
  12. │ ├── category: Message type
  13. │ ├── title: Notification title
  14. │ ├── body: Notification body
  15. │ └── Other parameters...
  16. │
  17. │ # Type 2: Widget update message. For details, please refer to FormUpdatePayload.
  18. │ └── formUpdate
  19. │ ├── formId: Instance ID of a service widget
  20. │ ├── version: Version number of a widget update message
  21. │ ├── images: Image data of a service widget
  22. │ └── Other parameters...
  23. │
  24. │ # Type 3: Text-to-speech message. For details, please refer to ExtensionPayload.
  25. │ ├── notification
  26. │ │ ├── category: Message type
  27. │ │ ├── title: Notification title
  28. │ │ ├── body: Notification body
  29. │ │ └── Other parameters...
  30. │ └── extraData: Extension data
  31. │
  32. │ # Other types...
  33. │
  34. └── target
  35. └── token: Push Token