Chat Export Overview πŸ“™

✴️ Export your Agent's Chat History



Chat Export enables the export of all conversations between your agent and the users, suitable for user-intelligence platforms to provide powerful insights based on real data from your users. All you need to do is specify the `agent_id` and the `from/to` timeframe. A zip archive with the JSON conversations will be created for download

✴️ Step 1: Create an export request

POST https://api.d-id.com/agents/chats/exports | Create a chat export

{
  "agent_id": "agt_jXn555Rf6",
  "from": "2024-05-20T12:00:00Z",
  "to": "2024-05-25T12:00:00Z"
}
{
  "export_id": "q7K555Ay1"
}
{
  "agent_id": "agt_jXn555Rf6"
}

πŸ“˜

Expiration period

The chat archive will be deleted from the database 7 days after the export creation date

Note: If the response is too long, a pagination token will be provided to create further exports of the agent data. It should be used to continue the chat export process for the same agent. Once the final result page is reached, a token will not be provided with the endpoint response.


✴️ Step 2: Get the chat export

Use the export_id (from the previous step) with the Get chat logs endpoint to download the result file.

GET https://api.d-id.com/agents/chats/exports/<id> | Get a chat export

{
  "agent_id": "agt_jXn555Rf6",
  "completed_at": "2024-05-30T09:00:00.530Z",
  "created": "2024-05-30T09:00:00.401Z",
  "expires": 1717555392,
  "total_files_size": 166192,
  "created_by": "auth0|65bc286c5cb410dbaabbdddf",
  "status": "done",
  "result": {
    "result_url": "https://d-id-agents-chat-exports-prod.s3.us-west-2.amazonaws.com/auth0%65bc286c5cb410dbaabbdddf/yLP_y8WX_kdcpuA07.zip"
  },
  "total_files_count": 134,
  "modified": "2024-05-30T09:00:00.530Z",
  "export_id": "q7K555Ay1",
  "owner_id": "auth0|65bc286c5cb410dbaabbdddf"
}
{
  "agent_id": "agt_jXn555Rf6"
}

✴️ Step 3: Analyze the ZIP file

The zip file will contain multiple JSON files, each representing a separate chat session
Each JSON file is named according to the following format: _UTCtimestamp_#_CHAT_ID_.json

Example: 1715855558332#cht_9e_qi7Us0-zdqo2qwMvz6.json

{
    "chatId": "cht_9e_qi7Us0-zafg1xbGvz6",
    "ownerId": "auth0|65bc286c5cb410dbaabbdddf",
    "agentId": "agt_jXn555Rf6",
    "messages": [
        {
            "content": "Hello, welcome to our FAQ page.  How can I assist you today?",
            "id": "f40b543d8ef4e",
            "role": "assistant",
            "created_at": "2024-05-16T10:23:42.308Z"
        },
        {
            "id": "11ce5435bc0dc3",
            "role": "user",
            "content": "what features does your bank offer for online banking",
            "created_at": "2024-05-16T10:24:09.505Z"
        },
        {
            "content": "MemaBank provides comprehensive digital banking features, including the ability to deposit checks by taking a photo, manage investments online, convert currencies with a few clicks, pay over 400 billers directly, send money to anyone, anywhere, and more.",
            "role": "assistant",
            "id": "7HLj4353fdDei9",
            "created_at": "2024-05-16T10:24:13.692Z"
        }
    ],
    "externalId": "ec6efa825f342qt44_10ce074f276f",
    "origin": "https://memabank.com/faq-page"
}

πŸ‘

Tip

In order to get data insights aggregated based on your users' conversations, you can use the exported json files with user-Intelligence LLM based platforms, like this platform.


✴️ Support


Have any questions? We are here to help! Please leave your question in the Discussions section and we will be happy to answer shortly.

Ask a question