@wix/wix-groups-feed-client "createFeedItem" defaults to Site Owner Only

I’m having trouble with

I want to be able to programmatically insert and update posts in WIX Groups. I found a WIX Article regarding their NPM package, which the help centre confirmed is managed by WIX and is the only way to do this.

When I use createFeedItem, it only creates a feed item using the Site Owner. Please note, I am currently signed in as another user and testing this on the live site. The NPM package is @wix/wix-groups-feed-client

How can I use createFeedItem to create a feed item for the currently signed-in user?

Working in

Wix Studio Editor

What I’m trying to do

I want to be able to create posts programmatically so I can control the layout and display of posts in the WIX Groups app. I also want to be able to create custom feeds.

What I’ve tried so far

I have tried adding the code to my site and testing it on the live site.

Extra context

The code I’m referring to is from this NPM package and is the first code block on the page. It is the only reference to creating feed items.

https://www.npmjs.com/package/@wix/wix-groups-feed-client

It’s difficult to say without seeing the code used.

I’d also encourage using the Dev Docs, which have the most accurate reference for the SDKs that can be used within sites etc. - API Reference Docs

Regarding creating posts within Groups, I’m unsure if it’s supported at the moment - Introduction - since it’s not currently listed as available in the SDK docs

Hey @noahlovell, thanks for the reply!

The Code I used is the one from the NPM docs, which is the one linked in the official WIX Help Centre documentation.

I also reached out via the ‘manage.wix. com/studio/partner-tickets’ team to confirm it was managed by WIX, and they said it was. Additionally, they confirmed it is the only way to access posts through the WIX Groups App.

Below is the code (missing the API keys, etc.) It works fine, and it does create a post; however, the post it creates is always tied to the site owner, not the currently logged-in member.

Is this a bug, do you think? You would assume the code would create a post for the user who is logged in. It seems a little redundant to make the option, if only the site owner can create posts programmatically.

I am using getMember from the API docs to check the ID of the user who is currently logged in, and it is returning a different member number than the createdBy ID returned by the function below.

The createdBy ID returned by the function is always the Site Owner’s ID.

Many thanks!

import { Permissions, webMethod } from "wix-web-module";
import { WixGroupsFeedService } from '@wix/wix-groups-feed-client';

const apiKey = // my api key
const siteId = // my site id
const authorization = // auth constructor
const client = new WixGroupsFeedService(authorization, siteId, {debugMode: true});

export const createFeedItem = webMethod(
  Permissions.Anyone,
  async (groupId) => {
    try {
      const content = {  }, // my post content
      };

      const post = await client.createFeedItem(groupId, {
        body: {
          contentType: 'DRAFTJS',
          content: JSON.stringify(content)
        },
      });
      return post;
    } catch (e) {
      return e;
    }
  }
);