Question:
Is it possible to send group creation request to the dashboard from code ?
Product:
Wix Editor
What are you trying to achieve:
I’m trying to use the createGroup() backend function so that when a member creates a group through a custom form, a request is sent to the website dashboard.
I’ve selected the correct parameters (“member with approval”) in the group settings, but when I try to create a group using the test website while logged in as a member, I get a “Forbidden” error when createGroup is called.
The “Create Group” button inside the Groups Feed correctly sends a request to the dashboard, but when triggered via code, it doesn’t work.
What have you already tried:
Elevating the function, changing the group settings parameters. It just let the member create the group without sending the request.
Backend code :
import { groups } from "wix-groups-backend";
import {webMethod, Permissions } from "wix-web-module";
export const myCreateGroupFunction = webMethod( Permissions.SiteMember,
(groupInfo, options) => {
return groups
.createGroup(groupInfo, options)
.then((createdGroup) => {
return createdGroup;
})
.catch((error) => {
console.error(error);
});
},
);