> 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`). > - 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: listGroups(paging: Paging, options: Options) # Method package: wixGroupsBackend # Method menu location: wixGroupsBackend --> Groups --> listGroups # Method Link: https://dev.wix.com/docs/velo/apis/wix-groups-backend/groups/list-groups.md # Method Description: Lists groups. The `listGroups()` function returns a Promise that resolves to a list of up to 1,000 groups on your site. Sorts by default to `_createdDate` in descending order. > **Notes:** > + For `SECRET` groups, only site admins, group admins, and group members can see a list of group and their content. However, if the `suppressAuth` option is set to `true`, all permissions are overwritten, and all site members (including non-group members) can see a list of groups and their content. > + This function's parameters are positional, and must be specified in the sequence shown in the syntax below. When specifying a parameter, use `null` as a placeholder for any unspecified parameters. For example, to specify `limit` only, call `listGroups(paging, null)`. To specify `supressAuth` only, call `listGroups(null, options)`. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Get a list of groups ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { groups } from 'wix-groups-backend'; export const myListGroupsFunction = webMethod(Permissions.Anyone, () => { return groups.listGroups() .then((groupResults) => { const groupResultsMemberCount = groupResults.groups[0].memberCount; const groupResultsName = groupResults.groups[0].name; return groupResults; }) .catch((error) => { console.error(error); }); }); /* Promise resolves to: * groups: [ * { * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7" * "name": "My Group 1" * "slug": "my-group-1" * "description": "Welcome to the group! You can connect with other members, get updates and share videos." * "privacyStatus": "PUBLIC" * "coverImage": { * "imageUrl": "wix:image://v1/vcc6074e348009011fa9f2d29kk7~mv2.jpg/maple.jpg#originWidth=999&originHeight=240", * "position": { * "x": 44, * "y": 90 * } * } * "memberCount": 83 * "settings": { * "groupUpdatePostEnabled": true * "membersCanApprove": false * "membersCanInvite": true * "showMemberList": true * "welcomeMemberPostEnabled": true * } * "lastActivityDate": "Sun Sep 26 2021 08:23:23 GMT+0300" * "_createdDate": "Tues January 22 2021 12:56:02 GMT+0300" * "_updatedDate": "Fri October 2 2021 04:56:22 GMT+0300" * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34" * }, * { * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221" * "name": "My Group 2" * "slug": "my-group-2" * "description": "Welcome to the group! You can connect with other members, get updates and share videos." * "privacyStatus": "PRIVATE" * "coverImage": { * "imageUrl": "wix:image://v1/dn33kcc6074e348009011fa9f2d29k03~mv2.jpg/fire.jpg#originWidth=287&originHeight=100", * "position": { * "x": 55, * "y": 166 * } * } * "memberTitle": "Friends" * "memberCount": 68 * "settings": { * "groupUpdatePostEnabled": true * "membersCanApprove": true * "membersCanInvite": true * "showMemberList": false * "welcomeMemberPostEnabled": true * } * "lastActivityDate": "Thurs Nov 12 2020 11:13:03 GMT+0300" * "_createdDate": "Wed May 14 2020 10:05:20 GMT+0300" * "_updatedDate": "Sun June 7 2020 09:07:33 GMT+0300" * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67" * } * ], * metadata: * { * "length": 2 * "tooManyToCount": false * "totalCount": 2 * } */ ``` ## Get a list of groups using options ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { groups } from 'wix-groups-backend'; // Sample paging value: // { // limit: 2, // skip: 1 // } // // Sample options value: // { // suppressAuth: true // } export const myListGroupsFunction = webMethod(Permissions.Anyone, async (paging, options) => { try { const groupResults = await groups.listGroups(paging, options); const groupResultsMemberCount = groupResults.groups[0].memberCount; const groupResultsName = groupResults.groups[0].name; return groupResults; } catch (error) { console.error(error); } }); /* Promise resolves to: * groups: [ * { * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7" * "name": "My Group 2" * "slug": "my-group-2" * "description": "Welcome to the group! You can connect with other members, get updates and share videos." * "privacyStatus": "PUBLIC" * "memberCount": 68 * "settings": { * "groupUpdatePostEnabled": true * "membersCanApprove": false * "membersCanInvite": true * "showMemberList": true * "welcomeMemberPostEnabled": true * } * "lastActivityDate": "Sun Sep 26 2021 08:23:23 GMT+0300" * "_createdDate": "Tues January 22 2021 12:56:02 GMT+0300" * "_updatedDate": "Fri October 2 2021 04:56:22 GMT+0300" * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34" * }, * { * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221" * "name": "My Secret Group" * "slug": "5D3yTX" * "description": "This is my secret group." * "privacyStatus": "SECRET" * "coverImage": { * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2d2961b~mv2.jpg/oak.jpg#originWidth=400&originHeight=900", * "position": { * "x": 80, * "y": 77 * } * } * "memberCount": 10 * "settings": { * "groupUpdatePostEnabled": true * "membersCanApprove": true * "membersCanInvite": true * "showMemberList": false * "welcomeMemberPostEnabled": true * } * "lastActivityDate": "Thurs Nov 12 2020 11:13:03 GMT+0300" * "_createdDate": "Wed May 14 2020 10:05:20 GMT+0300" * "_updatedDate": "Sun June 7 2020 09:07:33 GMT+0300" * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67" * } * ], * metadata: * { * "length": 2 * "tooManyToCount": false * "totalCount": 2 * } */ ``` ---