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

Copy Code
1import { joinRequests } from 'wix-groups-backend';
2
3// Sample groupId value:
4// 'fc3df3c1-36b2-4279-8be1-8e72a05a88c8'
5//
6// Sample paging value:
7// {
8// limit: 2,
9// skip: 1
10// }
11//
12// Sample options value:
13// {
14// suppressAuth: true
15// }
16
17export function myListJoinRequestsFunction(groupId, paging, options) {
18 return joinRequests.listJoinRequests(groupId, paging, options)
19 .then((joinRequestsResults) => {
20 const joinRequestStatus = joinRequestsResults.joinRequests[0].status;
21 return joinRequestsResults;
22 })
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 */