forums.create()
This method allows you to create a new public forum with the specified members and the current user.
If you are creating a private group, please use client.groups.create() instead.
Definition
client.forums.create(options: ?Object):Promise<Group,Error>
Parameters
Parameter | Type | Description |
---|---|---|
options | ?Object | Options (described below) |
Options
Parameter | Type | Description |
---|---|---|
avatarFile | File | An avatar file object |
description | ?string | The forum description |
memberIds | Array<string |User> | A list of user models or user IDs to add to the forum once it is created |
metadata | ?Object | Optional metadata for the forum |
name | string | The forum name |
organizationId | string | The organization in which the forum should be created |
replayHistory | ?bool | Indicates whether replay history is desired (default: true for forums) |
senderId | ?string | ID of the role or user who is creating the forum (default: current user) |
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 newly created forum, which is a Group object.
Example
const forum = await client.forums.create({organizationId: 'some-org-id',name: 'New forum name',memberIds: ['some-user-id-1','some-user-id-2','some-user-id-3']});console.log('created new forum:',forum.displayName,'with members',forum.members.map(function(user) {return user.displayName;}).join(', '));