function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
martin_wumartin_wu 

How to post to a certain group via API

Hi all,

 

This is probably quite simple, but I haven't found any sample code anywhere, yet: How can I post to a certain from using the Chatter API?

The background is that a user wants to batch-post the same item to several groups in one go, so I want to built a little utility app that grabs the latest post by that user and copies it to several groups.

Any ideas?

 

Kind regards,

 

Martin

 

Jon Mountjoy_Jon Mountjoy_

Have you checked out the Chatter Resource Page, and in particular the Chatter Code Recipes article?  Check out Recipe 6, an in particular this comment "Similarly, you can post to a user or group feed by setting the parentId to the respective User/Group Id."

 

That should do it!

martin_wumartin_wu

Thanks a lot, Jon. I should have been a bit more specific: I was looking for code examples using a Java client connecting to the SOAP API. The examples in the recipe and also on the cheat sheet are all written in Apex.

There is some Java sample code in the workbook ( http://www.salesforce.com/us/developer/docs/workbook_chatter/index.htm ), but it doesn't cover updating a group status.

 

Cheers,

Martin

 

cloudcodercloudcoder

Working with Chatter from something like Java is basically working with the Data Model. You just need to create a feeditem with the parentid being that of the groupid something like:

 

 

    SObject so = new SObject();
    so.setType("FeedItem");
    so.setField("ParentId", "my-group-id"); 
    so.setField("Body", "hello there");

 

 

_Prasu__Prasu_

May be following link can give more code sample:

http://thysmichels.com/2012/04/26/chatter-api-post-update-via-java/