messages.editMessage #

Edit message

Layer 223

updatesTooLong#e317af7e = Updates;
updateShortMessage#313bc7f8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
updateShortChatMessage#4d6deea5 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:long chat_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
updateShort#78d4dec1 update:Update date:int = Updates;
updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;
updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
updateShortSentMessage#9015e101 flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
---functions---
messages.editMessage#51e842e1 flags:# no_webpage:flags.1?true invert_media:flags.16?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.15?int schedule_repeat_period:flags.18?int quick_reply_shortcut_id:flags.17?int = Updates;

Parameters #

NameTypeDescription
flags#Flags, see TL conditional fields
no_webpageflags.1?trueDisable webpage preview
invert_mediaflags.16?trueIf set, any eventual webpage preview will be shown on top of the message instead of at the bottom.
peerInputPeerWhere was the message sent
idintID of the message to edit
messageflags.11?stringNew message
mediaflags.14?InputMediaNew attached media
reply_markupflags.2?ReplyMarkupReply markup for inline keyboards
entitiesflags.3?Vector<MessageEntity>Message entities for styled text
schedule_dateflags.15?intScheduled message date for scheduled messages
schedule_repeat_periodflags.18?intOnce sent, this message will be automatically re-scheduled to be re-sent again this many seconds in the future, see here » for more info on repeating scheduled messages.
quick_reply_shortcut_idflags.17?intIf specified, edits a quick reply shortcut message, instead ».

Result #

Updates

Both users and bots can use this method #

This method can be invoked over a business connection » #

Possible errors #

CodeTypeDescription
400BOT_DOMAIN_INVALIDBot domain invalid.
400BOT_INVALIDThis is not a valid bot.
400BUSINESS_CONNECTION_INVALIDThe connection_id passed to the wrapping invokeWithBusinessConnection call is invalid.
400BUSINESS_PEER_INVALIDMessages can't be set to the specified peer through the current business connection.
400BUTTON_COPY_TEXT_INVALIDThe specified keyboardButtonCopy.copy_text is invalid.
400BUTTON_DATA_INVALIDThe data of one or more of the buttons you provided is invalid.
400BUTTON_TYPE_INVALIDThe type of one or more of the buttons you provided is invalid.
400BUTTON_URL_INVALIDButton URL invalid.
400BUTTON_USER_PRIVACY_RESTRICTEDThe privacy setting of the user specified in a inputKeyboardButtonUserProfile button do not allow creating such a button.
400CHANNEL_INVALIDThe provided channel is invalid.
406CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
403CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.
400CHAT_FORWARDS_RESTRICTEDYou can't forward messages from a protected chat.
403CHAT_SEND_GIFS_FORBIDDENYou can't send gifs in this chat.
403CHAT_WRITE_FORBIDDENYou can't write in this chat.
400DOCUMENT_INVALIDThe specified document is invalid.
406EDIT_MESSAGE_TEMP_RESTRICTEDMessage editing is temporarily forbidden for this user due to regulatory restrictions.
400ENTITIES_TOO_LONGYou provided too many styled message entities.
400ENTITY_BOUNDS_INVALIDA specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length.
400FILE_PARTS_INVALIDThe number of file parts is invalid.
400IMAGE_PROCESS_FAILEDFailure while processing image.
403INLINE_BOT_REQUIREDOnly the inline bot can edit message.
400INPUT_USER_DEACTIVATEDThe specified user was deleted.
400MEDIA_CAPTION_TOO_LONGThe caption is too long.
400MEDIA_EMPTYThe provided media object is invalid.
400MEDIA_GROUPED_INVALIDYou tried to send media of different types in an album.
400MEDIA_INVALIDMedia invalid.
400MEDIA_NEW_INVALIDThe new media is invalid.
400MEDIA_PREV_INVALIDPrevious media invalid.
400MEDIA_TTL_INVALIDThe specified media TTL is invalid.
403MESSAGE_AUTHOR_REQUIREDMessage author required.
400MESSAGE_EDIT_TIME_EXPIREDYou can't edit this message anymore, too much time has passed since its creation.
400MESSAGE_EMPTYThe provided message is empty.
400MESSAGE_ID_INVALIDThe provided message id is invalid.
400MESSAGE_NOT_MODIFIEDThe provided message data is identical to the previous message data, the message wasn't modified.
400MESSAGE_TOO_LONGThe provided message is too long.
400MSG_ID_INVALIDInvalid message ID provided.
500MSG_WAIT_FAILEDA waiting call returned an error.
400PEER_ID_INVALIDThe provided peer id is invalid.
400PEER_TYPES_INVALIDThe passed keyboardButtonSwitchInline.peer_types field is invalid.
400PHOTO_EXT_INVALIDThe extension of the photo is invalid.
400PHOTO_INVALID_DIMENSIONSThe photo dimensions are invalid.
400PHOTO_SAVE_FILE_INVALIDInternal issues, try again later.
400REPLY_MARKUP_INVALIDThe provided reply markup is invalid.
400REPLY_MARKUP_TOO_LONGThe specified reply_markup is too long.
400SCHEDULE_DATE_INVALIDInvalid schedule date provided.
400TODO_ITEMS_EMPTYA checklist was specified, but no checklist items were passed.
400TODO_ITEM_DUPLICATEDuplicate checklist items detected.
400USER_BANNED_IN_CHANNELYou're banned from sending messages in supergroups/channels.
400WEBPAGE_NOT_FOUNDA preview for the specified webpage url could not be generated.

Styled text with message entities #

How to create styled text with message entities

Scheduled messages #

Telegram allows scheduling messages

Telegram Business #

Users can turn their Telegram account into a business account, gaining access to business features such as opening hours, location, quick replies, automated messages, custom start pages, chatbot support, and more.

keyboardButtonCopy #

Clipboard button

Available only in inline keyboards.

When pressed, clients must copy copy_text to the clipboard.

inputKeyboardButtonUserProfile #

Button that links directly to a user profile

Use this constructor to send a keyboardButtonUserProfile button in an inline keyboard.

keyboardButtonSwitchInline #

Button to switch the user to inline mode

Available only in inline keyboards.

When pressed, clients must insert the bot's username and query into the chat input field, triggering an inline query.

If same_peer is set, clients use the current chat. Otherwise, clients prompt the user to select a chat, filtered by peer_types if specified.

Checklists and to-do lists #

Premium users can now create collaborative checklists in any chat to track tasks and coordinate teams — or manage shopping and to-do lists.