Help and support

Resources that will teach you everything about LiveChat.

How to get chat transcripts

by Justyna Kraszewska

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 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 some cases.

You can get a chat transcript from the Archives section. Select the chat, then click on the Send to email button, type in your email and click on Send to email again.

Getting a chat transcript from archives

Forwarding chat transcripts to email

You can forward your chat transcripts to a list of emails. To do that, go the Archives forwarding section, specify the addressees that should receive the transcripts and click on the Save changes button.

Forwarding chat transcripts to email
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.

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& has_goal=1"  -u john.doe@mycompany.com:c14b85863755158d7aa5cc4ba17f61cb  -H X-API-Version:2

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 receivers 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 webhoook. 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.

Adding a webhook in LiveChat

Next, choose the chat ends option in the Event part of the setup. Leave all Data type options ticked.

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

Click on Add a webhook to finalize the webhook creation.

Finalizing webhook creation

Finally, you need to create the aforementioned .php file. The file should include a script that will automatically send a transcript when a chat is finished.

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.

Did you find this helpful? Yes No
Thanks for your feedback.
52% of people found this helpful.