telegram api method · layer 229 · #29ee847a

messages.search

usable by users

Search for messages.

definition

messages.search#29ee847a flags:# peer:InputPeer q:string from_id:flags.0?InputPeer saved_peer_id:flags.2?InputPeer saved_reaction:flags.3?Vector<Reaction> top_msg_id:flags.1?int filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages;

parameters

nametypedescription
flags#Flags, see TL conditional fields
peerInputPeerUser or chat, histories with which are searched, or (inputPeerEmpty) constructor to search in all private chats and normal groups (not channels) ». Use messages.searchGlobal to search globally in all chats, groups, supergroups and channels.
qstringText search request
from_idflags.0?InputPeerOnly return messages sent by the specified user ID
saved_peer_idflags.2?InputPeerSearch within the saved message dialog » with this ID.
saved_reactionflags.3?Vector<Reaction>You may search for saved messages tagged » with one or more reactions using this flag.
top_msg_idflags.1?intThread ID
filterMessagesFilterFilter to return only specified message types
min_dateintIf a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned
max_dateintIf a positive value was transferred, only messages with a sending date smaller than the transferred one will be returned
offset_idintOnly return messages starting from the specified message ID
add_offsetintAdditional offset
limitintNumber of results to return, can be 0 to only return the message counter.
max_idintMaximum message ID to return
min_idintMinimum message ID to return
hashlongHash

returns

messages.Messages

errors (16)

codeerrordescription
400BUSINESS_CONNECTION_NOT_ALLOWEDThis method was invoked over a business connection using invokeWithBusinessConnection, but either (1) we're a user, and users cannot invoke methods over a business connection; (2) we're a bot, but business mode was disabled in @botfather or (3); we're a bot, but this method cannot be invoked over a business connection.
400CHANNEL_INVALIDThe provided channel is invalid.
400CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
400CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.
400CHAT_ID_INVALIDThe provided chat id is invalid.
400FROM_PEER_INVALIDThe specified from_id is invalid.
400INPUT_FILTER_INVALIDThe specified filter is invalid.
400INPUT_USER_DEACTIVATEDThe specified user was deleted.
400MSG_ID_INVALIDInvalid message ID provided.
400PEER_ID_INVALIDThe provided peer id is invalid.
400PEER_ID_NOT_SUPPORTEDThe provided peer ID is not supported.
400SEARCH_QUERY_EMPTYThe search query is empty.
400TAKEOUT_INVALIDThe specified takeout ID is invalid.
400USER_ID_INVALIDThe provided user ID is invalid.
401AUTH_KEY_UNREGISTEREDThe specified authorization key is not registered in the system (for example, a PFS temporary key has expired).
403CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.

history

present in layers 2–229 · constructor id changed 9×

idlayers
#07e9f2ab2–23
#d456924846–67
#f288a27568–70
#039e9ea071–75
#8614ef6876–118
#4e17810b119
#0c352eec120–132
#a0fda762133–169
#a7b4e929170
#29ee847a171–229