With the Message search feature, you can retrieve a list of messages that contain a search term from a specific group channel. You can look for exact or partial matches to your search terms and filter search results using message properties like
message_ts_to. You can also use various advanced search functionalities to enhance your search results.
Sendbird's Chat API now supports advanced search functionalities including wildcard, fuzzy search, logical operators, and synonym search for the
query parameter. These operators allow the client app to create and support complicated search conditions, improving search results. You can use these functionalities by setting the
advanced_query parameter to true.
*in search terms.
?matches a single character while
*can match zero or more characters. Below are
queryexamples with a wildcard and their plausible results.
Note: When wildcard is used,
Fuzzy search: Add
~at the end of search terms. Fuzzy search shows similar terms to the search term determined by a Levenshtein edit distance. If your search term is less than two characters, it returns only exact matches. If the search term has between three and five characters, only one character is edited. If the search term is longer than five characters, up to two characters are edited. Below are
queryexamples using fuzzy search and their plausible results.
Logical operators: Use
ORto search for more than one term. You can also use parentheses to group multiple search terms or specify target fields. If you want to look for search terms in not only the content of the message but also specified target fields of the message, such as custom type and data, you can specify the field and search term as a key-value item. Below are
queryexamples with logical operators and their plausible results.
fruit AND (apple OR orange)→ Messages that contain the word "fruit" and either the word "apple" or "orange" in the text.
(message_text:apple OR custom_type:juice) AND (message_text:orange OR custom_type:salad)→ Messages that satisfy either one of the conditions in the first parenthesis and either one of the conditions in the second parenthesis.
Note: Alwyas use uppercase for logical operators.
The properties of search results are much the same as those of messages, except for the
The total number of messages that contain the search term and match with all the specified parameters.
The following table shows a list of actions supported for message search. API endpoints are relative to the base URL allocated to your Sendbird application. In this page, the
/search/messages endpoint refers to
Note: If you want to know the ID and base URL of your application, sign in to the Sendbird Dashboard, go to the Settings > Application > General, and then check the Application ID and API request URL.
- It's recommended that the parameter values in API URLs be urlencoded, such as