search_messages
Read-onlyIdempotent
Search message content across all chats — semantic + keyword. Use to find what was said: quotes, topics, info exchanged. Pass direction, chat_kind or per_chat for an EXACT text search instead: who wrote it (outgoing = the owner), private chats or groups, one result per chat with the number of matches. That is the way to find the chat of a person by how the owner addresses them, e.g. query='Дима', direction='outgoing', chat_kind='dm', per_chat=true. For chats/threads themselves use search.threads; for files use search.files; for links use search.links.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum messages to return. | |
| query | No | What to search for in message content. | |
| date_to | No | ISO8601 date (YYYY-MM-DD) upper bound. OMIT to skip. | |
| per_chat | No | Exact search only: one result per chat (its newest match) with `matches` = how many messages there matched. OMIT for every message. | |
| chat_kind | No | Exact search only: 'dm' = private chats, 'group' = groups and channels. OMIT for both. | |
| date_from | No | ISO8601 date (YYYY-MM-DD) lower bound. OMIT to skip. | |
| direction | No | Exact search only: 'outgoing' = messages the owner wrote, 'incoming' = messages others wrote. OMIT for both. | |
| whole_word | No | Exact search only: match the query as a whole word ('Дима' finds 'Привет, Дима!' but not 'Димасик'). OMIT to match any part of a word. | |
| in_workspace | No | Run this one call in this workspace id instead of the session's. Nothing is stored; other sessions are not affected. | |
| participant_name | No | Filter to messages involving this participant/contact name. OMIT to search across everyone (do NOT pass an empty string). |