tencent cloud


SDK APIs (C++)

Last updated: 2022-11-10 15:20:54

    Initialization and Login APIs

    To use the Tencent Cloud IM service, you need to initialize the SDK and log in.

    API Description
    InitSDK Initializes an SDK.
    UnInitSDK Uninitializes an SDK.
    GetVersion Gets the version number.
    GetServerTime Gets the server time.
    Login Logs a user in.
    Logout Logs a user out.
    GetLoginStatus Gets the login status.
    GetLoginUser Gets the UserID of the current login user.

    Simple Message APIs

    Use the following APIs for the sending and receiving of text and signaling (custom buffer) messages.

    API Description
    AddSimpleMsgListener Sets 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.

    Signaling APIs

    API Description
    AddSignalingListener Adds a signaling listener.
    RemoveSignalingListener Removes a signaling listener.
    Invite Invites a user.
    InviteInGroup Invites certain users in the group.
    Cancel The inviter cancels the invitation.
    Accept The invitee accepts the invitation.
    Reject The invitee rejects the 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 Modifies the invitation signaling.

    Advanced Message APIs

    If you need to send/receive rich media messages (such as image, video, and file messages) 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 message 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.
    RemoveAdvancedMsgListener Removes an event 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 an audio 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.
    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.
    GetHistoryMessageList Gets message history.
    RevokeMessage Recalls 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.
    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.
    SendMessageReadReceipts Sends message read receipts.
    GetMessageReadReceipts Gets message read receipts.
    GetGroupMessageReadMemberList Gets the list of group members who have read group messages.
    setMessageExtensions Sets message extensions
    getMessageExtensions Gets message extensions.
    deleteMessageExtensions Deletes message extensions

    Group APIs

    Tencent Cloud IM SDK supports the following predefined group types, each of which pertains to different application scenarios:

    • Work group (Work): Users can join the group only after being invited by existing members.
    • Public group (Public): 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.
    • Audio-video group (AVChatRoom): An audio-video group allows users to join and leave freely and is suitable for scenarios such as live streaming and chat rooms with on-screen comments. There is no limit on the number of group members.
    API Description
    AddGroupListener Adds an event listener for groups.
    RemoveGroupListener Removes an 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 Leaves a group.
    DismissGroup Disbands a group. Only the group owner and group admin can disband a group.
    GetJoinedGroupList Gets the list of groups the current user has joined, excluding audio-video groups.
    GetGroupsInfo Pulls the 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.
    GetGroupMemberList Gets the 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.
    KickGroupMember Removes a member from a group.
    SetGroupMemberRole Sets a role for a group member.
    markGroupMemberList Marks group members.
    TransferGroupOwner Transfers the group ownership.
    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.

    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 message count.

    API Description
    AddConversationListener Adds a conversation listener.
    RemoveConversationListener Removes a conversation listener.
    GetConversationList Gets the conversation list.
    GetConversation Gets a conversation.
    GetConversationList Gets multiple conversations.
    getConversationListByFilter Gets the advanced conversation API to specify the conversation type, mark type, and group name.
    DeleteConversation Deletes a conversation.
    SetConversationDraft Sets a draft for a conversation.
    SetConversationCustomData Sets custom conversation data.
    PinConversation Pins a conversation to the top.
    MarkConversation Marks a conversation.
    GetTotalUnreadMessageCount Gets the total unread message count.
    CreateConversationGroup Creates a conversation group.
    GetConversationGroupList Gets the list of conversation groups.
    DeleteConversationGroup Deletes a conversation group.
    RenameConversationGroup Renames a conversation group.
    AddConversationsToGroup Adds a conversation to a conversation group.
    DeleteConversationsFromGroup Deletes a conversation from a conversation group.

    User Profile APIs

    You can use the following APIs to query user profiles, modify your profile, and block messages from a specified user (that is, adding a specified user to the blocklist).

    API Description
    GetUsersInfo Gets user profiles.
    SetSelfInfo Modifies one's own user profile.
    GetUserStatus Queries a user's status.
    SetSelfStatus Sets one's own status.
    SubscribeUserStatus Subscribes to a user's status.
    UnsubscribeUserStatus Unsubscribes from a user's 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.

    Friend Management APIs

    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 friends.

    API Description
    AddFriendListener Adds a relationship chain listener.
    RemoveFriendListener Removes a relationship chain listener.
    GetFriendList Gets the contacts.
    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.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support