Search.../

listJoinGroupRequests( )

Lists requests to join a group.

Description

Note: This function is only relevant for private groups.

The listjoinGroupRequests() function returns a Promise that resolves to a list of up to 100 requests to join a group. Sorts by default to _createdDate in descending order. Only site admins and group admins can see requests to join their group. Site members can access their own join requests in their site.

Notes:

Admin Method

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

Syntax

function listJoinGroupRequests(groupId: string, options: ListJoinGroupRequestsOptions): Promise<ListJoinGroupRequestsResponse>

listJoinGroupRequests Parameters

NAME
TYPE
DESCRIPTION
groupId
string

ID of the group requested to join.

options
Optional
ListJoinGroupRequestsOptions

Returns

Return Type:

Promise<
ListJoinGroupRequestsResponse
>
NAME
TYPE
DESCRIPTION
joinGroupRequests
Array<
JoinGroupRequest
>

Join group requests.

metadata
PagingMetadata

Was this helpful?

List all requests to join a group (dashboard page code)

Copy Code
1import { joinGroupRequests } from 'wix-groups.v2';
2
3// Sample groupId: 'fc3df3c1-36b2-4279-8be1-8e72a05a88c8'
4
5 async function listJoinGroupRequests(groupId, options) {
6 try {
7 const result = await joinGroupRequests.listJoinGroupRequests(groupId);
8
9 return result;
10 } catch (error) {
11 console.error(error);
12 // Handle the error
13 }
14 }
15
16 /* Promise resolves to:
17 * joinGroupRequests: [
18 * {
19 * "requestDetails": {"rejectionReason": "none"}
20 * "siteMemberId": "124cd3db-e9be-4980-93c1-a6d767a11099"
21 * "status": "REJECTED"
22 * },
23 * {
24 * "requestDetails": {}
25 * "siteMemberId": "2f48e9e1-d050-4c86-9684-e7f231600f29"
26 * "status": "APPROVED"
27 * }
28 * ]
29 * metadata:
30 * {
31 * "count": 2
32 * "offset": 0
33 * "tooManyToCount": false
34 * "total": 2
35 * }
36 */
List all requests to join a group (export from backend code)

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { joinGroupRequests } from 'wix-groups.v2';
3
4// Sample groupId: 'fc3df3c1-36b2-4279-8be1-8e72a05a88c8'
5
6export const listJoinGroupRequests = webMethod(Permissions.Anyone, async (groupId) => {
7 try {
8 const result = await joinGroupRequests.listJoinGroupRequests(groupId);
9
10 return result;
11 } catch (error) {
12 console.error(error);
13 // Handle the error
14 }
15});
16
17/* Promise resolves to:
18 * joinGroupRequests: [
19 * {
20 * "requestDetails": {"rejectionReason": "none"}
21 * "siteMemberId": "124cd3db-e9be-4980-93c1-a6d767a11099"
22 * "status": "REJECTED"
23 * },
24 * {
25 * "requestDetails": {}
26 * "siteMemberId": "2f48e9e1-d050-4c86-9684-e7f231600f29"
27 * "status": "APPROVED"
28 * }
29 * ]
30 * metadata:
31 * {
32 * "count": 2
33 * "offset": 0
34 * "tooManyToCount": false
35 * "total": 2
36 * }
37 */
38
List some requests to join a group using paging options

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { joinGroupRequests } from 'wix-groups.v2';
3
4// Sample groupId: 'fc3df3c1-36b2-4279-8be1-8e72a05a88c8'
5//
6// Sample options value:
7// {
8// limit: 2
9// offset: 2
10// }
11
12export const listJoinGroupRequests = webMethod(Permissions.Anyone, async (groupId, options) => {
13 try {
14 const result = await joinGroupRequests.listJoinGroupRequests(groupId, options);
15
16 return result;
17 } catch (error) {
18 console.error(error);
19 // Handle the error
20 }
21});
22
23/* Promise resolves to:
24 * joinGroupRequests: [
25 * {
26 * "requestDetails": {"rejectionReason": "Wrong group."}
27 * "siteMemberId": "7fe8e9e1-d050-4c86-9684-e7f231600a34"
28 * "status": "REJECTED"
29 * },
30 * {
31 * "requestDetails": {}
32 * "siteMemberId": "937cd3db-e9be-4980-93c1-a6d767a11050"
33 * "status": "APPROVED"
34 * }
35 * ]
36 * metadata:
37 * {
38 * "count": 2
39 * "offset": 2
40 * "tooManyToCount": false
41 * "total": 5
42 * }
43 */
44