AgoraChatSDK 1.3.1
AgoraChatSDK

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.

Chat Client

Method Description
initializeSDKWithOptions: Initializes the SDK.
loginWithUsername:token:completion: Logs in to the chat server with the user ID and token.
renewToken: Renews the token.
logout:completion: 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.
addDelegate: Adds a delegate.
addLogDelegate:delegateQueue: Adds the log callback delegate of SDK.
groupManager Gets the GroupManager class.
pushManager Gets the PushManager class.
roomManager Gets the RoomManager 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
connectionStateDidChange: Occurs when the SDK connect status changed.
tokenDidExpire: Occurs when the token has expired.
tokenWillExpire: Occurs when the token is about to expire.
autoLoginDidCompleteWithError: Occurs when the SDK auto login success or failed.
logDidOutput: Occurs when the log creates.

Chat manager

Method Description
sendMessage:progress:completion: Sends a message.
ackConversationRead:completion: Sends the conversation read receipt to the server.
sendMessageReadAck:toUser:completion: Sends the read receipt for a message to the server.
sendGroupMessageReadAck:toGroup:content:completion: Sends the read receipt for a group message to the server.
getConversation:type:createIfNotExist: Gets the conversation object by conversation ID.
importMessages:completion: Import messages to the memory and local database.
updateMessage:completion: Updates the local message.
downloadMessageAttachment:progress:completion: Downloads the message attachment.
downloadMessageThumbnail:progress:completion: Downloads the message thumbnail.
getAllConversations Gets all local conversations.
getConversationsFromServer: Gets the conversation list from the server.
getConversationsFromServerByPage Gets the conversation list from server by page.
deleteConversations:isDeleteMessages:completion: Deletes a conversation and its local messages from the local database.
deleteServerConversation 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.
loadMessages Retrieves messages of a certain type in the conversation from the local database.
deleteMessagesBeforeTimestamp Deletes local historical messages with a Unix timestamp before a specified one.
reportMessageWithId:tag:reason:completion: Reports an inappropriate message.
fetchSupportedLanguages: Gets all languages supported by the translation service.
translateMessage:targetLanguages:completion: Translates a text message.
addReaction:toMessage:completion: Adds a Reaction.
removeReaction:fromMessage:completion: Deletes a Reaction.
getReactionList Gets the list of Reactions.
getReactionDetail Gets the Reaction details.
fetchMessagesFromServer Retrieves messages of a certain type in the conversation from server.
pinMessage Pins a message.
unpinMessage Unpins a message.
addDelegate Adds the message listener.
Event Description
messagesDidReceive: Occurs when a message is received.
cmdMessagesDidReceive: Occurs when a command message is received.
messagesDidRead: Occurs when a read receipt is received for a message.
groupMessageDidRead:groupAcks: Occurs when a read receipt is received for a group message.
groupMessageAckHasChanged Occurs when the update for the group message read status is received.
messagesDidDeliver: Occurs when a delivery receipt is received.
messagesInfoDidRecall: Occurs when a received message is recalled.
messageStatusDidChange Occurs when a message change notification is received, including the message ID change.
messageReactionDidChange: Occurs when a message Reaction changed.
conversationListDidUpdate: Occurs when the conversation is updated.
onConversationRead:to: Occurs when the conversation read receipt is received.
onMessageContentChanged Occurs when the message content is modified.
onMessagePinChanged Occurs when the message pinning status changed.

Messages

Method Description
conversationId The conversation ID, which depends on the conversation type.
unreadMessagesCount Gets the number of unread messages in the conversation.
markAllMessagesAsRead: Marks all unread messages as read.
messagesCount Gets the number of all unread messages in the conversation in the local database.
isChatThread Checks whether the current conversation is a thread conversation.
loadMoreMsgFromDB Loads the messages from the local database, starting from a specific message ID.
markMessageAsRead Marks a message as read.
deleteMessageWithId:error: Deletes a message in the local database.
latestMessage Gets the latest message in the conversation.
lastReceivedMessage Gets the latest received message in the conversation.
deleteAllMessages: Deletes all the messages in the conversation.
ext 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.
status The message sending or reception status.
chatType Gets the chat message type.
body The message body.
timestamp The Unix timestamp when the server receives the message.
localTime The local timestamp of the message.
isChatThreadMessage Whether the message is a threaded message.
chatThread Gets the overview of the message thread.
from Gets the user ID of the message sender.
to The user ID of the message recipient.
messageId The message ID.
ext The Message extension attribute of the String type.
isRead Whether the message is read.
isDeliverAcked Whether the message is successfully delivered.
isListened Whether the voice message is listened.
direction The message direction.
conversationId Gets the conversation ID.
reactionList Gets the list of Reactions.
onlineState Whether the message gets delivered to an online user. |
pinnedInfo The pinned info of message.

Contacts

