# Chat Chat is is designed to support in-session text communication. Zoom truncates messages exceeding a binary size of 10,000 bytes. As a best practice, we recommend a limit of 1000 characters per message. While in a session, users can send chat messages to other users who are also in the session. The following two main components within the SDK will help you implement in-session message features: - The `chatNewMessageNotify` event is triggered when a new message is sent or received. This callback confirms the delivery of the message. - An instance of `ZoomVideoSDKChatHelper` provides methods that can be used to send and receive messages in a session running on your app. ## Send messages There are two different forms of chat in a session: **public** and **private**: - A private message is sent to a specific user in the session. - A public message is sent to all users present in the session. Before sending a private message to a specific user, you must verify that private chat is enabled in your session and obtain the user you would like to send the message to. 1. Obtain an instance of the `ZoomVideoSDKChatHelper` object: ```dart var chatHelper = zoom.chatHelper; ``` 2. Check if chat is disabled prior to setting up chat-related components: ```dart bool isChatDisabled = chatHelper.isChatDisabled; ``` 3. Send a private chat message: ```dart if (chatHelper.isPrivateChatDisabled()) { // You cannot send user-specific messages } else { chatHelper.sendChatToUser(user.userId, "This is a private message"); } ``` 4. Send a public chat message: ```dart chatHelper.sendChatToAll("This is a public message"); ``` ## Receive messages Whenever a chat message is received, the most important pieces of data to make note of are the sender and the content of the message. You can use this information to display the sender information such as the user name and content of the message to the message recipient(s) in your UI. Get notified when a chat message is received: ```dart final chatNewMessageNotify = eventListener.addListener(EventType.onChatNewMessageNotify, (data) async { data = data as Map; ZoomVideoSdkChatMessage newMessage = ZoomVideoSdkChatMessage.fromJson(jsonDecode(data['message'])); chatMessages.value.add(newMessage); messageLength.value += 1; if (listScrollController.hasClients) { listScrollController .jumpTo(listScrollController.position.maxScrollExtent); } }); ``` For more information on how to use the `ZoomVideoSDKUser` object, see the documentation in the [reference](https://marketplacefront.zoom.us/sdk/custom/flutter/index.html). ## Message item definitions Here are some message item definitions to make note of while using the `ZoomVideoSDKChatMessage`: - `messageItem.isChatToAll;` returns `false` for private messages. - `messageItem.isSelfSend;` returns `true` if current user sent the message. - `messageItem.timestamp;` is the time at which the message was sent. - `messageItem.receiverUser;` is the recipient for a private message.