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 Chat API 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
Note: When using advanced search,
exact_matchcan't be set to
*in search terms.
?matches a single character while
*can match zero or more characters. Below are query examples with a wildcard and their plausible results.
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, only exact matches are returned. 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 query examples using fuzzy search and their plausible results.
Logical operators: Use
ORto search for more than one term. The logical operators must be in uppercase. 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 or data, you can specify the field and search term as a key-value item. Below are query examples 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 set of parentheses and either one of the conditions in the second set of parentheses.
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 Sendbird Dashboard, go to Settings > Application > General, and then check Application ID and API request URL.
List of actions