Method Description
getContactsFromServerWithCompletion: Gets all contacts from the server.
addUserToBlackList Adds a user to block list.
removeUserFromBlackList Removes the contact from the block list.
getBlackList Gets the local block list.
getBlackListFromServerWithCompletion: Gets the block list from the server.
approveFriendRequestFromUser Accept a friend invitation.
declineFriendRequestFromUser Declines a friend invitation.
getContacts Gets the contact list from the local database.
getSelfIdsOnOtherPlatformWithCompletion: Gets the unique self-ID list of the current user on the other devices.
addDelegate Registers a new contact delegate.
Event Description
friendshipDidAddByUser: Occurs when user is added as a contact by another user.
friendshipDidRemoveByUser: Occurs when a user is removed from the contact list by another user.
friendRequestDidReceiveFromUser:message: Occurs when a user receives a friend request.
friendRequestDidApproveByUser: 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.
addMembers Adds users to the group.
removeMembersFromGroup Removes members from the group.
getGroupSpecificationFromServerWithId Gets group information from the server.
getJoinedGroupsFromServerWithPage Gets all groups of the current user from the server with pagination.
getPublicGroupsFromServer Gets public groups from the server with pagination.
updateGroupSubject Changes the group name.
updateDescription Changes the group description.
acceptInvitationFromGroup Accepts a group invitation.
declineGroupInvitation Declines a group invitation.
acceptJoinApplication Approves a group request.
declineJoinGroupRequest Declines a group request.
requestToJoinPublicGroup Requests to join a group.
blockGroup Blocks group messages.
unblockGroup Unblocks group messages.
blockMembers Adds the user to the group block list.
unblockMembers Removes users from the group block list.
getGroupBlacklistFromServer Gets the group block list with pagination.
getGroupMemberListFromServer Gets the member list of a group with pagination.
updateGroupOwner Transfers the group ownership.
addAdmin Adds a group admin.
removeAdmin Removes a group admin.
muteMembers Mutes group members.
unmuteMembers Unmutes group members.
getGroupMuteListFromServer Gets the mute list of the group from the server.
getGroupBlacklistFromServer Gets the block list of group from the server with pagination.
addWhiteListMembers Adds members to the allow list.
removeWhiteListMembers Removes members from the allow list.
getGroupWhiteListFromServer Gets the allow list of group from the server.
updateGroupAnnouncement Updates the group announcement.
asyncFetchGroupAnnouncement Gets the group announcement from the server.
uploadGroupSharedFileWithId Uploads the shared file to the group.
getGroupFileList Gets the shared file list from the server.
removeGroupSharedFile Removes the shared file of the group.
downloadGroupSharedFile Downloads the shared file of the group.
getJoinedGroups Gets all groups of the current user (from the cache).
addDelegate Registers a group change listener.
Event Description
groupInvitationDidReceive Occurs when the user receives a group invitation.
joinGroupRequestDidReceive Occurs when the group owner or administrator receives a group request from a user.
joinGroupRequestDidApprove Occurs when a group request is accepted.
joinGroupRequestDidDecline Occurs when a group request is declined.
groupInvitationDidAccept Occurs when a group invitation is accepted.
groupInvitationDidDecline Occurs when a group invitation is declined.
didJoinGroup:inviter:message: Occurs when the group invitation is accepted automatically.
didLeaveGroup Occurs when the current user is removed from the group by the group admin.
groupMuteListDidUpdate:addedMutedMembers:muteExpire: Occurs when one or more group members are muted.
groupMuteListDidUpdate Occurs when one or more group members are unmuted.
groupWhiteListDidUpdate:addedWhiteListMembers: Occurs when one or more group members are added to the allowlist.
groupWhiteListDidUpdate:removedWhiteListMembers: Occurs when one or more members are removed from the allowlist.
groupAllMemberMuteChanged Occurs when all group members are muted or unmuted.
groupAdminListDidUpdate:addedAdmin: Occurs when a member is set as an admin.
groupAdminListDidUpdate:removedAdmin: Occurs when a member's admin privileges are removed.
groupOwnerDidUpdate Occurs when the group ownership is transferred.
userDidJoinGroup Occurs when a member joins a group.
userDidLeaveGroup Occurs when a member proactively leaves the group.
groupAnnouncementDidUpdate 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.
groupSpecificationDidUpdate Occurs when the group detail information is updated.
groupStateChanged Occurs when the group is enabled or disabled.

Chat Room

