Search.../

listCreateRequests( )

Lists requests to create a group.

Description


Note: This function is only relevant if admin approval is required for creating a group, or if the function's suppressAuth option is set to true.

The listCreateRequests() function returns a Promise that resolves to a list of up to 1,000 create requests on your site. Sorts by default to _createdDate in descending order. Only site admins can see create requests. Site members can access their own create requests in their site.

Notes:

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

Syntax

function listCreateRequests([paging: Paging], [options: Options]): Promise<ListCreateRequests>

listCreateRequests Parameters

NAME
TYPE
DESCRIPTION
paging
Optional
Paging

Paging options.

options
Optional
Options

Authorization options.

Returns

Return Type:

Promise<ListCreateRequests>
NAME
TYPE
DESCRIPTION
createRequests
Array<CreateRequest>

Requests to create a group.

metadata
Metadata

Paging information.

Was this helpful?

List requests to create a group

Copy Code
1import { createRequests } from 'wix-groups-backend';
2
3export function myListCreateRequestsFunction() {
4 return createRequests.listCreateRequests()
5 .then((createRequestsResults) => {
6 const createRequestStatus = createRequestsResults.createRequests[0].status;
7 const createRequestName = createRequestsResults.createRequests[0].group.name;
8 return createRequestsResults;
9 })
10 .catch((error) => {
11 console.error(error);
12 });
13}
14
15/* Promise resolves to:
16 * createRequests: [
17 * {
18 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"
19 * "status": "PENDING",
20 * "group": {
21 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"
22 * "name": "My Group Request 1"
23 * "slug": "my-group-request-1"
24 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."
25 * "privacyStatus": "PUBLIC"
26 * "coverImage": {
27 * "imageUrl": "wix:image://v1/22j9074e348009011fa9f2d2961b~mv2.jpg/corn.jpg#originWidth=112&originHeight=224",
28 * "position": {
29 * "x": 80,
30 * "y": 53
31 * }
32 * }
33 * "memberTitle": "Employees"
34 * "memberCount": 1
35 * "settings": {
36 * "groupUpdatePostEnabled": true
37 * "membersCanApprove": false
38 * "membersCanInvite": true
39 * "showMemberList": true
40 * "welcomeMemberPostEnabled": true
41 * }
42 * "lastActivityDate": "Sun Sep 26 2021 08:23:23 GMT+0300"
43 * "_createdDate": "Tues January 22 2021 12:56:02 GMT+0300"
44 * "_updatedDate": "Fri October 2 2021 04:56:22 GMT+0300"
45 * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34"
46 * }
47 * },
48 * {
49 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221"
50 * "status": "APPROVED",
51 * "group": {
52 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221"
53 * "name": "My Group Request 2"
54 * "slug": "my-group-request-2"
55 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."
56 * "privacyStatus": "PRIVATE"
57 * "coverImage": {
58 * "imageUrl": "wix:image://v1/664e64e348009011fa9f2d2961e~mv2.jpg/time.jpg#originWidth=2922&originHeight=778",
59 * "position": {
60 * "x": 0,
61 * "y": 0
62 * }
63 * }
64 * "memberTitle": "Friends"
65 * "memberCount": 65
66 * "settings": {
67 * "groupUpdatePostEnabled": true
68 * "membersCanApprove": true
69 * "membersCanInvite": true
70 * "showMemberList": false
71 * "welcomeMemberPostEnabled": true
72 * }
73 * "lastActivityDate": "Thurs Nov 12 2020 11:13:03 GMT+0300"
74 * "_createdDate": "Wed May 14 2020 10:05:20 GMT+0300"
75 * "_updatedDate": "Sun June 7 2020 09:07:33 GMT+0300"
76 * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67"
77 * }
78 * }
79 * "_id": "57vn211-b477-4e9tt-ba4j-df338c5adf337"
80 * "status": "REJECTED"
81 * "rejectionReason": "This group has inappropriate content.",
82 * "group": {
83 * "_id": "57vn211-b477-4e9tt-ba4j-df338c5adf337"
84 * "name": "My Group Request 3"
85 * "slug": "my-group-request-3"
86 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."
87 * "privacyStatus": "PRIVATE"
88 * "coverImage": {
89 * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2d2961b~mv2.jpg/popcorn.jpg#originWidth=712&originHeight=667",
90 * "position": {
91 * "x": 44,
92 * "y": 15
93 * }
94 * }
95 * "memberTitle": "Students"
96 * "memberCount": 1
97 * "settings": {
98 * "groupUpdatePostEnabled": true
99 * "membersCanApprove": true
100 * "membersCanInvite": true
101 * "showMemberList": false
102 * "welcomeMemberPostEnabled": true
103 * }
104 * "lastActivityDate": "Mon Feb 04 2019 01:19:53 GMT+0300"
105 * "_createdDate": "Mon Feb 04 2019 01:19:53 GMT+0300"
106 * "_updatedDate": "Mon Feb 04 2019 01:19:53 GMT+0300"
107 * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67"
108 * }
109 * }
110 * ],
111 * metadata:
112 * {
113 * "length": 3
114 * "tooManyToCount": false
115 * "totalCount": 3
116 * }
117 */
List requests to create a group using options

