How can we help?

How to Export a Specific Customer’s Full Communication History from LiveAgent (Including All Messages)

```html

Exporting Complete Communication History for a Single Customer

This article explains how to export the entire communication transcript and history for a specific customer in LiveAgent.

Overview

LiveAgent provides two methods for exporting customer communications:

  • Export to CSV (Panel Option) - Provides a quick preview of tickets
  • API Method - Provides complete communication history including all messages

If you need only a quick overview of tickets, the Export to CSV option in the panel may be sufficient. However, for a comprehensive export of all communications for a specific customer, you will need to use the LiveAgent API.

Method 1: Using Export to CSV (Limited)

The "Export to CSV" option available in the LiveAgent panel provides only a ticket preview and basic information. This method is suitable for quick exports but does not include the complete message history.

Method 2: Using the API (Complete History)

To export the complete communication history of a specific customer, including all messages, you must use the LiveAgent API v3. This method requires:

  1. Loading all tickets for the given customer
  2. Loading all messages for each of those tickets
  3. Filtering to include only actual messages (excluding internal notes and system information)

Prerequisites

  • An API key created in Configuration > System > API
  • Appropriate permissions enabled for reading tickets and messages
  • Basic knowledge of API calls and scripting (PHP, Python, etc.)

API Endpoints Required

  • /tickets - To retrieve all tickets for a customer
  • /tickets//messages - To retrieve all messages for each ticket

Message Type Filtering

When retrieving messages via the API, you will receive different message types:

  • Type 'M' - Actual customer and agent messages (what you want to export)
  • Type 'N' - Internal notes
  • Type 'H' - Header information
  • Type 'T' - Title information
  • Type 'G' - System/tag information

Filter your export to include only messages with type 'M' to get the actual communication history.

Example Implementation

For a detailed code example on how to implement this using PHP, including how to:

  • Set up API authentication
  • Apply filters to retrieve specific customer tickets
  • Iterate through tickets and messages
  • Export to CSV format

Please refer to the article: Export tickets to CSV

Summary

For a complete export of all communications for a single customer:

  1. Use the LiveAgent API v3 instead of the panel's Export to CSV option
  2. Query the /tickets endpoint to get all customer tickets
  3. For each ticket, query the /tickets//messages endpoint
  4. Filter messages to include only type 'M' (actual messages)
  5. Format and export the results to CSV or your preferred format

This approach ensures you capture the complete communication history rather than just a ticket preview.

```