Delete all messages from a user in a group chat
OpenIM uni-app / uni-app x SDK guide for Delete all messages from a user in a group chat.
deleteUserAllMessagesInConv() and onDeleteUserAllMsgsInConv are Commercial. The operation applies only to group conversations and deletes every message sent by the selected user in that conversation. Treat it as a high-impact moderation action, not a normal single-message menu item; OpenIMServer validates operator permission.
import { deleteUserAllMessagesInConv, off, onDeleteUserAllMsgsInConv } from '@/uni_modules/unix-openim-sdk'
const subscription = onDeleteUserAllMsgsInConv((payload) => refreshAfterValidatedJson(payload))
await deleteUserAllMessagesInConv({ conversationID, userID: targetUserID })
off(subscription)Require strong confirmation. Promise completion does not mean the event has already arrived. The event payload is raw JSON in the uni-app / uni-app x contract, so parse it defensively and refresh the conversation instead of depending on unfrozen fields or logging the payload.
This page owns onDeleteUserAllMsgsInConv. Remove its subscription when the component is destroyed, the user logs out, or the active account changes. Promise completion, event delivery, and a fresh history query are three independent stages.
Was this page helpful?