Search.../

listGroupMembers( )

Lists all members of a group.

Description

The listGroupMembers() function returns a Promise that resolves to a list of up to 100 group members. Sorts by default to joinedDate in descending order.

Note: For SECRET groups, only site admins, group admins, and group members can see the list of group members.

Admin Method

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

Syntax

function listGroupMembers(groupId: string, options: ListGroupMembersOptions): Promise<ListGroupMembersResponse>

listGroupMembers Parameters

NAME
TYPE
DESCRIPTION
groupId
string

Group ID.

options
Optional
ListGroupMembersOptions

Paging options.

Returns

Return Type:

Promise<
ListGroupMembersResponse
>
NAME
TYPE
DESCRIPTION
members
Array<
GroupMember
>

Retrieved members.

metadata
PagingMetadata

Paging information.

Was this helpful?

List all site members in a group

Copy Code
1
2import { members } from 'wix-groups.v2';
3
4// Sample groupId value: '5213c421-7284-22274-c345-6da37c665231'
5
6 async function listGroupMembers(groupId) {
7 try {
8 const result = await members.listGroupMembers(groupId, options);
9 return result;
10 } catch (error) {
11 console.error(error);
12 // Handle the error
13 }
14 }
15
16/* Promise resolves to:
17 * members: [
18 * {
19 * "joinedDate": "Sun Aug 01 2021 12:32:35 GMT+0300"
20 * "memberId": "437cd3db-e9be-4980-93c1-a6d767a11050"
21 * "role": {"value": "ADMIN"}
22 * },
23 * {
24 * "joinedDate": "Tues Jun 30 2019 10:09:33 GMT+0300"
25 * "memberId": "7fe8e9e1-d050-4c86-9684-e7f231600a34"
26 * "role": {"value": "MEMBER"}
27 * },
28 * {
29 * "joinedDate": "Wed Jul 01 2019 11:29:43 GMT+0300"
30 * "memberId": "6de7e9e1-f242-3a12-5231-f8e1242c8912"
31 * "role": {"value": "MEMBER"}
32 * }
33 * ],
34 * metadata:
35 * {
36 * "count": 3
37 * "offset": 0
38 * "tooManyToCount": false
39 * "total": 3
40 * }
41 */
List some of the site members in a group using paging options

Copy Code
1
2import { members } from 'wix-groups.v2';
3
4// Sample groupId value: '0261a737-2361-4468-a3b1-5ec2b0667836'
5//
6// Sample options value:
7// {
8// limit: 2
9// offset: 1
10// }
11
12 async function listGroupMembers(groupId, options) {
13 try {
14 const result = await members.listGroupMembers(groupId, options);
15 return result;
16 } catch (error) {
17 console.error(error);
18 // Handle the error
19 }
20 }
21
22/* Promise resolves to:
23 * members: [
24 * {
25 * "joinedDate": "Sun Aug 01 2021 12:32:35 GMT+0300"
26 * "memberId": "437cd3db-e9be-4980-93c1-a6d767a11050"
27 * "role": {"value": "ADMIN"}
28 * },
29 * {
30 * "joinedDate": "Tues Jun 30 2019 10:09:33 GMT+0300"
31 * "memberId": "7fe8e9e1-d050-4c86-9684-e7f231600a34"
32 * "role": {"value": "MEMBER"}
33 * }
34 * ],
35 * metadata:
36 * {
37 * "count": 2
38 * "offset": 1
39 * "tooManyToCount": false
40 * "total": 5
41 * }
42 */