GET {{baseUrl}}/chat/users/:userId/messages?to_contact=<email>&to_channel=<string>&date=<date>&from=<dateTime>&to=<dateTime>&page_size=10&next_page_token=<string>&include_deleted_and_edited_message=<boolean>&search_type=file&search_key=<string>&exclude_child_message=false&download_file_formats=audio/mp4
Searches chat messages or shared files between a user and an individual contact or a chat channel. For user-level apps, pass the Note: For an account-level OAuth app, this API can only be used on behalf of a user who is assigned with a role that has the View or Edit permission for Chat Messages.me
value instead of the userId
parameter.
Scopes: chat_message:read
, chat_message:read:admin
Rate Limit Label: Medium
Body
PARAM
Key | Datatype | Required | Description |
to_contact
|
string | This field allows you to query by the email address or user ID or member ID of a chat contact with whom the user communicated. The API only returns messages sent and/or received between the user and the queried contact. **Note:** * You must provide either the `to_contact` or the `to_channel` query parameter. * When you call the `search_key` and `search_type` query parameters, this query parameter is optional and **not** required. | |
to_channel
|
string | This field queries by the channel ID of a channel in which the user had chat conversations. The API only returns messages sent and/or received by the user in the queried channel. **Note:** * You must provide either the `to_contact` or the `to_channel` query parameter. * When you call the `search_key` and `search_type` query parameters, this query parameter is optional and **not** required. | |
date
|
string | The query date from which to retrieve the chat messages. This value defaults to the current date. **Note:** If you do not provide the `date` or `from` query parameters, the API defaults to the `date` query parameter. | |
from
|
string | The query start date, in `yyyy-MM-dd'T'HH:mm:ss'Z'` format. **Note:** If you provide both the `date` and `from` query parameters, the API queries using the `date` value. | |
to
|
string | The query end date, in `yyyy-MM-dd'T'HH:mm:ss'Z'` format. This value defaults to the current date. | |
page_size
|
number | The number of records returned with a single API call. | |
next_page_token
|
string | The next page token paginates through a large set of results. A next page token is returned whenever the set of available results exceeds the current page size. This token's expiration period is 15 minutes. | |
include_deleted_and_edited_message
|
string | **Optional** <br> Set the value of this field to `true` to include edited and deleted messages in the response. | |
search_type
|
string | The type of search: * `message` — Search messages. * `file` — Search files. **Note:** * If you use this query parameter, you must also include a `search_key` query parameter value. * The `to_contact` and the `to_channel` query parameters are **not** required when you query this parameter. If you do not call them, the API returns **all** contact and channel messages that match the `search_type` query. * If you query this parameter, you **cannot** also query the `include_deleted_and_edited_message` parameter. This query parameter does not support the return of deleted or updated messages. | |
search_key
|
string | The messages or files query string, up to 256 characters. **Note:** * If you use this query parameter, you must also include a `search_type` query parameter value. * The `to_contact` and the `to_channel` query parameters are **not** required when you query this parameter. If you do not call them, the API returns **all** contact and channel messages that match the `search_key` query. * If you query this parameter, you **cannot** also query the `include_deleted_and_edited_message` parameter. This query parameter does not support the return of deleted or updated messages. | |
exclude_child_message
|
boolean | This parameter is used to exclude returning all child messages in a chat, leaving only the parent messages. | |
download_file_formats
|
string | This field returns the download URL in the specified format for different types of files. Currently, we only support the download URL in the mp4 format for audio files. If this parameter is not specified, will return the download URL of the file in its default format. |
HEADERS
Key | Datatype | Required | Description |
Accept
|
string |
RESPONSES
status OK
{
"date": "<date>",
"from": "<dateTime>",
"messages": [
{
"bot_message": {},
"date_time": "<dateTime>",
"files": [
{
"download_url": "<string>",
"file_id": "<string>",
"file_name": "<string>",
"file_size": "<integer>"
},
{
"download_url": "<string>",
"file_id": "<string>",
"file_name": "<string>",
"file_size": "<integer>"
}
],
"rich_text": [
{
"start_position": "<integer>",
"end_position": "<integer>",
"format_type": "Strikethrough",
"format_attr": "<string>"
},
{
"start_position": "<integer>",
"end_position": "<integer>",
"format_type": "BackgroundColor",
"format_attr": "<string>"
}
],
"download_url": "<string>",
"file_id": "<string>",
"file_name": "<string>",
"file_size": "<integer>",
"id": "<string>",
"message": "<string>",
"reply_main_message_id": "<string>",
"reply_main_message_timestamp": "<long>",
"sender": "<string>",
"sender_member_id": "<string>",
"sender_display_name": "<string>",
"status": "Deleted",
"timestamp": "<long>",
"at_items": [
{
"at_contact": "<string>",
"at_contact_member_id": "<string>",
"at_type": 2,
"end_position": "<integer>",
"start_position": "<integer>"
},
{
"at_contact": "<string>",
"at_contact_member_id": "<string>",
"at_type": 1,
"end_position": "<integer>",
"start_position": "<integer>"
}
]
},
{
"bot_message": {},
"date_time": "<dateTime>",
"files": [
{
"download_url": "<string>",
"file_id": "<string>",
"file_name": "<string>",
"file_size": "<integer>"
},
{
"download_url": "<string>",
"file_id": "<string>",
"file_name": "<string>",
"file_size": "<integer>"
}
],
"rich_text": [
{
"start_position": "<integer>",
"end_position": "<integer>",
"format_type": "FontColor",
"format_attr": "<string>"
},
{
"start_position": "<integer>",
"end_position": "<integer>",
"format_type": "Strikethrough",
"format_attr": "<string>"
}
],
"download_url": "<string>",
"file_id": "<string>",
"file_name": "<string>",
"file_size": "<integer>",
"id": "<string>",
"message": "<string>",
"reply_main_message_id": "<string>",
"reply_main_message_timestamp": "<long>",
"sender": "<string>",
"sender_member_id": "<string>",
"sender_display_name": "<string>",
"status": "Edited",
"timestamp": "<long>",
"at_items": [
{
"at_contact": "<string>",
"at_contact_member_id": "<string>",
"at_type": 2,
"end_position": "<integer>",
"start_position": "<integer>"
},
{
"at_contact": "<string>",
"at_contact_member_id": "<string>",
"at_type": 1,
"end_position": "<integer>",
"start_position": "<integer>"
}
]
}
],
"next_page_token": "<string>",
"page_size": 10,
"to": "<dateTime>"
} |
ENDPOINTS