Export External Chat Logs
Export external chat logs to CSV files.
Steps to export external chat logs
Request URL
GET {base_url}/{api_path}/external_chat_logs/download?access_token={access_token}
Request parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| channel_type | No | String | The channel type. Valid value:
|
| cnv_id | No | String | The unique ID of an external chat log. Note: You can query
external chat log's ID using the Query External Chat Log List interface. |
| current_handler | No | String | The current conversation handler. |
| did_number | No | String | The channel number. |
| from | No | String | The sender of messages. |
| is_dealtwith | No | String | The conversation handling status. Valid value:
|
| only_deleted_handler | No | String | Whether to include conversations handled by deleted extensions or
queues. Valid value:
|
| time_begin | No | String | The start time of the time range. Note: The time format depends on the date and time display
format of PBX (set in on PBX).
Examples:
|
| time_end | No | String | The end time of the time range. Note: The time format depends on the date and time display
format of PBX (set in on PBX).
Examples:
|
| time_type | No | String | The time type. Valid value:
|
| to | No | String | The recipient of messages. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| errcode | Integer | Returned error code.
Note: You can check the error code and
error message in Error Code and Error Message.
|
| errmsg | String | Returned message.
|
| file | String | The names of the exported CSV files. Two CSV files are exported: One containing chat session and the other containing detailed chat history. |
| download_resource_url | String | The download URLs of the exported CSV files. |
Example
Request example
GET /openapi/v1.0/external_chat_logs/download?channel_type=all&access_token=xVx9wX2B38gSD0C2o4y9b9bd5QOPz2MK HTTP/1.1
Host: yeastardocs.example.yeastarcloud.com
Response example
HTTP/1.1 200 OK
{
"errcode": 0,
"errmsg": "SUCCESS",
"file": "PBX-Session_Record-X.25.0.61-download-20261111153930-9TrJl9cVIVT0SiZh.csv,PSE-Chat_Data_Record-83.25.0.61-download-20261111153930-08zxWTUpwrGQcsVL.csv",
"download_resource_url": "/api/download/PBX-Session_Record-X.25.0.61-download-20261111153930-9TrJl9cVIVT0SiZh.csv,/api/download/PBX-Chat_Data_Record-X.25.0.61-download-20261111153930-08zxWTUpwrGQcsVL.csv"
}
Download the exported file
After obtaining the download URL, combine it with the {base_url} and append the{access_token}
parameter to form the complete download link. Use the link to download the exported
file.Download link format
{base_url}/{download_resource_url}?access_token={access_token}
Download link example
https://yeastardocs.example.yeastarcloud.com/api/download/PBX-Session_Record-X.25.0.61-download-20261111153930-9TrJl9cVIVT0SiZh.csv?access_token=WnsTfI4iQWvIafxSrwe7uBw42UCDT4Wq