Search.../

createGroup( )

Creates a group.

Description

The createGroup() function returns a Promise that resolves to a newly-created group after it has successfully been created. The new group is added to the Groups List page of your site.

Site admins can choose to allow site members to create a group. They can also require that site members request their approval when creating a group. This setting can be found in your site's Dashboard under Groups Application > General Settings > Group Creation. If set to admin approval required, a site member uses this function to create a group, and the group becomes a createRequest with a status of PENDING until the group is reviewed. The default is set to site members with admin approval.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function createGroup(group: Group, options: CreateGroupOptions): Promise<CreateGroupResponse>

createGroup Parameters

NAME
TYPE
DESCRIPTION
group
Group

Group to create.

options
Optional
CreateGroupOptions

Optional fields for group creation.

Returns

Return Type:

Promise<
CreateGroupResponse
>
NAME
TYPE
DESCRIPTION
group
Group

Created group.

Was this helpful?

createGroup example

Copy Code
1import { groups } from 'wix-groups.v2';
2
3 async function createGroup(group, options) {
4 try {
5 const result = await groups.createGroup(group, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13