Skip to content

searchMessages

Function · TDLib 1.8.67 · d1085f9c

Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit

searchMessages(
  chat_list: ChatList,
  query: string,
  offset: string,
  limit: int32,
  filter: SearchMessagesFilter,
  chat_type_filter: SearchMessagesChatTypeFilter,
  min_date: int32,
  max_date: int32
) → FoundMessages

chat_list

ChatList

Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported

query

string

Query to search for

offset

string

Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results

limit

int32

The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit

filter

SearchMessagesFilter

Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterUnreadPollVote, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function

chat_type_filter

SearchMessagesChatTypeFilter

Additional filter for type of the chat of the searched messages; pass null to search for messages in all chats

min_date

int32

If not 0, the minimum date of the messages to return

max_date

int32

If not 0, the maximum date of the messages to return