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:

  • all: All channel types.
  • sms: SMS channels.
  • whatsapp: WhatsApp.
  • facebook: Facebook.
  • livechat: Live chat.
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:

  • 0: Unhandled.
  • 1: Handled.
  • 2: All statuses.
only_deleted_handler No String Whether to include conversations handled by deleted extensions or queues.

Valid value:

  • 0: Disabled.
  • 1: Enabled.
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 System > Date and Time > Display Format on PBX).

Examples:

  • If the display format is Month/Day/Year and is 24-hours format, then the valid time format is MM/DD/YYYY HH:mm:ss.
  • If the display format is Year/Month/Day and is 12-hours format, then the valid time format is YYYY/MM/DD HH:mm:ss AM or YYYY/MM/DD HH:mm:ss PM.
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 System > Date and Time > Display Format on PBX).

Examples:

  • If the display format is Month/Day/Year and is 24-hours format, then the valid time format is MM/DD/YYYY HH:mm:ss.
  • If the display format is Year/Month/Day and is 12-hours format, then the valid time format is YYYY/MM/DD HH:mm:ss AM or YYYY/MM/DD HH:mm:ss PM.
time_type No String The time type.

Valid value:

  • time: Conversation creation time.
  • last_active_time: Last active time of conversations.
to No String The recipient of messages.

Response parameters

Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
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