Method Description
createChatRoom Creates a chat room.
destroyChatroom Destroys a chat room.
joinChatRoom Joins a chat room.
leaveChatroom Exits a chat room.
getChatroomsFromServer Gets chat room data from the server with pagination.
getChatroomSpecificationFromServer Gets details of a chat room from the server.
asyncChangeChatRoomSubject Changes the chat room name.
updateSubject Modifies the chat room description.
getChatroomMemberListFromServer Gets the chat room member list.
muteMembers Mutes members in a chat room.
unmuteMembers Unmutes members in a chat room.
addAdmin Adds a chat room admin.
removeAdmin Removes the administrative privilege of a chat room admin.
getChatroomMuteListFromServer Gets the list of muted chat room members from the server.
removeMembers Removes members from a chat room.
blockMembers Adds members to the block list of the chat room.
unblockMembers Removes members from the block list of the chat room.
getChatroomBlacklistFromServer Gets the chat room block list with pagination.
addWhiteListMembers Adds members to the allow list of the chat room.
removeWhiteListMembers Removes members from the chat room block list.
getChatroomWhiteListFromServer Gets the chat room allow list from the server.
muteAllMembers Mutes all members.
unmuteAllMembers Unmutes all members.
updateChatroomAnnouncement Updates the chat room announcement.
getChatroomAnnouncement Gets the chat room announcement from the server.
setChatroomAttributes Adds custom chat room attributes.
setChatroomAttribute Sets a custom chat room attribute.
setChatroomAttributesForced Sets custom chat room attributes forcibly.
setChatroomAttributeForced Sets a custom chat room attribute forcibly.
fetchChatroomAttributes Gets the list of custom chat room attributes based on the attribute key list.
fetchChatroomAllAttributes Gets all the custom attributes of a chat room.
removeChatroomAttributes Removes custom chat room attributes by the attribute key list.
removeChatroomAttribute Removes a custom chat room attribute.
removeChatroomAttributesForced Removes custom chat room attributes forcibly.
removeChatroomAttributeForced Removes a custom chat room attribute forcibly.
addDelegate Adds a chat room event listener.
Event Description
didDismissFromChatroom Occurs when the current use is removed from a chat room.
userDidJoinChatroom Occurs when a member joins the chat room.
userDidLeaveChatroom Occurs when a member exits the chat room.
onMuteListAdded Occurs when the chat room member(s) is/are added to the mute list.
onMuteListRemoved Occurs when the chat room member(s) is/are removed from the mute list.
onWhiteListAdded Occurs when the chat room member(s) is/are added to the allow list.
onWhiteListRemoved Occurs when the chat room member(s) is/are removed from the allow list.
chatroomAllMemberMuteChanged Occurs when all members in the chat room are muted or unmuted.
onAdminAdded Occurs when a chat room member is set as an admin.
onAdminRemoved Occurs when the chat room member(s) is/are removed from the admin list.
chatroomOwnerDidUpdate Occurs when the chat room owner is changed.
chatroomAnnouncementDidUpdate Occurs when the chat room announcement changes.
chatroomSpecificationDidUpdate: Occurs when the chat room specifications changes.
chatroomAttributesDidUpdated Occurs when the custom chat room attribute(s) is/are updated.
chatroomAttributesDidRemoved Occurs when the custom chat room attribute(s) is/are removed.

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.
addDelegate Adds a listener.
Event Description
presenceStatusDidChanged: Occurs when the presence state of the user subscribed is updated.

Threading

Method Description
createChatThread Creates a message thread.
joinChatThread Joins a message thread.
destroyChatThread Destroys the message thread.
leaveChatThread Leaves a message thread.
getChatThreadFromServer Gets the details of the message thread from the server.
updateChatThreadName Changes the name of the message thread.
removeMemberFromChatThread Removes a member from the message thread.
getChatThreadMembers Gets a list of members in the message thread with pagination.
getJoinedChatThreadsFromServer Uses the pagination to get the list of message threads that the current user has joined.
getJoinedChatThreadsFromServer Uses the pagination to get the list of message threads that the current user has joined in the specified group.
getChatThreadsFromServer Uses the pagination to get the list of message threads in the specified group.
getChatThreadLatestMessage Gets the last reply in the specified message threads from the server.
addChatThreadChangeListener Adds the message thread event listener, which listens for message thread changes, such as the message thread creation and destruction.
Event Description
onChatThreadCreated Occurs when a message thread is created.
onChatThreadUpdated Occurs when a message thread is updated.
onChatThreadDestroyed Occurs when a message thread is destroyed.
onChatThreadUserRemoved 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.

Offline push

Method Description
getPushConfigsFromServer Gets the push configs from the server.
updatePushDisplayName Updates the push display nickname of the current user.
setSilentModeForConversation Sets the DND of the conversation.
clearRemindTypeForConversation Clears the setting of offline push notification type for the conversation.
getSilentModeForConversation Gets the DND setting of the conversation.
setSilentModeForAll Sets the DND Settings for the current login user.
getSilentModeForAll Gets the DND Settings of the current login user.
getSilentModeForConversations Obtains the DND Settings of specified conversations in batches.
bindDeviceToken Bind apns device token
registerPushKitToken Bind voip device token

User Attributes

Method Description
updateOwnInfo Modifies the current user's information.
updateOwnInfoByAttribute Modifies the current user's attributes.
fetchUserInfoByUserId Gets user information with user ID.
fetchUserInfoByAttribute Gets user information with user ID and user properties.