Chat SDK for Unity and Windows v1.2.0
Chat SDK for Unity and Windows

Agora Chat is a highly reliable global communication platform where your users can chat one-to-one, in groups or in chat rooms. Users communicate with text messages, share images, audios, videos, files, emojis, and locations. Agora Chat supplies typing indicators out-of-the-box.

  • The ChatClient class is the entry of the chat SDK. It provides methods to define how to log in to and log out of the chat app, as well as manage the connection between the SDK and the chat server.
  • The ChatManager class provides methods to define how to send and receive messages, manage conversations (including loading and deleting conversations), and download attachments.
  • The ChatMessage class defines message attributes .
  • The Conversation class provides methods to define how to manage conversations.
  • The ContactManager class provides methods to define how to manage chat contacts such as adding, retrieving, modifying, and deleting contacts.
  • The GroupManager class provides methods for group management, like group creation and destruction and member management.
  • The ChatRoomManager class provides methods for chat room management, like joining and leaving the chat room and retrieving the chat room list, and manages member privileges.
  • The PresenceManager class provides methods for you to set message push configuration options.
  • The ChatThreadManager class provides methods t define how to manage message threads, including message thread creation, destruction, and member management.
  • The PushManager class provides methods to define how to manage offline push services.
  • The UserInfoManager class provides methods to manage user attributes, including getting and updating user attributes.

During API calls, the SDK may returns error codes and warning codes. See Error Codes and Warning Codes.

Chat Client

Method Description
InitWithOptions Initializes the SDK.
LoginWithAgoraToken Logs in to the chat server with the user ID and Agora token.
RenewAgoraToken Renews the Agora token.
Logout Logs out of the chat server.
CurrentUsername Gets the user ID of the current logged-in user.
IsConnected Checks whether the SDK is connected to the chat server.
IsLoggedIn Checks whether the user has logged in to the Chat app.
GetLoggedInDevicesFromServer Gets the list of online devices to which you have logged in with a specified account.
GetLoggedInDevicesFromServerWithToken Gets the list of online devices to which you have logged in with a specified account(token).
KickDevice Logs out from a specified account on a device.
KickDeviceWithToken Logs out from a specified account(token) on a device.
kickAllDevices Logs out from a specified account on all devices.
KickAllDevicesWithToken Logs out from a specified account(token) on all devices.
AddConnectionDelegate Adds a connection status listener.
GroupManager Gets the GroupManager class.
RoomManager Gets the ChatRoomManager class.
ChatManager Gets the ChatManager class.
UserInfoManager Gets the UserInfoManager class.
ContactManager Gets the ContactManager class.
PresenceManager Gets the PresenceManager class.
ThreadManager Gets the ChatThreadManager class.
Event Description
OnConnected onConnected Occurs when the SDK connects to the chat server successfully.
OnDisconnected Occurs when the SDK disconnect from the chat server.
OnLoggedOtherDevice Occurs when the current user account logs in to another device.
OnRemovedFromServer Occurs when the current user account is removed from the server.
OnForbidByServer Occurs when the current user account is banned.
OnChangedIMPwd Occurs when the current user account is forced to log out because the login password is changed.
OnLoginTooManyDevice Occurs when the user is forced to log out of the current account because he or she reaches the maximum number of devices that the user can log in to with the current account.
OnKickedByOtherDevice Occurs when the current account is forced to get offline from the device due to login to another device.
OnAuthFailed Occurs when the current account is forced to log out due to an authentication failure.
OnTokenExpired Occurs when the token has expired.
OnTokenWillExpire Occurs when the token is about to expire.
OnAppActiveNumberReachLimitation Occurs when The number of active apps has reached the upper limit.

Chat manager

