Newer Version Available

This content describes an older version of this product. View Latest

Post a Feed Element and Include Files from Salesforce

This example posts a feed element with more than one file, all of which have been uploaded to Salesforce.

In version 36.0 and later, you can’t create a feed post and upload a binary file in the same request. Upload files to Salesforce first, and then use the file IDs to attach one or more files to a feed post.

Important

Resource
/chatter/feed-elements
HTTP method
POST
Request body
Feed Item Input
Request body example
1{
2   "body":{
3      "messageSegments":[
4         {
5            "type":"Text",
6            "text":"Please take a look at these files."
7         }
8      ]
9   },
10   "capabilities":{
11      "files":{
12         "items": [
13            {"id": "069D00000001IOh"},
14            {"id": "069D00000002IOg"}
15         ]
16      }
17   },
18   "subjectId":"me",
19   "feedElementType":"FeedItem"
20}
Returns
Feed Item