searchMessages

Search the messages of a chat. User-only.

Parameters

chatId: ID

The identifier of the chat to search the messages in.

query: string

The message search query.

from?: ID

If set, only messages sent by from are returned.

A search filter to apply.

after?: number

A message identifier to start searching after.

threadId?: number

The identifier of a message thread to search in.

limit?: number

The maximum number of results to return. Must be in the range of 1-100. Defaults to 100.

Result

Syntax

// Required parameters only.
await client.searchMessages(chatId, query);

// Required parameters + optional parameters.
// Any of the optional parameters can be omitted.
await client.searchMessages(chatId, query, {
    from,
    filter,
    after,
    threadId,
    limit,
});