Method Description
SendMessage Sends a message.
SendConversationReadAck Sends the conversation read receipt to the server.
SendMessageReadAck Sends the read receipt for a message to the server.
SendReadAckForGroupMessage Sends the read receipt for a group message to the server.
GetConversation Gets the conversation object by conversation ID.
MarkAllConversationsAsRead Marks all conversations as read.
UpdateMessage Updates the local message.
DownloadAttachment Downloads the message attachment.
DownloadThumbnail Downloads the message thumbnail.
ImportMessages Imports messages to the local database.
LoadAllConversations Gets all local conversations.
DeleteConversation Deletes a conversation and its local messages from the local database.
DeleteConversationFromServer Deletes the specified conversation and its historical messages from the server.
FetchGroupReadAcks Uses the pagination to get read receipts for a group message from the server.
SearchMsgFromDB Retrieves messages of a certain type in the conversation from the local database.
FetchHistoryMessagesFromServer Gets historical messages of the conversation from the server.
FetchHistoryMessagesFromServerBy Gets historical messages of a conversation from the server according to FetchServerMessagesOption.
RemoveMessagesBeforeTimestamp Deletes local historical messages with a Unix timestamp before a specified one.
ReportMessage Reports an inappropriate message.
FetchSupportLanguages Gets all languages supported by the translation service.
TranslateMessage Translates a text message.
AddReaction Adds a Reaction.
RemoveReaction Deletes a Reaction.
GetReactionList Gets the list of Reactions.
GetReactionDetail Gets the Reaction details.
GetConversationsFromServerWithPage Gets the some conversations from the server .
GetConversationsFromServerWithCursor Gets the some conversations from the server .
RemoveMessagesFromServer Removes messages in a conversation (from both local storage and the server).
FetchCombineMessageDetail Fetch combined message in detail.
ModifyMessage Modify a sent message.
AddChatManagerDelegate Adds the message listener.
RemoveChatManagerDelegate Remove the conversation listener.
Event Description
OnMessagesReceived Occurs when a message is received.
OnCmdMessagesReceived Occurs when a command message is received.
OnMessagesRead Occurs when a read receipt is received for a message.
OnGroupMessageRead Occurs when a read receipt is received for a group message.
OnReadAckForGroupMessageUpdated Occurs when the update for the group message read status is received.
OnMessagesDelivered Occurs when a delivery receipt is received.
OnMessagesRecalled Occurs when a received message is recalled.
MessageReactionDidChange Occurs when a message Reaction changed.
OnConversationsUpdate Occurs when the conversation is updated.
OnConversationRead Occurs when the conversation read receipt is received.
OnMessageContentChanged Occurs when a sent message is modified.

Messages

Method Description
conversationId The conversation ID, which depends on the conversation type.
UnReadCount Gets the number of unread messages in the conversation.
MarkAllMessageAsRead Marks all unread messages as read.
MessagesCount Gets the number of all unread messages in the conversation in the local database.
IsThread Checks whether the current conversation is a thread conversation.
LoadMessages Loads the messages from the local database, starting from a specific message ID.
LoadMessage Gets the message with message ID.
MarkMessageAsRead Marks a message as read.
DeleteMessage Deletes a message in the local database.
LastMessage Gets the latest message in the conversation.
LastReceivedMessage Gets the latest received message in the conversation.
DeleteAllMessages Deletes all the messages in the conversation from the memory and local database.
Ext Sets or Gets the extension field of the conversation.
InsertMessage Inserts a message to the conversation in the local database。.
AppendMessage Inserts a message to the end of the conversation in the local database.
UpdateMessage Updates a message in the local database.
IsPinned Whether a conversation is pinned.
PinnedTime The timestamp when the conversation is pinned. The unit is millisecond.
DeleteMessages Deletes messages sent or received in a certain period from the local database.
Status Gets the message sending or reception status.
Body Gets the message body.
ServerTime Gets the Unix timestamp when the server receives the message.
LocalTime Gets the local timestamp of the message.
IsThread Sets or Get whether the message is a threaded message.
ChatThread Gets the overview of the message thread.
CreateSendMessage Creates a message instance for sending.
CreateReceiveMessage Creates a received message instance.
CreateTextSendMessage Creates a text message for sending.
CreateVoiceSendMessage Creates a voice message for sending.
CreateImageSendMessage Creates an image message for sending.
CreateVideoSendMessage Creates a video message for sending.
CreateLocationSendMessage Creates a location message for sending.
CreateFileSendMessage Creates a file message for sending.
CreateCombineSendMessage Creates a combined message for sending.
From Gets or sets the user ID of the message sender.
To Sets or gets the user ID of the message recipient.
MsgId Gets or sets the message ID.
SetAttribute Sets a message extension attribute of the String type.
GetAttributeValue Gets a message extension attribute of the String type.
HasReadAck Gets whether the message is read.
HasDeliverAck Gets whether the message is successfully delivered.
IsRead Checks whether the message is read or not.
ConversationId Gets the conversation ID.
ReactionList Gets the list of Reactions.
MessageOnlineState Whether the message gets delivered to an online user.
ReceiverList The list of IDs of group or chat room members that receive a message.
DeliverOnlineOnly Whether the message is delivered only when the recipient(s) is/are online.
Event Description
Success Occurs when the method succeeds.
Error Occurs when an error occurs. See Error.
Progress Occurs when the progress updates.

Contacts

Method Description
AddContact Adds a new contact.
DeleteContact Deletes a contact.
GetAllContactsFromServer Gets all contacts from the server.
AddUserToBlockList Adds a user to block list.
RemoveUserFromBlockList Removes the contact from the block list.
GetBlockListFromServer Gets the block list from the server.
DeclineInvitation Declines a friend invitation.
GetAllContactsFromDB Gets the contact list from the local database.
GetSelfIdsOnOtherPlatform Gets the unique self-ID list of the current user on the other devices.
AddContactManagerDelegate Registers a new contact listener.
Event Description
OnContactAdded Occurs when user is added as a contact by another user.
OnContactDeleted Occurs when a user is removed from the contact list by another user.
OnContactInvited Occurs when a user receives a friend request.
OnFriendRequestAccepted Occurs when a friend request is approved.
OnFriendRequestDeclined Occurs when a friend request is declined.

