Recalls a message — deletes it for everyone, not just for you.
💡 The recalled message still comes back in the response, but with
"status": "deleted"and itstextset tonull.
method is "recallMessage".
| Field | Type | Required | Description |
|---|---|---|---|
message_id |
String | Yes | The message to recall. |
chat_id |
String | Yes | The chat the message is in. |
app_id |
String | Yes | The app the message belongs to. |
reference |
Long | Yes | Your local id for this request. Echoed back in messageAck. |
from_user_id |
String | Conditional | The original sender of the message. Required when your API is recalling someone else's message as a chat admin. |
to_user_id |
String | Optional | Target a single user inside a group or channel. |
| Requirement | Needed for |
|---|---|
"Delete Message" permission |
Recalling any message. |
| Chat type | Your API must be |
| --- | --- |
| User chat | Started by the user, and the original sender of the message |
| Group | An admin |
| Channel | An admin |
| When | Method | What it tells you |
|---|---|---|
| Always | messageAck |
The recall was accepted. Carries "status": "deleted". |
| Always | message |
The recalled message, with "status": "deleted" and text set to null. |
| SDK | Call | Callback |
|---|---|---|
| Java | api.recallMessage(chatId, messageId, toUserId, reference, appId); |
onMessagAckCallback(MessageAck msgAck) |
| JavaScript | api.recallMessage(chatId, messageId, toUserId, reference, appId); |
onMessagAckCallback(msgAck) |
| Python | napi.recall_message(chat_id=chat_id, message_id=message_id, to_user_id=to_user_id, reference=reference, app_id=app_id) |
on_message_ack_callback(self, msg_ack) |
💡 The SDK helpers set
to_user_id. To recall another user's message as an admin you needfrom_user_id, which means building aRecallOutMessagedirectly and sending it with the genericsend.
{
"method": "recallMessage",
"message_id": "d1_l4OtAvMz126176",
"chat_id": "90090684438172188",
"reference": 111111170,
"app_id": "90090684293000559"
}
api.recallMessage(chatId, messageId, toUserId, reference, appId);
api.recallMessage(chatId, messageId, toUserId, reference, appId);
napi.recall_message(chat_id=chat_id, message_id=message_id, to_user_id=to_user_id, reference=reference, app_id=app_id)