Accepts a group invitation. If a group member invites a user to join the group, the invitee can call this method to accept the invitation. The inviter will receive "operation: 'acceptInvite'" in the callback of onGroupEvent. The new group member will receive "operation: 'memberPresence'" in the callback of onGroupEvent.
connection.acceptGroupInvite({invitee: 'myUserId', groupId: 'groupId'})
The group ID.
The user ID of the invitee.
Accepts a group request. Only the group owner or admin can call this method. The user who joins the group will receive "operation: 'acceptRequest'" in the callback of onGroupEvent.
connection.acceptGroupJoinRequest({applicant: 'user1', groupId: 'groupId'})
The ID of the user requesting to join the group.
The group ID.
Adds members to the group allowlist. Members on the allowlist can still post messages even if they are muted in the group. Only the group admin or above can call this method. Members added to the allowlist will receive "operation: 'addUserToAllowlist'" in the callback of onGroupEvent.
connection.addUsersToGroupAllowlist({groupId: 'groupId'})
The group ID.
An array of member IDs to be added to the allowlist.
Adds a member to the group blocklist. Only the group owner or admin can call this method. The member added to the blocklist will receive "operation: 'removeMember'" in the callback of onGroupEvent.
connection.blockGroupMember({groupId: 'groupId', username: 'user1'})
The group ID.
User ID to be added to the blocklist.
Adds members to the group blocklist in bulk. Only the group admin can call this method. Members added to the blocklist will receive "operation: 'removeMember'" in the callback of onGroupEvent.
connection.blockGroupMembers({usernames: ['user1', 'user2'], groupId: 'groupId'})
The group ID.
The array of member's user IDs to be added to the blocklist.
Blocks group messages. This method is only valid for mobile devices.
connection.blockGroupMessages({groupId: 'groupId'})
The group ID.
Transfers a group. Only the group owner can call this method. Group members will receive "operation: 'changeOwner'" in the callback of onGroupEvent.
connection.changeGroupOwner({groupId: 'groupId', newOwner: 'user1'})
The group ID.
The new group owner.
Creates a group instance.
connection.createGroup({
data: {
groupname: 'groupname',
desc: 'this is my group',
members: ['user1', 'user2'],
public: true,
approval: false,
allowinvites: true,
inviteNeedConfirm: false,
ext: {info: 'group info'}
}
})
The group information.
Whether to allow group members to invite others to the group. true
: Allow; false
: Do not allow.
Whether a user requires the approval from the group admin to join the group. -true
: Yes; -false
: No.
The description of the group.
Group detail extensions which can be in the JSON format to contain more group information.
The group name.
Whether the invitee needs to accept the invitation before joining the group.
true
: The invitee's consent is required. The default value is true
.false
: The invitee will be directly added to the group without confirmation.The group max users.
The array of member IDs to add to the group. These users will be added directly into the group and receive "operation: 'directJoined'" in the callback of onGroupEvent.
Whether it is a public group. -true
: Yes; -false
: No. Public group: the group that others can query by calling listgroups
.
Deletes shared files of the group.
connection.deleteGroupSharedFile({groupId: 'groupId', fileId: 'fileId'})
The shared file ID.
The group ID.
Destroys a group. Only the group owner can call this method. Group members will receive "operation: 'destroy'" in the callback of onGroupEvent.
connection.destroyGroup({groupId: 'groupId'})
The group id.
Mutes all members. Only the group admin or above can call this method. Group members will receive "operation: 'muteAllMembers'" in the callback of onGroupEvent.
connection.disableSendGroupMsg({groupId: 'groupId'})
The group ID.
Down load group file.
connection.downloadGroupSharedFile({groupId: 'groupId', fileId: 'fileId', onFileDownloadComplete: (data)=>{console.log(data)}})
The shared file ID.
The group ID.
The secret key required to download the file.
Unmute all members. Only the group admin or above can call this method. Group members will receive "operation: 'unmuteAllMembers'" in the callback of onGroupEvent.
connection.enableSendGroupMsg({groupId: 'groupId'})
The group ID.
Gets the group announcement.
connection.fetchGroupAnnouncement({groupId: 'groupId'})
The group ID.
Gets all admins in the group.
connection.getGroupAdmin({groupId: 'groupId'})
The group ID.
Gets the group allowlist. Only the group admin or above can call this method.
connection.getGroupAllowlist({groupId: 'groupId'})
The group ID.
Gets the group blocklist.
connection.getGroupBlocklist({groupId: 'groupId'})
The group ID.
Gets specifications of the group.
connection.getGroupInfo({groupId: groupId})
The group ID or group ID list.
Gets all custom attributes of a group member.
connection.getGroupMemberAttributes({groupId: 'groupId', userId: 'userId'})
The group ID.
The user ID of the group member.
Gets custom attributes of multiple group members by attribute key.
connection.getGroupMembersAttributes({groupId: 'groupId', userIds: ['userId'], keys: ['avatar', 'nickname']})
The group ID.
The array of keys of custom attributes to be retrieved. If you pass in an empty array or do not set this parameter, the SDK gets all custom attributes of these group members.
The array of user IDs of group members whose custom attributes are retrieved.
Checks which members have read group message. This is a [value-added function] and .
connection.getGroupMsgReadUser({groupId: 'groupId', msgId: 'msgId'})
The group ID.
The ID of message to query.
Gets the mute list of the group. Only the group admin or above can call this method.
connection.getGroupMutelist({groupId: 'groupId'})
The group ID.
The group ID.
The page number, starting from 1.
The number of members per page. The value cannot exceed 10.
Lists all the groups a user has joined.
Whether the number of group members is required.
true
: Yes;
(Default)false
: No.
Whether the role of the current user in the group is required.
true
: Yes;
(Default)false
: No.
If either needAffiliations
or needAffiliations
is set, when you get data with pagination, the current page number (pageNum) starts from 0.
If neither of the parameters is set, when you get data with pagination, the current page number (pageNum) starts from 1.
If either needAffiliations
or needAffiliations
is set, when you get data with pagination, you can get a maximum of 20 groups (pageSize) on each page.
If neither of the parameters is set, when you get data with pagination, you can get a maximum of 500 groups (pageSize) on each page.
Gets public groups with pagination.
connection.getPublicGroups({limit: 20, cursor: null})
The cursor that specifies where to start to get data. If there will be data on the next page, this method will return the value of this field to indicate the position to start to get data of the next page. If it is null, the data of the first page will be fetched.
The number of records per page.
Invites users into a group. Creates a group instance "inviteNeedConfirm:true", the invited users will receive "operation: 'inviteToJoin'" in the callback of onGroupEvent. Creates a group instance "inviteNeedConfirm:false", the invited users will receive "operation: 'directJoined'" in the callback of onGroupEvent.
connection.inviteUsersToGroup({groupId: 'groupId', users: ['user1', 'user2']})
The group ID.
The array of invitee IDs.
Checks whether the current member is on the allowlist. The app admin can check all users; app users can only check themselves.
connection.isInGroupAllowlist({groupId: 'groupId', userName: 'user1'})
The group ID.
The user ID to query.
Check whether you are on the group mute list.
connection.isInGroupMutelist({groupId: 'groupId'})
The group ID.
Applies to join the group. The group owner and admin will receive "operation: 'requestToJoin'" in the callback of onGroupEvent.
connection.joinGroup({groupId: 'groupId', message: 'I want to join the group'})
The group ID.
The additional information of the request.
Leaves the group. Group members will receive "operation: 'memberAbsence'" in the callback of onGroupEvent.
connection.leaveGroup({groupId: 'groupId'})
The group ID.
Lists all members of the group with pagination.
connection.listGroupMembers({pageNum: 1, pageSize: 20, groupId: 'groupId'})
The group IDć
The page number, starting from 1.
The number of members per page. The value cannot exceed 1000.
Modifies group information. Only the group admin can call this method.
connection.modifyGroup({groupId: 'groupId', groupName: 'groupName', description:'description'})
The group description.
Group detail extensions which can be in the JSON format to contain more group information.
The Group ID.
The group name.
Mutes one or more group members. Only the group owner or admin can call this method. The muted member and other members will receive "operation:'muteMember'" in the callback of onGroupEvent.
connection.muteGroupMember({username: 'user1' || ['user1', 'user2'], muteDuration: -1, groupId: 'groupId'})
The group ID.
The mute duration in milliseconds. The value -1
indicates that the member is muted permanently.
The ID of the group member to mute.
Declines a group invitation. If a group member invites a user to join a group, the invitee can call this method to decline this invitation.
connection.rejectGroupInvite({invitee: 'myUserId', groupId: 'groupId'})
The group ID.
The user ID of the invitee.
Declines a group request. Only the group owner or admin can call this method.
connection.rejectGroupJoinRequest({applicant: 'user1', groupId: 'groupId', reason: 'I do not like you'})
The ID of the user who sends the request to join the group.
The group ID.
The reason of declining.
Removes a group admin. Only the group owner can call this method. The user whose admin permissions are revoked will receive "operation: 'removeAdmin'" in the callback of onGroupEvent.
connection.removeGroupAdmin({groupId: 'groupId', username: 'user1'})
The group ID.
The ID of the user with admin privileges revoked.
Removes a member from the group allowlist. Only the group admin or above can call this method. The user that is removed from the group allowlist will receive "operation:'removeAllowlistMember'" in the callback of onGroupEvent.
connection.removeGroupAllowlistMember({groupId: 'groupId', userName: 'user1'})
The group ID.
The ID of the member to be removed from the group allowlist.
Removes a member from the group. Only the group owner or admin can call this method. The removed member will receive "operation: 'removeMember'" in the callback of onGroupEvent, and other group members will receive "operation: 'memberAbsence' in the callback of onGroupEvent.
connection.removeGroupMember({groupId: 'groupId', username: 'user1'})
The group ID.
The member ID to remove.
Removes members from the group. Only the group owner or admin can call this method. The removed members will receive "operation: 'removeMember'" in the callback of onGroupEvent, and other group members will receive "operation: 'memberAbsence'" in the callback of onGroupEvent.
connection.removeGroupMembers({groupId: 'groupId', users: ['user1', 'user2']})
The group ID.
The array of member IDs to remove.
Sets a group admin. Only the group owner can call this method. The user set as an admin will receive "operation: 'setAdmin'" in the callback of onGroupEvent.
connection.setGroupAdmin({groupId: 'groupId', username: 'user1'})
The group ID.
The ID of the user set as admin.
Sets custom attributes of a group member.
After custom attributes of a group member are set, other members in the group receive the operation: 'memberAttributesUpdate'
in the onGroupEvent
callback and the other devices of the group member receive the the operation: 'memberAttributesUpdate'
in the onMultiDeviceEvent
callback.
connection.setGroupMemberAttributes({groupId: 'groupId', userId: 'userId', memberAttributes: {key: 'value'}})
The group ID.
The custom attributes to set in key-value format. In a key-value pair, if the value is set to an empty string, the custom attribute will be deleted.
The user ID of the group member.
Removes a member from the group blocklist. Only the group admin can call this method. Members who are removed from the blocklist will receive "operation: 'unblockMember'" in the callback of onGroupEvent.
connection.unblockGroupMember({groupId: 'groupId'})
The group ID.
The user ID of the member to be removed from the blocklist.
Removes members from the group blocklist in bulk. Only the group owner or admin can call this method. Members who are removed from the blocklist will receive "operation: 'unblockMember'" in the callback of onGroupEvent.
connection.unblockGroupMembers({groupId: 'groupId', usernames: ['user1', 'user2']})
The group ID.
The array of membersā user IDs to be removed from the group blocklist.
Unmutes one or more group members. Only the group owner or admin can call this method. The unmuted member and other members will receive "operation: 'unmuteMember'" in the callback of onGroupEvent.
connection.unmuteGroupMember({groupId: 'groupId', username: 'user1' || ['user1', 'user2']})
The group ID.
The group member ID to unmute.
Updates the group announcement.
connection.updateGroupAnnouncement({groupId: 'groupId', announcement: 'hello'})
The group announcement.
The group ID.
Uploads shared files to the group.
connection.uploadGroupSharedFile({groupId: 'groupId', file: 'file object', onFileUploadProgress: onFileUploadProgress, onFileUploadComplete: onFileUploadComplete,onFileUploadError:onFileUploadError,onFileUploadCanceled:onFileUploadCanceled})
The shared file object to upload.
The group ID.
The upload cancellation callback.
The upload completion callback.
The upload failure callback.
The upload progress callback.
Generated using TypeDoc
Group contains APIs for group-related operations.