Search.../

listJoinRequests( )

Lists requests to join a group.

Description


Note: This function is only relevant for private groups.

The listJoinRequests() 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:

  • If the suppressAuth option is set to true, all permissions are overwritten, and all site members (including non-group members) can see requests to join a group.
  • 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 listJoinRequests(groupId, paging, null). To specify supressAuth only, call listJoinRequests(groupId, null, options).

Syntax

function listJoinRequests(groupId: string, [paging: Paging], [options: Options]): Promise<ListJoinRequests>

listJoinRequests Parameters

NAME
TYPE
DESCRIPTION
groupId
string

ID of the group requested to join.

paging
Optional
Paging

Paging options.

options
Optional
Options

Authorization options.

Returns

Return Type:

Promise<ListJoinRequests>
NAME
TYPE
DESCRIPTION
joinRequests
Array<JoinRequest>

Requests to join a group.

metadata
Metadata

Paging information.

Was this helpful?

List all requests to join a group

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { joinRequests } from 'wix-groups-backend';
3
4// Sample groupId value:
5// 'fc3df3c1-36b2-4279-8be1-8e72a05a88c8'
6
7export const myListJoinRequestsFunction = webMethod(Permissions.Anyone, (groupId) => {
8 return joinRequests.listJoinRequests(groupId)
9 .then((joinRequestsResults) => {
10 const joinRequestStatus = joinRequestsResults.joinRequests[0].status;
11 return joinRequestsResults;
12 })
13 .catch((error) => {
14 console.error(error);
15 });
16});
17
18/* Promise resolves to:
19 * joinRequests: [
20 * {
21 * "memberId": "937cd3db-e9be-4980-93c1-a6d767a11050"
22 * "_createdDate": "Wed May 14 2021 10:05:20 GMT+0300"
23 * "status": "REJECTED"
24 * "rejectionReason": "Wrong group."
25 * },
26 * {
27 * "memberId": "7fe8e9e1-d050-4c86-9684-e7f231600a34"
28 * "_createdDate": "Sun July 11 2020 03:25:30 GMT+0300"
29 * "status": "PENDING"
30 * }
31 * ],
32 * metadata:
33 * {
34 * "length": 2
35 * "tooManyToCount": false
36 * "totalCount": 5
37 * }
38 */
List all requests to join a group using options

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { joinRequests } from 'wix-groups-backend';
3
4// Sample groupId value:
5// 'fc3df3c1-36b2-4279-8be1-8e72a05a88c8'
6//
7// Sample paging value:
8// {
9// limit: 2,
10// skip: 1
11// }
12//
13// Sample options value:
14// {
15// suppressAuth: true
16// }
17
18export const myListJoinRequestsFunction = webMethod(Permissions.Anyone, async (groupId, paging, options) => {
19 try {
20 const joinRequestsResults = await joinRequests.listJoinRequests(groupId, paging, options);
21 const joinRequestStatus = joinRequestsResults.joinRequests[0].status;
22 return joinRequestsResults;
23 } catch (error) {
24 console.error(error);
25 }
26});
27
28/* Promise resolves to:
29 * joinRequests: [
30 * {
31 * "memberId": "937cd3db-e9be-4980-93c1-a6d767a11050"
32 * "_createdDate": "Wed May 14 2021 10:05:20 GMT+0300"
33 * "status": "REJECTED"
34 * "rejectionReason": "Wrong group."
35 * },
36 * {
37 * "memberId": "7fe8e9e1-d050-4c86-9684-e7f231600a34"
38 * "_createdDate": "Sun July 11 2020 03:25:30 GMT+0300"
39 * "status": "PENDING"
40 * }
41 * ],
42 * metadata:
43 * {
44 * "length": 2
45 * "tooManyToCount": false
46 * "totalCount": 5
47 * }
48 */