SDK APIs (Unity)

Last updated: 2021-12-01 15:18:35

    Initialization and Login APIs

    To use Tencent Cloud IM services, you need to perform initialization and log in.

    API Description
    initSDK Initializes the SDK.
    unInitSDK Uninitializes the SDK.
    login Logs in.
    logout Logs out.
    getLoginStatus Gets the login status.
    getLoginUser Gets the UserID of the current login user.

    Advanced Message APIs

    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 set of advanced message APIs. Do not use simple messages APIs and advanced message APIs at the same time.

    API Description
    addAdvancedMsgListener Sets an event listener for advanced messages. Do not use it and addSimpleMsgListener at the same time.
    sendCustomMessage Sends a custom message.
    sendImageMessage Sends an image message.
    sendSoundMessage Sends a voice message.
    sendVideoMessage Sends a video message.
    sendFileMessage Sends a file message.
    sendLocationMessage Sends a location message.
    getC2CHistoryMessageList Gets the one-to-one (C2C) message history.
    getGroupHistoryMessageList Gets the group message history.
    markC2CMessageAsRead Marks one-to-one (C2C) messages as read.
    markGroupMessageAsRead Marks group messages as read.
    deleteMessageFromLocalStorage Deletes a message from the local storage.
    insertGroupMessageToLocalStorage Adds a message to the group message list.

    Group APIs

    Tencent Cloud IM SDK supports four preset group types, each of which pertains to different scenarios.

    • Work group (Work): similar to a WeChat group. Users can join the group only after being invited by group members. Same as private group (Private) in earlier versions.
    • Public group (Public): similar to a QQ group. Users can join the group through requests, which need to be approved by the group owner or group admin.
    • Meeting group (Meeting): used together with TRTC to enable scenarios such as video conferencing and online education. Users can join and leave the group freely and view the message history before they join. Same as chat room (ChatRoom) in earlier versions.
    • Audio-video group (AVChatRoom): suitable for scenarios such as live streaming and chat rooms with on-screen comments. Users can join and leave the group freely. There is no limit on the number of group members.
    API Description
    setGroupListener Sets an event listener for groups.
    createGroup Creates a group (advanced). 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 the group.
    getJoinedGroupList Gets the list of groups the current user has joined, excluding audio-video groups.
    getGroupsInfo Pulls the profiles of groups.
    setGroupInfo Modifies the profile of a group.
    getGroupMemberList Gets the group member list.
    getGroupMembersInfo Gets the profiles of specified group members.
    setGroupMemberInfo Modifies the profile of a specified group member.
    muteGroupMember Mutes a group member.
    kickGroupMember Removes a member from a group.
    setGroupMemberRole Sets the role for a group member.
    transferGroupOwner Changes the group owner.
    inviteUserToGroup Invites users to a group.
    getGroupApplicationList Gets the list of requests to join a group.
    acceptGroupApplication Accepts a request to join a group.
    refuseGroupApplication Rejects a request to join a group.
    setGroupApplicationRead Marks the request list as read.

    Conversation List APIs

    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
    setConversationListener Sets a conversation listener.
    getConversationList Gets the conversation list.
    deleteConversation Deletes a conversation.
    setConversationDraft Sets a draft for a conversation.

    User Profile APIs

    APIs for querying user profiles, modifying one's own user profile, and blocking messages from a specified user (or adding a specified user to the blocklist).

    API Description
    getUsersInfo Gets user profiles.
    setSelfInfo Modifies one's own user profile.
    addToBlackList Blocks the messages from a user, which means adding the user to the blocklist.
    deleteFromBlackList Unblocks the messages from a user, which means removing the user from the blocklist.
    getBlackList Gets the blocklist.
    setOfflinePushConfig Sets the offline push configuration.

    Friend Management APIs

    By default, Tencent Cloud IM does not check your relationship with a user when receiving and sending messages. You can enable the "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
    setFriendListener Sets a relationship chain listener to receive friend list and blocklist change events.
    getFriendsList Gets the friend list.
    getFriendsInfo Gets the profiles of specified friends.
    setFriendInfo Sets the profile of a specified friend.
    addFriend Adds a friend.
    deleteFromFriendList Deletes a friend.
    checkFriend Checks your relationship with a specified user.
    getFriendApplicationList Gets the list of friend requests.
    acceptFriendApplication Accepts a friend request.
    refuseFriendApplication Rejects a friend request.
    deleteFriendApplication Deletes a friend request.
    setFriendApplicationRead Sets 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.