How to get a chat transcript

4 min. readlast update: 10.17.2023

If you'd like to keep an additional archive of your chats, you can get complete chat transcripts from LiveChat. This can come in handy if you need to keep past chats on file for all of your agents.

There are a couple of ways to go about getting the transcripts.

Getting a transcript from Archives

This is the most basic method that allows you to grab individual chat transcripts. Useful when you don’t need to archive all of your chats but only in some cases.

To get a chat transcript from Archives, follow these steps:

1) Go to Archives and choose the chat you want to get a transcript from.  

2) Click on the three dots in the top right to open the action menu. 

3) Select Send transcript from the menu. 

4) Enter your e-mail. 

5) Click on Send copy to finalize. 

Forwarding chat transcripts to email 

You can forward your chat transcripts to a list of emails. To do that, follow these steps:

1) Go to Settings > Chat settings > Transcript forwarding.

2) Enter an email address (you can enter more than one, by separating them with a comma).  

3) Click on Save changes to finalize. 

The transcripts will be automatically sent to the addresses on the list from the moment you save the changes on. The past transcripts, which were archived before introducing the changes, will not be forwarded.

Extracting transcripts using the API 

An advanced way of getting your past chats. Using the API allows you to get the transcripts in bulk as well as just the specific conversations.

First of all, you will need a list of your chats. You can use the https://api.livechatinc.com/v2/chats?date_from=2015-05-05&date_to=2015-05-31 method to do that. Using this callback, you will be able to extract all chats from a particular time period.

 When calling our Chats endpoint, the response is limited to the latest 100000 records on your LiveChat license, which gives you exactly 4000 pages with 25 chats per page. If you have more than 100000 chats on your license and you want to get them all, you will have to call our API several times.
In the first call, use the data range that covers the first 100000 chats. When making other calls, use the data range that includes the rest of your conversations. 

Here’s an example request that will return all chats from group 1, starting from the 1st of January, 2015 and for one particular agent only:

curl "https://api.livechatinc.com/chats?date_from=2015-01-01&group=1&agent=john.doe@mycompany.com" -u john.doe@mycompany.com:c14b85863755158d7aa5cc4ba17f61cb -H X-API-Version:2

When using our API, remember to always use HTTPS certificate, just as in the example above.

To learn more about the filtering options for this methods, check out our API documentation.

If you just need to store the chats, simply save the results to a file. Alternatively, you can use the API to send chats transcripts from the extracted chats to specified emails.

To do that, you need to use the Send chat transcripts to email method. You need to provide the receiver's email as well as the CHAT_ID of the conversation (CHAT_IDs are available through the [GET] /chats method).

Here’s an example request:

curl "https://api.livechatinc.com/chats/MH022RD0K5/send_transcript" -u john.doe@mycompany.com:c14b85863755158d7aa5cc4ba17f61cb -H X-API-Version:2 -d "to=john.doe@mycompany.com"

If you need to send a bunch of chats this way and/or send them to several recipients, you can write a short script that would loop the request.

Sending transcripts automatically after chats 

The final and most complex method of getting the chat transcripts involves using a LiveChat webhook. Using this method, you can receive a chat transcript after each of your chats.

Start by creating webhook. Go to the Webhooks section and click on the Add a webhook link.

undefined

You will need to provide the Target URL of the webhook. This should be a file on your server. Create a blank file named “transcript-webhook” (for example in PHP), place it on your server and type in the address in the webhook setup.

Click on Add a webhook to finalize the webhook creation.

undefined

Here’s an example of such file:

<?php $data = file_get_contents('php://input'); $data = json_decode($data); if ($data->event_type === 'chat_ended') { // code to send email mail('myemail@company.com', 'Chat transcript', print_r($data, true)); } ?>

Once the file is on your server, the script will automatically send the transcript to the specified email or emails.

Was this article helpful?