Creates a group.
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.
function createGroup(group: Group, options: CreateGroupOptions): Promise<Group>;
Group to create.
Optional fields for group creation.
import { groups } from "wix-groups.v2";
async function createGroup(group, options) {
try {
const result = await groups.createGroup(group, options);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.