>!**Do not use APIs of new and old versions at the same time**.
To use Tencent Cloud IM services, you need to initialize the SDK and log in.
API | Description |
---|---|
initSDK | Initializes the SDK. |
unInitSDK | Uninitializes the SDK. |
addIMSDKListener | Add IM listener |
removeIMSDKListener | Remove IM listener |
getVersion | Gets the version number. |
getServerTime | Gets the server time. |
login | Logs in. |
logout | Logs out. |
getLoginStatus | Gets the login status. |
getLoginUser | Gets the UserID of the currently logged-in user. |
Use the following APIs for the sending and receiving of text and signaling (custom buffer) messages.
API | Description |
---|---|
addSimpleMsgListener | Adds an event listener for simple messages (text messages and custom messages). Do not use it and addAdvancedMsgListener at the same time. |
removeSimpleMsgListener | Removes the event listener for simple messages (text messages and custom messages). |
sendC2CTextMessage | Sends a one-to-one (C2C) text message. |
sendC2CCustomMessage | Sends a one-to-one (C2C) custom (signaling) message. |
sendGroupTextMessage | Sends a group text message. |
sendGroupCustomMessage | Sends a group custom (signaling) message. |
API | Description |
---|---|
addSignalingListener | Adds a signaling listener. |
removeSignalingListener | Removes a signaling listener. |
invite | Invites a user. |
inviteInGroup | Invites certain users in the group. |
cancel | Cancels an invitation. |
accept | Accepts an invitation. |
reject | Rejects an invitation. |
getSignalingInfo | Gets the signaling information. |
addInvitedSignaling | Adds invitation signaling (can be used for invitation signaling triggered by offline push messages for group invitations). |
modifyInvitation | modify invitation. |
If you need to send/receive rich media messages (images, videos, files, etc.) and use advanced features such as recalling messages, marking messages as read, and querying message history, use the following advanced message APIs. Do not use simple messages APIs and advanced message APIs at the same time.
API | Description |
---|---|
addAdvancedMsgListener | Adds an event listener for advanced messages. Do not use it and addSimpleMsgListener at the same time. |
removeAdvancedMsgListener | Removes the listener for advanced messages. |
createTextMessage | Creates a text message. |
createTextAtMessage | Creates an @ text message. |
createCustomMessage | Creates a custom message. |
createImageMessage | Creates an image message. |
createSoundMessage | Creates a voice message. |
createVideoMessage | Creates a video message. |
createFileMessage | Creates a file message. |
createLocationMessage | Creates a location message. |
createFaceMessage | Creates an emoji message. |
createMergerMessage | Creates a combined forward message. |
createForwardMessage | Creates a single forward message. |
createTargetedGroupMessage | Creates a targeted group message |
createAtSignedGroupMessage | Creates a group @ message. |
sendMessage | Sends a message. The message object can be created using a createXXXMessage API. |
setC2CReceiveMessageOpt | Sets the Mute Notifications option for one-to-one messages. |
getC2CReceiveMessageOpt | Gets the Mute Notifications status for one-to-one messages. |
setGroupReceiveMessageOpt | Sets the Mute Notifications option for group messages. |
setAllReceiveMessageOpt | Set global message do not disturb status (can be repeated daily) |
setAllReceiveMessageOpt | Set global message do not disturb status |
getAllReceiveMessageOpt | Get global message do not disturb status |
getC2CHistoryMessageList | Gets one-to-one (C2C) message history. |
getGroupHistoryMessageList | Gets group message history. |
getHistoryMessageList | Gets message history. |
revokeMessage | Recalls a message. The message object can be created using a createXXXMessage API. |
modifyMessage | Modifies a message. The message object can be created using a createXXXMessage API. |
markC2CMessageAsRead | Marks one-to-one (C2C) messages as read. |
markGroupMessageAsRead | Marks group messages as read. |
markAllMessageAsRead | Marks all messages as read. |
deleteMessageFromLocalStorage | Deletes a message from local storage. |
deleteMessages | Deletes messages from local storage and the cloud. |
clearC2CHistoryMessage | Clears chat history with a user from local storage and the cloud. |
clearGroupHistoryMessage | Clears chat history of a group from local storage and the cloud. |
insertGroupMessageToLocalStorage | Inserts a message in a group chat. |
insertC2CMessageToLocalStorage | Inserts a message in a one-to-one chat. |
findMessages | Finds local messages by msgID. |
searchLocalMessages | Searches for local messages. |
searchCloudMessages | Search cloud messages. |
sendMessageReadReceipts | Sends read receipts to the message sender for message which have been received. |
getMessageReadReceipts | Gets read receipts for messages which have been sent by myself. |
getGroupMessageReadMemberList | Gets group members profile who have read ths message. |
setMessageExtensions | set message extensions |
getMessageExtensions | get message extensions |
deleteMessageExtensions | delete message extensions |
addMessageReaction | add message reaction |
removeMessageReaction | remove message reaction |
getMessageReactions | get message reactions |
getAllUserListOfMessageReaction | get all user list of message reaction |
translateText | Translate Text Message |
Tencent Cloud IM SDK supports the following preset group types, each of which pertains to different scenarios.
API | Description |
---|---|
addGroupListener | Adds an event listener for groups. |
removeGroupListener | Removes event listener for groups. |
createGroup | Creates a (simple) group. |
createGroup | Creates an (advanced) group. The group information and the initial group members can be set during group creation. |
joinGroup | Joins a group. |
quitGroup | Quits a group. |
dismissGroup | Deletes a group. Only the group owner and group admin can delete a group. |
getJoinedGroupList | Gets the list of groups the current user has joined, excluding audio-video groups. |
getGroupsInfo | Pulls profiles of groups. |
searchGroups | Searches for groups. |
setGroupInfo | Modifies the profile of a group. |
initGroupAttributes | Initializes group attributes. |
setGroupAttributes | Sets group attributes. |
deleteGroupAttributes | Deletes group attributes. |
getGroupAttributes | Gets group attributes. |
getGroupOnlineMemberCount | Gets the number of online group members. |
setGroupCounters | Set group counters. |
getGroupCounters | Get group counters. |
increaseGroupCounter | Increase group counters. |
decreaseGroupCounter | Decrease group counters. |
getGroupMemberList | Gets group member list. |
getGroupMembersInfo | Gets the profiles of specified group members. |
searchGroupMembers | Searches for group members. |
setGroupMemberInfo | Modifies the profile of a specified group member. |
muteGroupMember | Mutes a group member. |
muteAllGroupMembers | Mute all group members, only administrators or group owners can call this function. |
kickGroupMember | Kicks members out of a group. |
setGroupMemberRole | Sets the role for a group member. |
markGroupMemberList | Mark group member list . |
transferGroupOwner | Changes the group owner. |
inviteUserToGroup | Invites users to a group. |
getGroupApplicationList | Gets the list of requests to join a group. |
acceptGroupApplication | Approves a request to join a group. |
refuseGroupApplication | Rejects a request to join a group. |
setGroupApplicationRead | Marks the request list as read. |
getJoinedCommunityList | Gets the list of Community-groups that the current user has joined |
createTopicInCommunity | Creates topic |
deleteTopicFromCommunity | Deletes topic |
setTopicInfo | Modifies topic information |
getTopicInfoList | Gets topic list |
Community is used to manage group members. All topics under a community can not only share community members, but also send and receive messages independently without interfering with each other.
API | Description |
---|---|
addCommunityListener | Adds an event listener for communities. |
removeCommunityListener | Removes event listener for communities. |
createCommunity | Creating a community with topic support |
getJoinedCommunityList | Gets the list of Community-groups that the current user has joined |
createTopicInCommunity | Creates topic |
deleteTopicFromCommunity | Deletes topic |
setTopicInfo | Modifies topic information. |
getTopicInfoList | Gets topic list. |
createPermissionGroupInCommunity | Create community permission group. |
deletePermissionGroupFromCommunity | Delete community permission group. |
modifyPermissionGroupInfoInCommunity | Modify community permission group. |
getJoinedPermissionGroupListInCommunity | Get joined community permission group list. |
getPermissionGroupListInCommunity | Get community permission group list. |
addCommunityMembersToPermissionGroup | Add members to community permission group. |
removeCommunityMembersFromPermissionGroup | Remove members from community permission group. |
getCommunityMemberListInPermissionGroup | Get community permission group member list. |
addTopicPermissionToPermissionGroup | Add topic permissions to the permission group. |
deleteTopicPermissionFromPermissionGroup | Delete topic permissions from the permission group. |
modifyTopicPermissionInPermissionGroup | Modify the topic permissions in the permission group. |
getTopicPermissionInPermissionGroup | Get the topic permissions in the permission group. |
The conversation list is the list a user sees on the first screen after logging in to WeChat or QQ. It includes elements such as conversation node, conversation name, group name, last message, and unread count.
API | Description |
---|---|
addConversationListener | Adds a conversation listener. |
removeConversationListener | Removes conversation listener. |
getConversationList | Gets the conversation list. |
getConversation | Gets a conversation. |
getConversationList | Gets multiple conversations. |
getConversationListByFilter | Gets multiple conversations (advanced API). |
deleteConversation | Deletes a conversation. |
deleteConversationList | 删除会话列表 |
setConversationDraft | Sets draft for a conversation. |
setConversationCustomData | Sets custom data for a conversation. |
pinConversation | Pins a conversation to the top. |
markConversation | Marks a conversation to the top. |
getTotalUnreadMessageCount | Gets the total unread message count. |
getUnreadMessageCountByFilter | Get the total number of unread messages filtered by conversation. |
subscribeUnreadMessageCountByFilter | Register a listener for changes in the total number of unread messages in a specific conversation. |
unsubscribeUnreadMessageCountByFilter | Unregister a listener for changes in the total number of unread messages in a specific conversation. |
cleanConversationUnreadMessageCount | Clear the unread message count for a conversation. |
createConversationGroup | Create conversation group. |
getConversationGroupList | Get conversation group list. |
deleteConversationGroup | Delete conversation group. |
renameConversationGroup | Rename conversation group. |
addConversationsToGroup | Add conversations to group. |
deleteConversationsFromGroup | Delete conversations from group. |
You can use the following APIs to query user profiles, modify your profile, and block messages from a specified user (i.e., adding a specified user to the blocklist).
API | Description |
---|---|
getUsersInfo | Gets users’ profiles. |
setSelfInfo | Modifies one's own user profile. |
subscribeUserInfo | Subscribe to user profile |
unsubscribeUserInfo | Unsubscribe from user profile |
getUserStatus | Gets user status information. |
setSelfStatus | Sets user status for yourself. |
subscribeUserStatus | Subscribes user status. |
unsubscribeUserStatus | Unsubscribes user status. |
addToBlackList | Blocks messages from a user, which means adding the user to the blocklist. |
deleteFromBlackList | Unblocks messages from a user, which means removing the user from the blocklist. |
getBlackList | Gets the blocklist. |
Use the offline push service if you want your app to receive IM messages in real time when it runs in the background. As there is currently no unified push service in the Chinese mainland, you need to configure offline push for the mobile phones of different vendors separately.
API | Description |
---|---|
setOfflinePushConfig | Configures offline push. |
doBackground | This API can be called when the app detects that the app switches to the background. |
doForeground | This API can be called when the app detects that the app switches to the foreground. |
By default, Tencent Cloud IM does not check your relationship with a user when receiving and sending messages. You can enable "Check Relationship for One-to-One Messages" on Feature Configuration > Login and Message > Relationship Check in the IM console and use the following APIs to delete/add friends and manage your friend list.
API | Description |
---|---|
addFriendListener | Adds a relationship chain listener to receive friend list and blocklist change events. |
removeFriendListener | Removes relationship chain listener. |
getFriendList | Gets the friend list. |
getFriendsInfo | Gets the profiles of specified friends. |
setFriendInfo | Sets the profile of a specified friend. |
searchFriends | Searches for friends. |
addFriend | Adds a friend. |
deleteFromFriendList | Deletes a friend. |
checkFriend | Checks relationship with specified users. |
getFriendApplicationList | Gets the list of friend requests. |
acceptFriendApplication | Accepts a friend request. |
refuseFriendApplication | Rejects a friend request. |
deleteFriendApplication | Deletes a friend request. |
setFriendApplicationRead | Marks a friend request as read. |
createFriendGroup | Creates a friend list. |
getFriendGroups | Gets the information of friend lists. |
deleteFriendGroup | Deletes friend lists. |
renameFriendGroup | Modifies the name of a friend list. |
addFriendsToFriendGroup | Adds friends to a friend list. |
deleteFriendsFromFriendGroup | Deletes friends from a friend list. |
subscribeOfficialAccount | Subscribe to a official account. |
unsubscribeOfficialAccount | Unsubscribe from a official account. |
getOfficialAccountsInfo | Get a list of official accounts. |
followUser | Follow users. |
unfollowUser | Unfollow users. |
getMyFollowingList | Get my follow list. |
getMyFollowersList | Get my fan list. |
getMutualFollowersList | Get my mutual follow list. |
getUserFollowInfo | Get the follow/fan/mutual follow count information for a specified user. |
checkFollowType | Check the follow type of a specified user. |