Search.../

approveJoinGroupRequests( )

Approves requests to join a group.

Description

Note: This function is only relevant for private groups.

The approvejoinGroupRequests() 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.

Admin Method

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

Syntax

function approveJoinGroupRequests(groupId: string, memberIds: Array<string>): Promise<ApproveJoinGroupRequestsResponse>

approveJoinGroupRequests Parameters

NAME
TYPE
DESCRIPTION
groupId
string

ID of the group requested to join.

memberIds
Array<
string
>

IDs of the site members to approve.

Returns

Return Type:

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

Approved join group requests.

Was this helpful?

Approve a request to join a group

Copy Code
1
2// Sample groupId: '77490611-53bb-4b47-a7cc-ca9a1335133b',
3//
4// Sample memberIds: ['124cd3db-e9be-4980-93c1-a6d767a11099', '2f48e9e1-d050-4c86-9684-e7f231600f29']
5
6import { joinGroupRequests } from 'wix-groups.v2';
7
8 async function approveJoinGroupRequests(groupId, memberIds) {
9 try {
10 const result = await joinGroupRequests.approveJoinGroupRequests(groupId, memberIds);
11
12 return result;
13 } catch (error) {
14 console.error(error);
15 // Handle the error
16 }
17 }
18
19/* Promise resolves to:
20 * joinGroupRequests: [
21 * {
22 * "requestDetails": {"rejectionReason": "Wrong group."}
23 * "siteMemberId": "124cd3db-e9be-4980-93c1-a6d767a11099"
24 * "status": "REJECTED"
25 * },
26 * {
27 * "requestDetails": {}
28 * "siteMemberId": "2f48e9e1-d050-4c86-9684-e7f231600f29"
29 * "status": "APPROVED"
30 * }
31 * ]
32 */