Configure chat to have history sent by mail

General settings for activating chat history

After a live chat with an agent via the Chat Frontend, the customer can view the chat history. For this, the “Show History” button is shown after the chat ends. After that, the history can be printed or sent by email.

Display of chat history after clicking on ‘Show history’

To let the customer get the chat history by email, some settings are needed in the Supervisor Interface:

  • In the menu Administration -> Chat -> Frontend, under the tab Config, a chat front end is set up and the option Chat history per email is turned on for the frontend.
  • In Administration -> Answers -> Templates, a reply template that embeds and sends the chat log needs to be created. For this, a new template is created by clicking the NEW button and naming it chat_report. In the template, the chat history and/or chat attachment JavaScript is added. For that, the following options are selected in the template editor:: 
    • “Developer” > “Default Scripts” > “Chat History”; or/and
    • “Developer” > “Default Scripts” > “Chat Attachments”.
      Both entries add ready JavaScript code to the template. This code runs when the template is added to an email. The template can be formatted like any other template; see: Answers . The chat log is sent as plain text; its look cannot be changed.

  • In the Administration -> System -> System settings -> Chat, settings for the chat are added. The ID of the Email incoming account is put in the “Chat send mail account”. The ID is shown in the Administration -> System -> Incoming account settings. After that, the ID is noted in the “General” tab. The template name (chat_report) is set in the “Chat send mail template” field.

After saving these settings, a customer can request an email with the chat log.

Configure chatbot to have history sent by mail 

The chatbot can be configured to send the chat history, including any files, to the customer or to create a ticket in the system. For this, the chatbot must be set up in the system, and a new rule for the agent must be set in the knowledge base:

  • Matching: The trigger phrase is entered to prompt the chatbot to send an email to the customer, for example: (“(I would like to have chat history sent by email|Send me chat history)”)
  • Actions: The parameters for the action are set.

Configuration for sending directly to customers

If the chat history is to be sent directly to the customer, the “createAndSendTicket” function must be used. In this case, the configuration in Composer (Actions tab) might look as follows:

Chat c = getChat();

HashTable m1;
m1.put("to", customerEmail);
m1.put("categoryName","Chats");
m1.put("languageCode","en");
m1.put("templateName","Chat_template");
m1.put("accountId",300);
m1.put("subject","Chat history for ");
m1.put("html","Body content");
c.createAndSendTicket(flattableToJson(newHashtable(m1)));
agent.say("mail send to customer");

Configuration for creating a ticket

If a ticket is to be created from the chat history, the “receiveTicket” function must be used. In this case, the configuration in Composer (Actions tab) might look as follows:

Chat c = getChat();

HashTable m2;

m2.put("from", "incommingEmail");
m2.put("languageCode", "en");
m2.put("templateName", "Chat_template");
m2.put("accountId", 300);
m2.put("subject", "Chat history for ");

c.receiveTicket(flattableToJson(new Hashtable(m2)));

agent.say("Ticket created.");

The following parameters must be taken into account during configuration:

  • To: The variable “customerEmail” can be set here. It will be replaced by the email address to which the chat history is sent.
  • From: A variable such as “incomingEmail” or an email account can be specified here. 
  • languageCode: An ISO language code can be specified here.
  • templateName: This is the name of the template to be sent. Please note that the template must contain the chat history JavaScript (as described above) so that the chat history can be included in the email.
  • CategoryName: The chat category name is entered. The same category must be set in the template that holds chat history or chat attachment JavaScript.
  • AccountId: The ID of the incoming account. The ID is shown in the Administration -> System -> Incoming Account menu. After opening the account, the ID is shown in the “General” tab.
  • Subject (optional): The text that will be shown as the subject of the email with the chat history is entered here.
  • Html (optional): Here you can enter the content for the email body. 
  • Agent.say (“mail send to customer”): Text for the customer after the email is sent is entered here.