chat.createFriendGroup(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Description |
name | String | List name |
userIDList | Array | List of userID values of the friends to be added to the group |
Promise
let promise = chat.createFriendGroup({name: 'My friend group 1',userIDList: ['user0','user1']});promise.then(function(imResponse) {const { friendGroup,failureUserIDList } = imResponse;// friendGroup - Friend list instance// failureUserIDList - List of the `userID` values failed to be added// When the friend group is successfully created// the SDK triggers the TencentCloudChat.EVENT.FRIEND_GROUP_LIST_UPDATED event.}).catch(function(imError) {console.warn('getFriendGroupInfo error:', imError); // Failed to obtain the information});
chat.deleteFriendGroup(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Description |
name | String | group name |
Promise
let promise = chat.deleteFriendGroup({name: 'My friend group 1',});promise.then(function(imResponse) {console.log(imResponse.data); // Friend list instance// When the friend group is successfully deleted// the SDK triggers the TencentCloudChat.EVENT.FRIEND_GROUP_LIST_UPDATED event.}).catch(function(imError) {console.warn('deleteFriendGroup error:', imError); // Failed to obtain the information});
chat.renameFriendGroup(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Description |
oldName | String | Old group name |
newName | String | New group name |
Promise
let promise = chat.renameFriendGroup({oldName: 'Friends',newName: 'Besties'});promise.then(function(imResponse) {console.log(imResponse.data); // FriendGroup instance// When the name of a friend group is changed successfully// the SDK triggers the TencentCloudChat.EVENT.FRIEND_GROUP_LIST_UPDATED event.}).catch(function(imError) {console.warn('updateMyProfile error:', imError);});
TencentCloudChat.EVENT.FRIEND_GROUP_LIST_UPDATED
event.chat.getFriendGroupList();
Promise
let promise = chat.getFriendGroupList();promise.then(function(imResponse) {const friendGroupList = imResponse.data; // Friend list}).catch(function(imError) {console.warn('getFriendGroupList error:', imError); // Failed to obtain the friend group});
chat.addToFriendGroup(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Description |
name | String | Group name |
userIDList | Array | List of userID values of the friends to be added |
Promise
let promise = chat.addToFriendGroup({name: 'My friend group 1',userIDList: ['user1','user2'],});promise.then(function(imResponse) {const { friendGroup, failureUserIDList } = imResponse.data;// friendGroup - Friend list instance// failureUserIDList - List of the `userID` values failed to be added// When the friends are successfully added to the friend group,// the SDK triggers the TencentCloudChat.EVENT.FRIEND_GROUP_LIST_UPDATED event.}).catch(function(imError) {console.warn('addToFriendGroup error:', imError); // Failed to obtain the information});
chat.removeFromFriendGroup(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Description |
name | String | Group name |
userIDList | Array | List of userID values of the friends to be removed |
Promise
let promise = chat.removeFromFriendGroup({name: 'My friend group 1',userIDList: ['user1','user2'],});promise.then(function(imResponse) {const { friendGroup, failureUserIDList } = imResponse.data;// friendGroup - Friend list instance// failureUserIDList - List of the `userID` values failed to be added// When the friends are successfully removed from the friend group// the SDK triggers the TencentCloudChat.EVENT.FRIEND_GROUP_LIST_UPDATED event.}).catch(function(imError) {console.warn('addToFriendGroup error:', imError); // Failed to obtain the information});
Was this page helpful?