---
title: Chat transformations reference
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

This topic lists variables and commands that you can use in chat transformations. Each section of this topic is dedicated to a single type of object, i.e., messages, [rooms](#rooms-list), [users](#users-list), [notifications](#notifications), [support chat objects](#support-request) and [errors](#errors).

To learn how to use these values in transformations, refer to [Writing transformations for chat](https://docs.kentico.com/k12sp/community-features/chat/customizing-chat-appearance/writing-transformations-for-chat.md). You can also take inspiration in the default transformations within the **Chat - Transformations** page type.

## Messages list

The following table lists data variables that are available when displaying messages. You can either display the variables' values or evaluate them in conditional statements.

| Variable name     | Data type | Description                                                                                                                                                                                                                                                                                                                                   |
| ----------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AuthorID          | int       | Contains the database ID of the chat user who sent the message. If the message is a system message, the value is null.                                                                                                                                                                                                                        |
| IsOneOnOne        | bool      | Returns true if the message is part of a one-on-one chat session.                                                                                                                                                                                                                                                                             |
| IsRejected        | bool      | Returns true if the message has been rejected.                                                                                                                                                                                                                                                                                                |
| IsSupport         | bool      | Indicates if the message is part of a support chat session.                                                                                                                                                                                                                                                                                   |
| LastModified      | date/time | Contains the time when the message was modified.                                                                                                                                                                                                                                                                                              |
| MessageID         | int       | Returns the database ID of the message.                                                                                                                                                                                                                                                                                                       |
| MessageText       | string    | Contains the text of the message.                                                                                                                                                                                                                                                                                                             |
| Modified          | bool      | Indicates if the message has been modified.                                                                                                                                                                                                                                                                                                   |
| Nickname          | string    | Contains the nickname of the sender. If the message is a system message, the value is null.                                                                                                                                                                                                                                                   |
| PostedTime        | date/time | Contains the time when the message was sent.                                                                                                                                                                                                                                                                                                  |
| Recipient         | string    | Returns the nickname of the message's recipient. If the message is addressed to all users in a particular room, i.e., the recipient is not specified, the value is null.                                                                                                                                                                      |
| RecipientID       | int       | Contains the database ID of the recipient, if specified.                                                                                                                                                                                                                                                                                      |
| SystemMessageType | int       | Contains the type of the message represented by an integer number as follows:<br>0 - classic message<br>1 - whisper<br>2 - leave room<br>3 - enter room<br>4 - change nickname<br>5 - kick<br>6 - user invited<br>7 - support greeting<br>8 - permanently leave room<br>9 - permanent kick<br>10 - announcement<br>11 - declined chat request |

The following table lists commands that you can use, for example, in onclick events.

| Command name        | Description                                                                                                                  |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| SelectRecipient     | Selects the sender of the message in the Recipient drop-down list as the recipient of the next message.                      |
| SelectPrevRecipient | If the message is a whisper message, this command selects the recipient of the message as the recipient of the next message. |
| RejectMessage       | Rejects the message.                                                                                                         |

## Rooms list

The following table lists data variables that are available when displaying the list of rooms. You can either display the variables' values or evaluate them in conditional statements.

| Variable name  | Data type | Description                                                                                                                                         |
| -------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| AllowAnonymous | bool      | Indicates whether the room allows anonymous users.                                                                                                  |
| CanManage      | bool      | Indicates whether the current chat user can manage the room.                                                                                        |
| ChatRoomID     | int       | Contains the database ID of the room.                                                                                                               |
| Description    | string    | Contains the room's description.                                                                                                                    |
| DisplayName    | string    | Contains the name of the room.                                                                                                                      |
| HasPassword    | bool      | Indicates whether users are required to enter a password to join the room.                                                                          |
| IsCurrentRoom  | bool      | Indicates whether the current chat user is present in the room. The value takes into account the group that the web part displaying the list is in. |
| IsPrivate      | bool      | Indicates whether the room is private.                                                                                                              |

The following table lists commands that you can use, for example, in _onclick_ events.

| Command name | Description                                                                    |
| ------------ | ------------------------------------------------------------------------------ |
| Abandon      | Removes the current user from the room. Revokes access if the room is private. |
| Delete       | Disables the room and schedules it for deletion.                               |
| Delete       | Opens the room editing dialog box.                                             |

> **Note:** When rendering rooms, you should always wrap them in an anchor tag with "_**JoinRoom**_" as the class attribute value. This will allow users to join the room upon clicking.
>
> ```html
>
> <a class="JoinRoom">${DisplayName}</a>
>
> ```

## Room name

When you want to display the name of the current room in the Chat room name web part, you need to create a separate transformation. You can display the room name in the transformation using the _**RoomName**_ variable.

## Users list

The following table lists data variables that are available when displaying the **list of users in a chat room**. You can either display the variables' values or evaluate them in conditional statements.

| Variable name | Data type | Description                                                 |
| ------------- | --------- | ----------------------------------------------------------- |
| ChatUserID    | int       | Contains the database ID of the chat user.                  |
| IsAdmin       | bool      | Indicates whether the user can manage the room.             |
| IsAnonymous   | bool      | Indicates whether the user is anonymous.                    |
| IsChatAdmin   | bool      | Indicates whether the user has the Manage rooms permission. |
| IsCreator     | bool      | Indicates whether the user is the room's creator.           |
| IsCurrentUser | bool      | Indicates whether the user is the currently logged in user. |
| IsOnline      | bool      | Indicates whether the user is currently on-line.            |
| Nickname      | string    | Contains the user's nickname.                               |

The following table lists commands that you can use, for example, in _onclick_ events.

| Command name | Description                                                                          |
| ------------ | ------------------------------------------------------------------------------------ |
| AddAdmin     | Gives the user administrator rights for the room.                                    |
| DeleteAdmin  | Takes administrator rights away from the user.                                       |
| KickUser     | Kicks the user from the room.                                                        |
| KickUserPerm | Permanently kicks the user from the room. Removes the Join permission from the user. |
| OneOnOneChat | Initiates a one-on-one chat session with the user.                                   |

The following table lists data variables that are available when displaying the **list of users that are on-line in chat**. You can either display the variables' values or evaluate them in conditional statements.

| Variable name | Data type | Description                                |
| ------------- | --------- | ------------------------------------------ |
| ChatUserID    | int       | Contains the database ID of the chat user. |
| IsAnonymous   | bool      | Indicates whether the user is anonymous.   |
| Nickname      | string    | Contains the user's nickname.              |

> **Note:** When listing users who are on-line in chat, you need to include the `${OnClick}` command in an _OnClick_ event. The command ensures that other users will be able to initiate one-on-one chat with the user.
>
> The transformation where you use this command will also be used when inviting users to a room. In this case, the command will make sure that the user gets selected.

## Notifications

The following table lists data variables that are available when displaying notifications. You can either display the variables' values or evaluate them in conditional statements.

| Variable name        | Data type | Description                                                                                                                                                                                                                                                                                                  |
| -------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| IsOneOnOne           | bool      | Indicates whether the notification is a one-on-one chat invitation.                                                                                                                                                                                                                                          |
| KickTime             | int       | Contains the information about how long a user will be kicked from a room. This variable is only available when the **NotificationType** variable has a value of 4.                                                                                                                                          |
| NotificationDateTime | date/time | Contains the time when the notification was created.                                                                                                                                                                                                                                                         |
| NotificationID       | int       | Contains the database ID of the notification.                                                                                                                                                                                                                                                                |
| NotificationType     | int       | Contains the integer representation of the notification type. The possible values are the following:<br>0 - invitation<br>1 - invitation declined<br>2 - invitation accepted<br>3 - nickname automatically changed<br>4 - kick<br>5 - permanent kick<br>6 - administrator added<br>7 - administrator deleted |
| ReadDateTime         | date/time | Contains the time when the notification was read. If the message has not been read, the value is _null._                                                                                                                                                                                                     |
| RoomID               | int       | Contains the database ID of the room of concern. If the notification isn't related to room activity, the value is _null._                                                                                                                                                                                    |
| RoomName             | string    | Contains the name of the room of concern. If the notification isn't related to room activity, the value is _null._                                                                                                                                                                                           |
| SenderNickname       | string    | Contains the nickname of the user who performed the action that caused the notification to appear, e.g., the user who invited another user to a room.                                                                                                                                                        |

The following table lists commands that you can use, for example, in onclick events.

| Command name | Description                                                                                                                    |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------ |
| AcceptEvent  | Accepts an invitation. Applicable only when the **NotificationType** variable has a value of 0.                                |
| DeclineEvent | Declines an invitation. Applicable only when the **NotificationType** variable has a value of 0.                               |
| CloseEvent   | Closes (deletes) a notification. Applicable for all notification types except for invitations (**NotificationType** is not 0). |

## Support request

When writing a transformation for the **Chat support request** web part, you can use the _LiveSupport_ variable, which indicates whether a support person is on-line.

## Initiated chat

Transformations for initiated chat must have the following format:

```html

{{if MessagesTemplate}}
    <code used for messages>
{{else}}
    <code used for the whole web part>
{{/if}}

```

In the code used for messages, you can use the _**Text**_ variable to insert the text of the message.

In the code for the web part, you can use the following variables and commands:

- Accept - command that accepts the initiated chat and opens the support chat window.
- Reject - command that rejects the initiated chat.
- Initiator name - string variable containing the name of the initiator.
- Messages - string that contains all messages.

## Errors

When writing a transformation for errors, you can use the **Message** string variable, which contains the error message. It is recommended to insert it in the following form so as to resolve potential HTML code.

```csharp

{{html Message}}

```

When writing a transformation for the **Delete all** button in the list of errors, you can use the _**DeleteAll**_ command, which deletes the errors.
