groups.update()

This method allows you to update group properties.

Definition

client.groups.update(
id: string|Group,
options: ?Object,
):Promise<Group,Error>

Parameters

ParameterTypeDescription
idstring|GroupThe group ID or group model
options?ObjectOptions (described below)

Options

ParameterTypeDescription
avatarFile? FileThe new group avatar File object
memberIds?Array<User|string>A list of user models or user IDs to add to the group
metadata?ObjectMetadata for the group, the keys of which replace any existing values for those keys
name?stringThe new group name
replayHistory?booleanIndicates whether new members can see previous group messages

Returns

An error will be thrown if any of the arguments are invalid.

Otherwise, once the returned Promise is resolved, you will have access to the updated Group.

Example

const group = await client.groups.update('some-group-id', {
name: 'A new name for the group',
memberIds: [
'some-user-id-1',
'some-user-id-2',
'some-user-id-3'
]
});
console.log(
'group updated:',
group.displayName,
'members: ',
group.members
.map(function(user) {
return user.displayName;
})
.join(', ')
);