> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name: createGroup(groupInfo: GroupInfo, options: Options)

# Method package: wixGroupsBackend

# Method menu location: wixGroupsBackend --> Groups --> createGroup

# Method Link: https://dev.wix.com/docs/velo/apis/wix-groups-backend/groups/create-group.md

# Method Description:

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.  

> **Note:** If the `suppressAuth` option is set to `true`, all permissions are overwritten, and all site members can create a group.  

#### About the `owner` Parameter 
+ The `owner` parameter in the `groupInfo` object is optional. 
+ If the `owner` parameter is not specified, the value defaults to the site member ID of the creator of the group.
+ If the `suppressAuth` option is set to `true`, you must specifiy the `owner` parameter. `suppressAuth` works by removing the identity of an owner, and so it needs an identified owner to remove.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Create a group

```javascript
import { Permissions, webMethod } from 'wix-web-module';
import { groups } from 'wix-groups-backend';

// Sample groupInfo value:
// {
//   name: 'My New Group'
// }

export const myCreateGroupFunction = webMethod(Permissions.Anyone, (groupInfo) => {
  return groups.createGroup(groupInfo)
    .then((createdGroup) => {
      const createdGroupName = createdGroup.name;
      return createdGroup;
    })
    .catch((error) => {
      console.error(error);
    });
});

/* Promise resolves to:
 * { 
 *   "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"
 *   "name": "My New Group"
 *   "slug": "my-new-group"
 *   "description": "Welcome to the group! You can connect with other members, get updates and share videos."
 *   "privacyStatus": "PUBLIC"
 *   "memberCount": 1
 *   "settings": {
 *     "groupUpdatePostEnabled": true
 *     "membersCanApprove": false
 *     "membersCanInvite": true
 *     "showMemberList": true
 *     "welcomeMemberPostEnabled": true
 *   }
 *   "lastActivityDate": "Tues Jan 22 2020 12:56:02 GMT+0300"
 *   "_createdDate": "Tues Jan 22 2020 12:56:02 GMT+0300"
 *   "owner": "22nvc8888c7931b4946a3db3"
 * }
 */
```

## Create a group with more information

```javascript
import { Permissions, webMethod } from 'wix-web-module';
import { groups } from 'wix-groups-backend';

// Sample groupInfo value:
// {
//   name: 'My Group',
//   description: 'This is my group about dogs.',
//   privacyStatus: 'PRIVATE',
//   coverImage: {
//     imageUrl: "wix:image://v1/ff9074e348009011fa9f2d2961b~mv2.jpg/oak.jpg#originWidth=400&originHeight=900",
//     position: {
//       x: 35,
//       y: 0
//     }
//   },
//   memberTitle: 'Friends',
//   settings: {
//     membersCanInvite: true,
//     membersCanApprove: true,
//     welcomeMemberPostEnabled: true,
//     groupUpdatePostEnabled: true,
//     showMemberList: true
//   },
//   owner: '22nvc8888c7931b4946a3db3'
// }
//
// Sample options value:
// {
//   suppressAuth: true
// }

export const myCreateGroupFunction = webMethod(Permissions.Anyone, (groupInfo, options) => {
  return groups.createGroup(groupInfo, options)
    .then((createdGroup) => {
      const createdGroupName = createdGroup.name;
      const createdGroupDescription = createdGroup.description;
      return createdGroup;
    })
    .catch((error) => {
      console.error(error);
    });
});

/* Promise resolves to:
 * { 
 *   "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"
 *   "name": "My Group"
 *   "slug": "my-group"
 *   "description": "This is my group about dogs."
 *   "privacyStatus": "PRIVATE"
 *   "coverImage": {
 *     "imageUrl": "wix:image://v1/ff9074e348009011fa9f2d2961b~mv2.jpg/oak.jpg#originWidth=400&originHeight=900",
 *     "position": {
 *       "x": 35,
 *       "y": 0
 *   }
 *   "memberTitle": "Friends"
 *   "memberCount": 1
 *   "settings": {
 *     "membersCanInvite": true,
 *     "membersCanApprove": true,
 *     "welcomeMemberPostEnabled": true,
 *     "groupUpdatePostEnabled": true,
 *     "showMemberList": true
 *   }
 *   "lastActivityDate": "Sun Sep 26 2021 08:23:23 GMT+0300"
 *   "_createdDate": "Sun Sep 26 2021 08:23:23 GMT+0300"
 *   "_updatedDate": "Tues Sep 28 2021 18:34:25 GMT+0300"
 *   "owner": "22nvc8888c7931b4946a3db3"
 * }
 */
```

---