Chat Group

Method Description
CreateGroup Creates a group instance.
DestroyGroup Destroys the group instance.
LeaveGroup Leaves a group.
JoinPublicGroup Joins a public group.
AddGroupMembers Adds users to the group.
DeleteGroupMembers Removes members from the group.
GetGroupSpecificationFromServer Gets group information from the server.
FetchJoinedGroupsFromServer Gets all groups of the current user from the server with pagination.
FetchPublicGroupsFromServer Gets public groups from the server with pagination.
ChangeGroupName Changes the group name.
ChangeGroupDescription Changes the group description.
AcceptGroupInvitation Accepts a group invitation.
DeclineGroupInvitation Declines a group invitation.
AcceptGroupInvitation Approves a group request.
DeclineGroupJoinApplication Declines a group request.
applyJoinToGroup Requests to join a group.
BlockGroup Blocks group messages.
UnBlockGroup Unblocks group messages.
BlockGroupMembers Adds the user to the group block list.
UnBlockGroupMembers Removes users from the group block list.
GetGroupBlockListFromServer Gets the group block list with pagination.
GetGroupMemberListFromServer Gets the member list of a group with pagination.
ChangeGroupOwner Transfers the group ownership.
AddGroupAdmin Adds a group admin.
RemoveGroupAdmin Removes a group admin.
UnMuteGroupMembers Mutes group members.
UnMuteGroupMembers Unmutes group members.
GetGroupMuteListFromServer Gets the mute list of the group from the server.
GetGroupBlockListFromServer Gets the block list of group from the server with pagination.
AddGroupAllowList Adds members to the allow list.
RemoveGroupAllowList Removes members from the allow list.
GetGroupAllowListFromServer Gets the allow list of group from the server.
UpdateGroupAnnouncement Updates the group announcement.
GetGroupAnnouncementFromServer Gets the group announcement from the server.
UploadGroupSharedFile Uploads the shared file to the group.
GetGroupFileListFromServer Gets the shared file list from the server.
DeleteGroupSharedFile Removes the shared file of the group.
CheckIfInGroupAllowList Gets whether the current user is on the allow list of the group.
FetchMemberAttributes Fetch group members custom attributes.
SetMemberAttributes Sets custom attributes of a group member.
DownloadGroupSharedFile Downloads the shared file of the group.
AddGroupManagerDelegate Registers a group change listener.
Event Description
OnInvitationReceivedFromGroup Occurs when the user receives a group invitation.
OnRequestToJoinReceivedFromGroup Occurs when the group owner or administrator receives a group request from a user.
OnRequestToJoinAcceptedFromGroup Occurs when a group request is accepted.
OnRequestToJoinDeclinedFromGroup Occurs when a group request is declined.
OnInvitationAcceptedFromGroup Occurs when a group invitation is accepted.
OnInvitationDeclinedFromGroup Occurs when a group invitation is declined.
OnUserRemovedFromGroup Occurs when the current user is removed from the group by the group admin.
OnDestroyedFromGroup Occurs when a group is destroyed.
OnAutoAcceptInvitationFromGroup Occurs when the group invitation is accepted automatically.
OnMuteListAddedFromGroup Occurs when one or more group members are muted.
OnMuteListRemovedFromGroup Occurs when one or more group members are unmuted.
OnAddAllowListMembersFromGroup Occurs when one or more group members are added to the allowlist.
OnRemoveAllowListMembersFromGroup Occurs when one or more members are removed from the allowlist.
OnAllMemberMuteChangedFromGroup Occurs when all group members are muted or unmuted.
OnAdminAddedFromGroup Occurs when a member is set as an admin.
OnAdminRemovedFromGroup Occurs when a member's admin privileges are removed.
onOwnerChanged Occurs when the group ownership is transferred.
onMemberJoined Occurs when a member joins a group.
onMemberExited Occurs when a member proactively leaves the group.
onAnnouncementChanged Occurs when the announcement is updated.
onSharedFileAdded Occurs when a shared file is added to a group.
onSharedFileDeleted Occurs when a shared file is removed from a group.
OnUpdateMemberAttributesFromGroup Occurs when a custom attribute(s) of a group member is/are changed.

Chat Room

