tencent cloud

Feedback

SDK APIs (Flutter)

Last updated: 2023-03-13 15:35:25
    Note

    Chat provides Flutter SDK API call examples. You can visit GitHub to obtain the source code.

    Initialization and Login APIs

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

    API Description
    initSDK Initializes the SDK.
    unInitSDK Uninitializes the SDK.
    login Logs in.
    logout Logs out.
    getLoginUser Gets the UserID of the current login user.
    getLoginStatus Gets the login status.
    getServerTime Gets the current server time (not supported on web).
    getVersion Gets the version number.
    getConversationManager Conversation feature entry.
    getFriendshipManager Relationship chain feature entry.
    getGroupManager Advanced group feature entry.
    getMessageManager Advanced message feature entry.
    getOfflinePushManager Gets the version number.
    getSignalingManager Signaling entry.

    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 signaling information.
    addInvitedSignaling Creates a signaling request.

    Message Creation APIs

    After a message is created, an id field will be returned. You can pass in the id field and related information to the message sending API (sendMessage) to send the message.

    API Description
    createTextMessage Creates a text message.
    createCustomMessage Creates a custom message.
    createImageMessage Creates an image message.
    createSoundMessage Creates an audio message.
    createVideoMessage Creates a video message.
    createTextAtMessage Creates an @ text message.
    createFileMessage Creates a file message.
    createLocationMessage Creates a location message.
    createFaceMessage Creates an emoji message.
    createMergerMessage Creates a combined message.
    createForwardMessage Creates a forward message.
    createTargetedGroupMessage Creates a targeted group message.
    appendMessage Adds a multi-element message.

    Message Sending and Receiving APIs

    If you need to send or 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, we recommend the following advanced message APIs. (The original APIs for simple message sending and receiving used by v3.6.0 and earlier versions have been disused. Please use new APIs to create and send messages.)

    API Description
    addAdvancedMsgListener Sets an event listener for advanced messages.
    removeAdvancedMsgListener Removes the event listener for advanced messages.
    getC2CHistoryMessageList Gets historical one-to-one (C2C) messages.
    getHistoryMessageList Gets historical messages (advanced API).
    getGroupHistoryMessageList Gets historical group messages.
    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 the local storage.
    deleteMessages Deletes local and roaming messages.
    insertGroupMessageToLocalStorage Adds a message to the message list of a group chat.
    insertC2CMessageToLocalStorage Adds a message to the message list of a one-to-one chat.
    clearC2CHistoryMessage Clears the chat history with a user from local storage and the cloud (without deleting the conversation).
    clearGroupHistoryMessage Clears the chat history of a group from local storage and the cloud (without deleting the conversation).
    downloadMergerMessage Gets the sub messages of a combined message.
    reSendMessage Resends a message.
    setC2CReceiveMessageOpt Sets the one-to-one message receiving option for a user (batch setting supported).
    getC2CReceiveMessageOpt Queries the one-to-one message receiving option of a user.
    setGroupReceiveMessageOpt Modifies the group message receiving option.
    setLocalCustomData Sets custom message data (saved locally, will not be sent to the peer end, and will become invalid after the app is uninstalled and reinstalled).
    setLocalCustomInt Sets custom message data and marks whether a voice or video message is played (such a message will be saved locally, not be sent to the peer end, and become invalid after the app is uninstalled and reinstalled).
    revokeMessage Recalls a message. By default, you can recall only messages that are sent within two minutes. You can customize the time limit for message recall via the console (Feature Configuration > Login and Message > Message Recall Settings).
    modifyMessage Modifies a message.
    sendMessage Sends a message.
    sendReplyMessage Sends a reply message.
    searchLocalMessages Searches for local messages.
    sendMessageReadReceipts Sends group message read receipts.
    getMessageReadReceipts Gets read receipts for messages sent by yourself.
    getGroupMessageReadMemberList Gets the list of members who have (or have not) read a message sent by yourself.

    Group APIs

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

    • Work group (Work): Users can join a work group only after being invited by members of the group. This group type is the same as private group (Private) in earlier versions.
    • 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. Same as chat room (ChatRoom) in earlier versions.
    • Community (Community): A community allows users to join and leave freely and is ideal for ultra-large community group chat scenarios, such as knowledge sharing and game communication.
    • 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.
    setGroupListener Sets an event listener for groups.
    removeGroupListener Removes 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 Leaves 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 Gets the profiles of groups.
    setGroupInfo Modifies the profile of a group.
    initGroupAttributes Initializes group attributes. This will clear the existing group attribute list.
    setGroupAttributes Sets group attributes. If the group attributes already exist, their values are updated. Otherwise, the group attributes are added.
    deleteGroupAttributes Deletes specified group attributes. Passing in null for keys means clearing all group attributes.
    getGroupAttributes Gets specified group attributes. Passing in null for keys means getting all group attributes.
    searchGroups Searches for groups.
    getGroupOnlineMemberCount Gets the number of online users in a group. (This API is currently supported only by audio-video groups.)
    getGroupMemberList Gets the group member list.
    getGroupMembersInfo Gets the profiles of specified group members.
    setGroupMemberInfo Modifies the profile of a specified group member.
    searchGroupMembers Searches for group members.
    muteGroupMember Mutes a group member.
    kickGroupMember Removes members from a group.
    setGroupMemberRole Sets a role for a group member.
    transferGroupOwner Transfers the ownership of a group.
    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.
    getJoinedCommunityList Gets the list of community groups the current user has joined.
    createTopicInCommunity Creates a topic.
    deleteTopicFromCommunity Deletes a topic.
    setTopicInfo Sets topic attributes.
    getTopicInfoList Gets the topics of a group.

    Conversation List APIs

    The conversation list is the list a user sees on the first screen after login. It includes elements such as conversation node, conversation name, group name, last message, and unread count.

    API Description
    addConversationListener Adds a relationship chain listener.
    removeConversationListener Removes a relationship chain listener.
    setConversationListener Sets a conversation listener.
    getConversationList Gets the conversation list.
    getConversationListByConversaionIds Gets the list of specified conversations by conversation IDs.
    pinConversation Pins a conversation to the top.
    getTotalUnreadMessageCount Gets the total unread message count of a conversation.
    getConversation Gets a specified conversation.
    deleteConversation Deletes a conversation.
    setConversationDraft Sets a draft for a conversation.

    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.
    getUserStatus Gets users' online statuses.
    setSelfInfo Modifies one's own user profile.
    setSelfStatus Sets the status of the current logged-in user.
    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.

    Offline Push APIs

    We recommend you use the offline push service if you want your app to receive Chat service messages in real time when it runs in the background. As there is no unified push service in the Chinese mainland, you need to configure Android offline push for devices of different vendors separately.

    API Description
    setAPNSListener Sets the APNs offline push listener.
    doBackground Configures offline push.
    doForeground Configures offline push.
    setOfflinePushConfig Configures offline push.

    Friend Management APIs

    By default, Tencent Cloud Chat 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 Chat console and use the following APIs to delete/add friends and manage your friends.

    API Description
    setFriendListener Sets a relationship chain listener to receive friend and blocklist change events.
    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.
    addFriend Adds a friend.
    deleteFromFriendList Deletes friends.
    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 Marks a friend request as read.
    createFriendGroup Creates a friend list.
    getFriendGroups Gets the information of friend lists.
    deleteFriendGroup Deletes a friend list.
    renameFriendGroup Modifies the name of a friend list.
    addFriendsToFriendGroup Adds friends to a friend list.
    deleteFriendsFromFriendGroup Deletes friends from a friend list.
    searchFriends Searches for friends.
    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