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"
message_id
String
Yes
Old message ID that you want to edit it
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.
caption
String
Conditional
Only use it if you want to update a message with a type other than text, e.g., photo, video, audio, etc.
chat_id
String
Yes
Unique identifier for the target Chat or User_id.
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.

Requests

json
{ "method": "updateMessage", "message_id": "i1_iWBJSzaA129813", "text": "new edits", "caption": "Sample Caption", "to_user_id": "90089668723575679", "chat_id": "9008966872357567" }
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": "message", "message": { "date": 1600168078602, "reference": 2097, "chat": { "name": "Alice Park", "id": "90089668723575679", "terminal": "Mobile", "type": "Contact", "version": "('0HNt','1QBk','2c2H','31RN')" }, "sent_to": { "id": "90091903321704167" }, "message_id": "i1_CD11KwDr126551", "style": 6, "from": { "name": "Alice Park", "id": "90089668723575679", "terminal": "Mobile", "type": "Contact", "version": "('0HNt','1QBk','2c2H','31RN')" }, "text": "Hello", "type": "text" } }