Search messages
This action retrieves a list of messages containing a specific search term. You can set the search scope to either a specific group channel or a specific user. When the search scope is set to a user, the search targets up to 100 group channels joined by the user.
Note: Punctuations and special characters are ignored while indexing, so unless they're being used for advanced search functionalities, they should be removed or replaced in the search term for best results.
HTTP request
Parameters
The following table lists the parameters that this action supports.
Parameters
Required | Type | Description |
---|---|---|
channel_url | string | Specifies the channel URL to restrict the search scope to a specific group channel. |
user_id | string | Restricts the search scope to only retrieve messages from one or more channels where the specified users are members. The search targets up to 100 private and public group channels joined by the user. URL encoding the value is recommended. |
query | string | Searches for messages that contain content that matches the specified search term. If you want the search messages that exactly match a group of keywords, set |
Optional | Type | Description |
---|---|---|
custom_type | string | Specifies the custom channel type to restrict the search scope. This |
limit | int | Specifies the number of messages to return per page. Acceptable values are |
exact_match | boolean | Determines whether to search for messages that contain an exact match for the entire search term. If set to |
advanced_query | boolean | Determines whether to apply advanced search functionalities to the |
synonym | boolean | Determines whether to search for messages containing synonyms of the search term. (Default: |
sort_field | string | Specifies the primary field to sort the results. Acceptable values are the following. |
message_ts_from | long | Restricts the search scope to the messages sent after the specified value in Unix milliseconds format. This includes messages sent exactly on the timestamp. |
message_ts_to | long | Restricts the search scope to the messages sent before the specified value in Unix milliseconds format. This includes messages sent exactly on the timestamp. |
after | string | Marks the starting point of the search results to retrieve in the result set. The |
before | string | Marks the end point of the search results to retrieve in the result set. The |
reverse | boolean | Determines whether to sort the results in reverse order. If set to |
token | string | Specifies a page token that indicates the starting index of a chunk of results to retrieve. If not specified, the index is set as 0. |
target_user_ids | array of strings | Specifies an array of user IDs to restrict the search scope to messages that are sent by the specified IDs. Up to five user IDs are allowed per request. |
with_channel_in_response | boolean | Determines whether to show detailed information about the target channel in the response. (Default: |
Response
If successful, this action returns a list of messages that contain the search term in the response body like the following.
List of response properties
Property name | Type | Description |
---|---|---|
results[] | array of objects | An array of messages that match the specified parameters. |
start_cursor | string | The starting index of the current results. |
end_cursor | string | The ending index of the current results. |
has_prev | boolean | Indicates whether there is a previous page of results. |
has_next | boolean | Indicates whether there is a next page of results. |
next | string | The value that can be used in the |
In the case of an error, an error object is returned. A detailed list of error codes is available here.