If the content of a pushed notification message is incorrect or violates regulations, it may lead to negative consequences such as user complaints or penalties from regulatory authorities. Push Kit offers a message recall function to help reduce the negative effects in such scenarios.
A push token and the notifyId field are required for message recalling.
To use the message recall function, ensure that you have set the notifyId field when pushing messages.
A message can be recalled only in the following scenarios:
The message has not arrived at the device.
The message has been displayed on the device but the user has not tapped it.
Message recall does not change the number displayed on the notification badge.
The function of recalling notification messages supports phones, tablets, and PCs/2-in-1 devices. Support for wearables is available starting from 5.1.0(18), and for TVs starting from 5.1.1(19).
Push a message by referring to Development Procedure and ensure that the app can receive the message properly.
Call the required REST API on your app server to recall the notification message. For details, please refer to Message Revocation. The request example is as follows:
// Request URL
POST "https://push-api.cloud.huawei.com/v1/[clientId]/messages:revoke"
// Request header
Content-Type:application/json
Authorization:Bearer eyJr*****OiIx---****.eyJh*****iJodHR--***.QRod*****4Gp---****
push-type: 0
// Request body
{
"notifyId": 1234567,
"token": [
"pushToken1",
"pushToken2",
"pushToken3"
]
}
Use the V1 URL for the message recall API, and pass clientId as the path parameter. While other scenario-specific message push APIs use the V3 version with projectId in the path, this API uses clientId instead.