groups.update()
This method allows you to update group properties.
Definition
client.groups.update(id: string|Group,options: ?Object,):Promise<Group,Error>
Parameters
Parameter | Type | Description |
---|---|---|
id | string |Group | The group ID or group model |
options | ?Object | Options (described below) |
Options
Parameter | Type | Description |
---|---|---|
avatarFile | ? File | The new group avatar File object |
memberIds | ?Array<User |string> | A list of user models or user IDs to add to the group |
metadata | ?Object | Metadata for the group, the keys of which replace any existing values for those keys |
name | ?string | The new group name |
replayHistory | ?boolean | Indicates 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(', '));