Method Description
CreateRoom Creates a chat room.
DestroyRoom Destroys a chat room.
JoinRoom Joins a chat room.
LeaveRoom Exits a chat room.
FetchPublicRoomsFromServer Gets chat room data from the server with pagination.
FetchRoomInfoFromServer Gets details of a chat room from the server.
ChangeRoomName Changes the chat room name.
ChangeRoomDescription Modifies the chat room description.
FetchRoomMembers Gets the chat room member list.
MuteRoomMembers Mutes members in a chat room.
UnMuteRoomMembers Unmutes members in a chat room.
AddRoomAdmin Adds a chat room admin.
RemoveRoomAdmin Removes the administrative privilege of a chat room admin.
FetchRoomMuteList Gets the list of muted chat room members from the server.
DeleteRoomMembers Removes members from a chat room.
BlockRoomMembers Adds members to the block list of the chat room.
UnBlockRoomMembers Removes members from the block list of the chat room.
FetchRoomBlockList Gets the chat room block list with pagination.
AddAllowListMembers Adds members to the allow list of the chat room.
RemoveAllowListMembers Removes members from the chat room block list.
MuteAllRoomMembers Mutes all members.
UnMuteAllRoomMembers Unmutes all members.
UpdateRoomAnnouncement Updates the chat room announcement.
FetchRoomAnnouncement Gets the chat room announcement from the server.
AddAttributes Adds custom chat room attributes.
FetchAttributes Gets the list of custom chat room attributes based on the attribute key list.
RemoveAttributes Removes custom chat room attributes by the attribute key list.
FetchAllowListFromServer Checks whether the current member is on the chat room block list.
GetChatRoom Gets the details of a chat room from the memory.
AddRoomManagerDelegate Adds a chat room event listener.
Event Description
OnDestroyedFromRoom Occurs when the chat room is destroyed.
OnMemberJoinedFromRoom Occurs when a member joins the chat room.
OnMemberExitedFromRoom Occurs when a member exits the chat room.
OnRemovedFromRoom Occurs when a member is removed from a chat room.
OnMuteListAddedFromRoom Occurs when the chat room member(s) is/are added to the mute list.
OnMuteListRemovedFromRoom Occurs when the chat room member(s) is/are removed from the mute list.
OnAdminAddedFromRoom Occurs when a chat room member is set as an admin.
OnAdminRemovedFromRoom Occurs when the chat room member(s) is/are removed from the admin list.
OnOwnerChangedFromRoom Occurs when the chat room owner is changed.
OnAnnouncementChangedFromRoom Occurs when the chat room announcement changes.
OnChatroomAttributesChanged Occurs when the custom chat room attribute(s) is/are updated.
OnChatroomAttributesRemoved Occurs when the custom chat room attribute(s) is/are removed.
OnSpecificationChangedFromRoom Occurs when specifications of a chat room change.
OnAddAllowListMembersFromChatroom Occurs when the chat room member(s) is/are added to the allow list of a chat room.
OnRemoveAllowListMembersFromChatroom Occurs when the chat room member(s) is/are removed from the allow list of a chat room.
OnRemoveFromRoomByOffline Occurs when a member is removed from a chat room because he or she gets offline.

Presence

Method Description
PublishPresence Publishes a custom presence state.
SubscribePresences Subscribes to a user's presence states.
UnsubscribePresences Unsubscribes from a user's presence states.
FetchSubscribedMembers Uses pagination to get a list of users whose presence states you have subscribed to.
FetchPresenceStatus Gets the current presence state of users.
AddPresenceManagerDelegate Adds a listener.
Event Description
OnPresenceUpdated Occurs when the presence state of the user subscribed is updated.

Threading

Method Description
CreateThread Creates a message thread.
JoinThread Joins a message thread.
DestroyThread Destroys the message thread.
LeaveThread Leaves a message thread.
GetThreadDetail Gets the details of the message thread from the server.
ChangeThreadName Changes the name of the message thread.
RemoveThreadMember Removes a member from the message thread.
FetchThreadMembers Gets a list of members in the message thread with pagination.
FetchMineJoinedThreadList Uses the pagination to get the list of message threads that the current user has joined.
FetchThreadListOfGroup Uses the pagination to get the list of message threads in the specified group.
GetLastMessageAccordingThreads Gets the last reply in the specified message threads from the server.
AddThreadManagerDelegate Adds the message thread event listener, which listens for message thread changes, such as the message thread creation and destruction.
Event Description
OnChatThreadCreate Occurs when a message thread is created.
OnChatThreadUpdate Occurs when a message thread is updated.
OnChatThreadDestroy Occurs when a message thread is destroyed.
OnUserKickOutOfChatThread Occurs when the current user is removed from the message thread by the group owner or a group admin to which the message thread belongs.

User Attributes

Method Description
UpdateOwnInfo Modifies the current user's information.
FetchUserInfoByUserId Gets user information with user ID.