Per this Salesforce developer blog post, I am using a Force.com Site to publicly expose a REST web service:

[...] add the class and any relevant objects/fields to your Site’s Public Access Settings, and you can access the REST methods via the Site URL.

After setting all that up, I ran into a limitation I was unaware of, namely that the Guest User profile on Force.com Sites cannot post to Chatter (unlike Community Guest User profiles). I found this IdeaExchange post, with a comment which states:

We simply want to post to the Chatter feed, and have tried so many different ways:

  1. Directly in the Apex controller of the Site page
  2. Through a trigger on one of the objects that we are already updating
  3. Through an @future call from the trigger
  4. Through scheduling a separate batch Apex class from the trigger
  5. Through creating an Apex class as a web service inside of SFDC and calling it from the Site page
  6. Through updating a field in a custom object and then scheduling an Apex class to read that field and create the comment. This does work, but it isn't real-time, which is important in our scenario
  7. We finally settled on sending an email to an Email Service that parses the email, and writes the appropriate comment. This does work, but then we're running into email limits.

If (near) real-time is the requirement and there's a preference to avoid setting up an authenticated middle-man, what would you advise to achieve this? I addition to the options from the comment above, I've also tried using Platform Events (no-go). Basically, I need to break out of the Guest User running user context.

Would it work to do a callout to the Salesforce REST API from within my Apex code, using an integration user's authentication? Is that possible? (I'd rather not go down that rabbit hole if there's a glaring issue that I'm not realizing...)

EDIT: Error message received:

Guest users are not permitted to perform this operation.

  • Can you please add the error message you are encountering when the public site user attempts to access the Chatter/Connect APIs. Apr 30, 2018 at 23:25

1 Answer 1


As you found, there is the existing idea Allow Guest user to post to chatter (insert FeedItem records) to add native support for this.

A callout to the REST API will allow you to workaround this limitation assuming you are authenticating as a user who has permissions to post to chatter. It would be worth a test first to see if you can use a Named Credential from the public apex service.

For Chatter Communities (Not Public Sites as requested)

I suspect you are running into the problem highlighted in The Connect API is not enabled for this user type. That is, the guest user that is accessing the public site doesn't have a chatter license. So you will be fighting against the licensing model to work around that. The recommendation there by Peter was to use Chatter communities. The documentation from the Summer '13 release is significantly out of date (as you would expect).

I found How to enable Chatter Communities? had a useful answer from @glls:

[...] for guest users, there is a setting that enables them to use chatter, under community administration in the preferences tab:
"Give access to public API requests on Chatter"

Which lead me to "Enabling API Access to Chatter for Guest Users":

Enabling public access through the guest user profile and the API exposes data for guest users through Chatter in Apex which is helpful when you’re building your own community pages from scratch.

I haven't tried it, but that sounds very much like what you are after. Of course, you should consider if you are exposing more than you intended in enabling that.

  • Thanks, but this is only relevant to Communities versus Force.com sites, no? For a site, there is no such setting that I can find.
    – Mike
    Apr 30, 2018 at 23:08
  • I can't find any recent info on a limit to the number of force.com sites an org can have (5 yr old info states 25). I had actually just assumed the limit would be higher than Communities (which is 100)...if the older info is still correct, then it might make more sense to use a Community instead anyway.
    – Mike
    Apr 30, 2018 at 23:18
  • I'd assumed that the error was similar between the public sites user and the community users. Is that not the case? It's been awhile since I've done anything with public sites. Apr 30, 2018 at 23:24
  • 1
    It's the same error. It just seems like the Community admin UI has a setting which allows you to enable Chatter for the guest user, whereas Sites (lacking the Community workspaces UI) has no parallel ability.
    – Mike
    Apr 30, 2018 at 23:32
  • 1
    @Mike That's a pain. It seemed like a promising setting. That said. I don't see why a properly authenticated callout couldn't create the chatter post. Named credentials would be ideal in this case. Apr 30, 2018 at 23:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .