3

Is there a way to specify a particular community when creating a Chatter post in the Connect API using Apex? EntitySubscription etc. have a NetworkIdfield for connecting things to particular communities, but the only methods I can see that are community related are for reading some basic information about the communities available.

2

Yes, almost every Connect API (Chatter REST API) endpoint supports communities. For posting a feed item to your news feed, the URL has this form:

/connect/communities/<communityId>/chatter/feeds/news/me/feed-items

See http://www.salesforce.com/us/developer/docs/chatterapi/Content/intro_building_url.htm for more information.

Using the ConnectApi namespace in Apex, almost all of the methods include the network/community ID as the first parameter. For the posting example, one of the methods you could use is ConnectApi.ChatterFeeds.postFeedItem(String communityId, ConnectApi.FeedType feedType, String subjectId, String text)

| improve this answer | |
  • Ah, I should have been more specific. I meant using the Connect API from Apex, not REST. – Matt Lacey Dec 8 '13 at 3:25
  • Using the ConnectApi namespace in Apex, almost all of the methods include the network/community ID as the first parameter. For the posting example, one of the methods you could use is ConnectApi.ChatterFeeds.postFeedItem(String communityId, ConnectApi.FeedType feedType, String subjectId, String text). – alouie Dec 10 '13 at 7:26
  • Hmmm, maybe I was looking at older docs! – Matt Lacey Dec 11 '13 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.