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.
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 to create.
Optional fields for group creation.
Returns
Return Type:
NAME
TYPE
DESCRIPTION
Created group.
Was this helpful?
createGroup example
1import { groups } from 'wix-groups.v2';23 async function createGroup(group, options) {4 try {5 const result = await groups.createGroup(group, options);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13