Newer Version Available

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

Post a Feed Element with an Inline Image

Post a feed element with an inline image in Chatter.

This example posts a feed element with an inline image that has been uploaded to Salesforce. To upload a new file, see Uploading Binary Files.

Resource
/chatter/feed-elements
HTTP method
POST
Request body
Feed Item Input

This Feed Item Input request body includes a body property that is a Message Body Input request body. In this example, the Message Body Input request body includes a messageSegments property that has two Message Segment Input: Text request bodies and two Message Segment Input: Inline Image request bodies.

Request body example
1{
2   "body":{
3      "messageSegments":[
4         {
5            "type":"Text",
6            "text":"Please take a look at this file."
7         },
8         {
9            "type":"InlineImage",
10            "fileId":"069xx00000000QO",
11            "altText":"API Spec"
12         },
13         {
14            "type":"Text",
15            "text":"And this one."
16         },
17         {
18            "type":"InlineImage",
19            "fileId":"069xx00000000QT",
20            "altText":"REST API Spec"
21         }
22      ]
23   },
24   "subjectId":"me",
25   "feedElementType":"FeedItem"
26}
Returns
Feed Item