Skip to main content

Recall Message

After successfully sending a message via the app, users may discover issues like incorrect content and wish to recall the message while removing it from the recipient's message history. IMKit provides built-in message recall functionality by default.

tip

When recalling a message, IMKit replaces the original message in the chat history with a recall notification message (RecallNotificationMessage) that has an objectName of RC:RcNtf. For details, refer to the server-side documentation Notification Message Format.

(width=220) (width=220)

Usage

IMKit enables the recall feature by default. Users can long-press a successfully sent message in the conversation UI to open a pop-up menu and select "Recall." After recall, the message can be "Re-edit" within a limited time frame.

Customization

Restrict Recall Permissions

By default, RC imposes no restrictions on who can recall messages—anyone can recall messages sent by others. To implement restrictions, consider these approaches:

  • Have the app client enforce recall restrictions. For example, regular users in your app's business logic may be prohibited from recalling others' messages, while admin roles retain this privilege.
  • To prevent users from recalling non-self-sent messages, submit a ticket to enable the IMLib SDK Recall Restriction feature. This configures RC's server to block users from recalling messages they didn't send.

Adjust Maximum Recall Time Window

IMKit allows recalling messages within 120 seconds of sending by default. You can modify this limit via global configuration.

RongConfigCenter.conversationConfig().rc_message_recall_interval = 120;

To override IMKit's default settings via XML resources, create an rc_config.xml file in your app's res/values directory and add:

<integer name="rc_message_recall_interval">120</integer>

Modify Re-edit Time Limit After Recall

IMKit permits re-editing recalled messages within 300 seconds by default (text messages only). Adjust this threshold via global configuration:

RongConfigCenter.conversationConfig().rc_message_recall_edit_interval = 300;

For XML-based configuration, add this entry to rc_config.xml:

<integer name="rc_message_recall_edit_interval">300</integer>

Additional Customization

IMKit SDK provides default implementations for message recall and display logic without requiring additional API calls. If these don't meet your needs, use relevant APIs in IMCenter. See Message Recall for details.

Disabling Recall Feature

Override IMKit's default settings via XML by creating rc_config.xml in res/values with:

<bool name="rc_enable_message_recall">false</bool>