Copy Code
1import { createRequests } from 'wix-groups-backend';
2
3// Sample paging value:
4// {
5// limit: 3,
6// skip: 1
7// }
8//
9// Sample options value:
10// {
11// suppressAuth: true
12// }
13
14export function myListCreateRequestsFunction(paging, options) {
15 return createRequests.listCreateRequests(paging, options)
16 .then((createRequestsResults) => {
17 const createRequestStatus = createRequestsResults.createRequests[0].status;
18 const createRequestName = createRequestsResults.createRequests[0].group.name;
19 return createRequestsResults;
20 })
21 .catch((error) => {
22 console.error(error);
23 });
24}
25
26/* Promise resolves to:
27 * createRequests: [
28 * {
29 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"
30 * "status": "PENDING",
31 * "group": {
32 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"
33 * "name": "My Group Request 2"
34 * "slug": "my-group-request-2"
35 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."
36 * "privacyStatus": "PUBLIC"
37 * "coverImage": {
38 * "image": {
39 * "height": 4032
40 * "mediaId": "https://static.wixstatic.com/media/waz1z1_53219a2f194c4c29bda210ecca987zf99~mv2.jpeg"
41 * "width": 3024
42 * }
43 * "memberTitle": "Co-workers"
44 * "memberCount": 1
45 * "settings": {
46 * "groupUpdatePostEnabled": true
47 * "membersCanApprove": false
48 * "membersCanInvite": true
49 * "showMemberList": true
50 * "welcomeMemberPostEnabled": true
51 * }
52 * "lastActivityDate": "Sun Sep 26 2021 08:23:23 GMT+0300"
53 * "_createdDate": "Tues January 22 2021 12:56:02 GMT+0300"
54 * "_updatedDate": "Fri October 2 2021 04:56:22 GMT+0300"
55 * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34"
56 * }
57 * },
58 * {
59 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221"
60 * "status": "APPROVED",
61 * "group": {
62 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221"
63 * "name": "My Group Request 3"
64 * "slug": "my-group-request-3"
65 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."
66 * "privacyStatus": "PRIVATE"
67 * "coverImage": {
68 * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2d2961b~mv2.jpg/oak.jpg#originWidth=400&originHeight=900",
69 * "position": {
70 * "x": 70,
71 * "y": 95
72 * }
73 * }
74 * "memberTitle": "Students"
75 * "memberCount": 20
76 * "settings": {
77 * "groupUpdatePostEnabled": true
78 * "membersCanApprove": true
79 * "membersCanInvite": true
80 * "showMemberList": false
81 * "welcomeMemberPostEnabled": true
82 * }
83 * "lastActivityDate": "Thurs Nov 12 2020 11:13:03 GMT+0300"
84 * "_createdDate": "Wed May 14 2020 10:05:20 GMT+0300"
85 * "_updatedDate": "Sun June 7 2020 09:07:33 GMT+0300"
86 * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67"
87 * }
88 * },
89 * {
90 * "_id": "29005463-64b7-499tt-cc8j-jfj98c5ad9772"
91 * "status": "REJECTED"
92 * "rejectionReason": "This group is only for members of the football team.",
93 * "group": {
94 * "_id": "29005463-64b7-499tt-cc8j-jfj98c5ad9772"
95 * "name": "My Group Request 4"
96 * "slug": "my-group-request-4"
97 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."
98 * "privacyStatus": "PRIVATE"
99 * "coverImage": {
100 * "imageUrl": "wix:image://v1/s9074e348009011fa9f2d2944~mv2.jpg/sugar.jpg#originWidth=560&originHeight=230",
101 * "position": {
102 * "x": 0,
103 * "y": 60
104 * }
105 * "memberTitle": "Members"
106 * "memberCount": 1
107 * "settings": {
108 * "groupUpdatePostEnabled": false
109 * "membersCanApprove": true
110 * "membersCanInvite": false
111 * "showMemberList": false
112 * "welcomeMemberPostEnabled": false
113 * }
114 * "lastActivityDate": "Tues Jan 02 2020 09:17:07 GMT+0300"
115 * "_createdDate": "Tues Jan 02 2019 09:17:07 GMT+0300"
116 * "_updatedDate": "Tues Jan 02 2020 09:17:07 GMT+0300"
117 * "owner": "cad5e9e1-jab0-9c46-1344-e79231600cff2"
118 * }
119 * }
120 * ],
121 * metadata:
122 * {
123 * "length": 3
124 * "tooManyToCount": false
125 * "totalCount": 3
126 * }
127 */