The message revoke feature lets you revoke a message within a specific period after sending it. This feature gives you greater control, allowing you to correct errors or remove sensitive content.
Revoke a message on the client
To delete a message, see Delete a message.
You can revoke messages that you send.
A group administrator can revoke or delete messages sent by any member in the group.
When a client sends a message, the success callback includes the message ID. When the server sends a message, you must specify a unique message ID in the parameters to prevent duplicates. If you do not specify a message ID, a random one is generated.
The message callback that the accepter receives includes the message ID.
Revoke a message using a server-side OpenAPI call
Handle the revoke (delete) message callback on the accepter
When a message is deleted, the accepter receives a delete message callback. To handle this callback, the client must listen for messages.
// Listen for messages
messageInterface.addMessageListener(new ImMessageListener() {
@Override
public void onRecvC2cMessage(ImMessage msg) {
}
@Override
public void onRecvGroupMessage(ImMessage msg, String groupId) {
}
@Override
public void onDeleteGroupMessage(String msgId, String groupId) {
}
});The onDeleteGroupMessage callback is triggered. Handle this callback in your business layer to implement the required logic, such as removing the message from the message list.