logo
Use this message to update an existing message. On success, the sent message is returned with the status 'updated.'
Field
Type
Required
Description
method
String
Yes
"updateMessage"
app_id
String
Yes
Unique identifier for App to which the message belongs.
chat_id
String
Yes
Unique identifier for the target Chat or User_id.
message_id
String
Yes
Old message ID that you want to edit.
reference
Long
Yes
Unique local identifier for the target Chat or User.
text
String
Conditional
Only use it if you want to update a message with the type of text.
text_file
Text_File
Conditional
Only available when its type is text_file.
photo
Conditional
Only available when its type is photo.
gif
Conditional
Only available when its type is gif.
sticker
Sticker
Conditional
Only available when its type is sticker.
video
Conditional
Only available when its type is video.
audio
Conditional
Only available when its type is audio.
voice
Conditional
Only available when its type is voice.
document
Conditional
Only available when its type is document.
location
Conditional
Only available when its type is location.
contact
Conditional
Only available when its type is contact.
article
Article
Conditional
Only available when its type is article. Article must be a nandbox article.
url
String
Conditional
Only available when its type is article. Articleโ€™s URL.
caption
String
Conditional
Only use it if you want to update a message with a type apart from text (e.g., photo, video, audio, etc.).
menu_ref
String
Optional
Menu reference for an existing predefined menu: The menu will be displayed as an inline menu associated with the message. To hide the inline menu from the message, set menu_ref to an empty string.
inline_menu
Array of Menu
Optional
Inline menu object to hold menus: The outdated menu will take the place of the previous one. If both inline_menu and menu_ref are defined, the priority goes to inline_menu unless menu_ref is set to an empty string.

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 updating a message, ensure the following conditions are met:
Action
Required Permission
Description
Updating a message
"Update Message"
The API must have the "Update Message" permission to update messages in a chat (user, group, or channel).
  • Preconditions for API Role in the Chat
Before updating 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 must be the original sender of the message.
Group Chat
Admin
The API must be a admin of the group to send 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 the sent message object.
This process ensures proper acknowledgment and tracking of message status.

Requests

json
{ "method": "updateMessage", "app_id": "90090684293000559", "chat_id": "90090684438172188", "reference": 111111171, "message_id": "d1_cdbTJTTV126179", "text": "Hello World!" }
java
UpdateOutMessage updateOutMessage = new UpdateOutMessage(); updateOutMessage.setMessageId("i1_iWBJSzaA129813"); updateOutMessage.setText("new edits"); updateOutMessage.setMenuRef("myMenuRef"); api.send(updateOutMessage);
javascript
const newMsg = new UpdateOutMessage(); newMsg.message_id = incomingMsg.message_id; newMsg.text = "new edits"; newMsg.reference = incomingMsg.reference; newMsg.to_user_id = incomingMsg.from.id; newMsg.chat_id = incomingMsg.chat.id; api.send(JSON.stringify(newMsg));
python
newMsg = UpdateOutMessage() newMsg.chat_id="chatId" newMsg.text="new message" newMsg.message_id="messageId" napi.send(newMsg)

Response

json
{ "method": "messageAck", "ack": { "date": 1742649824308, "gmid": 41, "message_id": "d1_cdbTJTTV126179", "status": "updated", "reference": 111111171 }
json
{ "method": "message", "message": { "date": 1742649824308, "reference": 111111171, "gmid": "41", "from_admin": 1, "chat": { "id": "90090684438172188", "title": "New Chat", "type": "Group" }, "message_id": "d1_cdbTJTTV126179", "style": 0, "from": { "name": "My First API", "id": "90091783822039252", "terminal": "API", "type": "Bot", "version": null }, "text": "Hello World!", "type": "text", "app_id": 90090684293000559, "status": "updated" }, "app_id": 90090684293000559 }