messages.search

Gets back found messages

messages.messages#8c718e87 messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
messages.messagesSlice#c8edce1e flags:# inexact:flags.1?true count:int next_rate:flags.0?int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
messages.channelMessages#99262e37 flags:# inexact:flags.1?true pts:int count:int messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Messages;
messages.messagesNotModified#74535f21 count:int = messages.Messages;
---functions---
messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;

Parameters

Name Type Description
flags # Flags, see TL conditional fields
peer InputPeer User or chat, histories with which are searched, or (inputPeerEmpty) constructor for global search
q string Text search request
from_id flags.0?InputUser Only return messages sent by the specified user ID
filter MessagesFilter Filter to return only specified message types
min_date int If a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned
max_date int If a positive value was transferred, only messages with a sending date smaller than the transferred one will be returned
offset_id int Only return messages starting from the specified message ID
add_offset int Additional offset
limit int Number of results to return
max_id int Maximum message ID to return
min_id int Minimum message ID to return
hash int Hash

Result

messages.Messages

Possible errors

Code Type Description
400 BOT_METHOD_INVALID This method can't be used by a bot
400 CHAT_ADMIN_REQUIRED You must be an admin in this chat to do this
400 INPUT_CONSTRUCTOR_INVALID The provided constructor is invalid
400 INPUT_USER_DEACTIVATED The specified user was deleted
400 PEER_ID_INVALID The provided peer id is invalid
400 PEER_ID_NOT_SUPPORTED The provided peer ID is not supported
400 SEARCH_QUERY_EMPTY The search query is empty
400 USER_ID_INVALID The provided user ID is invalid

Related pages

inputPeerEmpty

An empty constructor, no user or chat is defined.

Pagination in the API

How to fetch results from large lists of objects.