﻿# Live chat messages

> [HTML Version](line_chat_history.html)

The **Live Chat Messages **widget is used to display message history in [Live Chats](chat_lines.md) sessions. Placing it on an app form allows viewing chats on app item pages. This feature is used by:

- Operators and supervisors. Operators can reply to messages in sessions assigned to them and create new ones.

- Users without access to the **Live Chats** workspace. If a group that the user belongs is granted the [read permission](create_line.md#read-access) to sessions, they can view them on the pages of other apps.

## Set up the widget

The **Live Chat Messages **widget can be used only on forms of apps that have:

- An [Account](360009707032.md#account) type property.

- An [App](360009707032.md#app) type property linked with an app with an **Account** type field in its context.

To configure the widget:

1. Drag it from the right-side panel of the [interface designer](interface_designer.md) to the modeling canvas or click the **+Widget** button. Read more about placing widgets on app forms in the [Form templates](360029250931.md) article.

2. In the window that opens, configure the widget’s settings.

**(line_chat_history-1.png)**

- **By account**. Select this option if you want to find sessions linked with the same account and view communications with the same customer from all live chats.

	- **Account field**. Click **<Select>** and specify an [Account](360009707032.md#account) type field from the context of the current app or an app bound with it.

- **By app item**. Select this option to view communications from all live chats associated with the same deal or request.

	- **App**. Click **<Select>**. Choose **Current item** to display all messages associated with items of the app whose form you are configuring. You can also choose another app with an **Account** type field from the current app’s context.

3. On the **Events** and **System** tabs, set settings that are the same for all widgets. You can control widget visibility, configure its hover behavior, set styles, etc. Read more about it in the [System widget settings](common_widget_settings.md) article.

4. Save the settings.

5. To make the widget available to users, click **Save** and **Publish** on the top panel of the interface designer.

## Examples of displaying live chat messages in a widget

### By account

Let’s say you set up two live chats with different instant messengers connected to them. Both live chats have [Contacts](360012584960.md) as the app specified [for binding accounts](create_line.md#connect_account).

A customer registered in the **Contacts** app sends messages to both live chats. Two separate sessions are created in BRIX. After finding out initial information about the customer, the operators link the sessions with the contact using the **+Bind** button. After that, the messenger accounts that the customer used to contact your organization are added to the contact’s page. The contact’s name is now displayed on the right-side panel of both sessions. Operators can go from sessions to the contact’s page and view information about the customer.

You want communications with the customer from all sessions to be displayed on the contact’s page. To do that, you can create a separate tab on the view form of the **Contacts** app and add the **Live Chat Messages **widget to it. In the widget’s settings, select the **By account** option and choose the **Accounts** field from the app’s context.

As a result, on the contact's page you can see their live chat messages.

**(live-chat-message-02.png)**

### By app item

Let’s say two customers from the same company message to live chats that have the [Deals](360012680899.md) app selected [for registering requests](create_line.md#connect_request) in the settings. Two separate sessions are created, and operators bind them to the same app item, for example, to one deal.

If you want all conversations associated with the deal to be available on its page, add the **Live Chat Messages **widget to the view form of the **Deals** app. In its settings, select the **By app item** option and choose **Current item**.

As a result, you can see chats with customers on the deal page.

**(live-chat-message-03.png)**

## Actions with sessions and chats in the widget

After customizing the widget, you can:

1. On the left side of the widget, see a list of active sessions, which operators have linked to the app item. Operators and live chat supervisors, as well as users with [read permission to the sessions](create_line.md#read-access), can view the messages. Operators will be able to respond to messages in the sessions assigned to them directly in the widget.

2. In the chat window, view messages from the session selected on the left. If the customer has contacted the live chat again through the same communication channel, earlier correspondence will also be displayed above the messages from the current session. For example, the customer previously contacted the company’s technical support via email. After resolving the issue, the operator closed the session. If the client writes to the email address again, messages from the previous inquiry will appear in the widget above the messages from the current session. Note that previous messages are identified by the communication channel within the live chat, so earlier correspondence is displayed even if the closed session is not linked to this specific app item.

3. Quickly find a session or message using the search bar on the left panel of the widget. To search for a message within the current session, click the magnifying glass icon at the top of the chat. The search bar will then appear.

4. View messages from all closed sessions related to the item by clicking on **Archive** in the menu on the left.

5. Operators and supervisors can use the widget to create new sessions. To do that, click **+New Session**. In the window that opens, select the live chat, the contact, and the account.

6. Hide or display system messages in chat, such as routing rule applied, operator reassignment, etc. To do this, in the upper panel to the right of the session name, click the three dots icon and set the desired value.