Search.../

approveJoinRequests( )

Approves requests to join a group.

Description


Note: This function is only relevant for private groups.

The approveJoinRequests() function returns a Promise that resolves when a site member's request to join a group is approved. Only site admins and group admins can approve site member requests to join a group, unless the group setting, membersCanApprove is set to true.

Note: If the suppressAuth option is set to true, all permissions are overwritten, and all site members (including non-group members) can approve site member requests to join a group.

Syntax

function approveJoinRequests(identifiers: Identifiers, [options: Options]): Promise<Array<JoinRequest>>

approveJoinRequests Parameters

NAME
TYPE
DESCRIPTION
identifiers
Identifiers

Group ID and member IDs.

options
Optional
Options

Authorization options.

Returns

Return Type:

Promise<Array<JoinRequest>>
NAME
TYPE
DESCRIPTION
memberId
string

Site member ID of the requester.

_createdDate
Date

Date the site member requested to join the group.

status
string

Status of the request to join a group. One of:

  • "PENDING"
  • "APPROVED"
  • "REJECTED"
rejectionReason
string

Reason the request to join a group was rejected.

Was this helpful?

Approve a request to join a group

Copy Code
1import { joinRequests } from 'wix-groups-backend';
2
3// Sample identifiers value:
4// {
5// groupId: '77490611-53bb-4b47-a7cc-ca9a1335133b',
6// memberIds: ['124cd3db-e9be-4980-93c1-a6d767a11099', '2f48e9e1-d050-4c86-9684-e7f231600f29', '772cd3db-e9be-560-93c1-a6d767a11670']
7// }
8//
9// Sample options value:
10// {
11// suppressAuth: true
12// }
13
14export function myApproveJoinRequestsFunction(identifiers, options) {
15 return joinRequests.approveJoinRequests(identifiers, options)
16 .then((approvedJoinRequests) => {
17 return approvedJoinRequests;
18 })
19 .catch((error) => {
20 console.error(error);
21 });
22}
23
24/* Promise resolves to:
25 * [
26 * {
27 * "memberId": "124cd3db-e9be-4980-93c1-a6d767a11099"
28 * "_createdDate": "Fri Oct 24 2021 22:45:50 GMT+0300"
29 * "status": "APPROVED"
30 * },
31 * {
32 * "memberId": "2f48e9e1-d050-4c86-9684-e7f231600f29"
33 * "_createdDate": "Wed May 14 2021 10:05:20 GMT+0300"
34 * "status": "APPROVED"
35 * },
36 * {
37 * "memberId": "772cd3db-e9be-560-93c1-a6d767a11670"
38 * "_createdDate": "Sun July 11 2020 03:25:30 GMT+0300"
39 * "status": "APPROVED"
40 * }
41 * ]
42 */