Use this message to recall (delete for all) an existing message.
Field | Type | Required | Description |
method | String | Yes | "recallMessage" |
app_id | String | Yes | Unique identifier for App to which the message belongs. |
chat_id | String | Yes | Unique identifier of Chat_id. |
message_id | String | Yes | Global Unique identifier for message requested to be recalled. |
from_user_id | String | Optional | The original sender ID is mandatory in case the API is the admin of the chat. |
reference | Long | Yes | Unique local identifier for the target Chat or User. |
Preconditions for API Functionality
The following tables outline the preconditions that must be met for the API to function correctly. Failure to meet these conditions may result in errors or unexpected behavior.
- Preconditions for API permissions
Before deleting a message, ensure the following conditions are met:
Action | Required Permission | Description |
Deleting a message | "Delete Message" | The API must have the "Delete Message" permission to delete messages in a chat (user, group, or channel). |
- Preconditions for API Role in the Chat
Before deleting messages, the API must meet the following status requirements based on the type of chat:
Chat Type | Required API Role | Description |
User Chat | User Pre-Joined | The user must have pre-joined (started) the API (bot) and API is the original sender of the message. |
Group Chat | Admin | The API must be a admin of the group to delete messages. |
Channel | Admin | The API must be an admin in the channel to send messages. |
Response
â
The
messageAck
method is always returned on success.- And additional response is returned with the
message
method, containing a copy of sent message object.
This ensures proper acknowledgment and tracking of message status.
Requests
json{ "method": "recallMessage", "app_id": "90090684293000559", "chat_id": "90090684438172188", "reference": 111111170, "message_id": "d1_l4OtAvMz126176" }
javaelse if(text.equals("recallMessage")){ RecallOutMessage outmsg = new RecallOutMessage(); outmsg.setMessageId("<message_id>"); outmsg.setChatId("<chat_id>"); outmsg.setReference(Utils.getUniqueId()); // make sure to replace message id and chat id with real values api.send(outmsg); }
javascriptlet recallOutMessage = new RecallOutMessage(); recallOutMessage.chatId = "90090684265384780"; recallOutMessage.messageId = "d1_CIRKHD6C12617260"; recallOutMessage.reference = 6915; recallOutMessage.setFromUserId = "90089584801498185";
pythonrecallMsg = RecallOutMessage() recallMsg.message_id="messageId" recallMsg.chat_id="chatId" napi.send(recallMsg)
Response
json{ "method": "messageAck", "ack": { "reference": 111111170, "date": 1742649426917, "gmid": 38, "message_id": "d1_l4OtAvMz126176", "status": "deleted" } }
json{ "method": "message", "message": { "date": 1742649426917, "message_id": "d1_l4OtAvMz126176", "type": "text", "reference": 111111170, "gmid": "38", "bg_color": "0", "from_admin": 1, "chat": { "id": "90090684438172188", "title": "New Chat", "type": "Group" }, "style": 0, "from": { "name": "My First API", "id": "90091783822039252", "terminal": "API", "type": "Bot", "version": null }, "text": null, "app_id": 90090684293000559, "status": "deleted" }, "app_id": 90090684293000559 }