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:
- Directly in the Apex controller of the Site page
- Through a trigger on one of the objects that we are already updating
- Through an @future call from the trigger
- Through scheduling a separate batch Apex class from the trigger
- Through creating an Apex class as a web service inside of SFDC and calling it from the Site page
- 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
- 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.