I am trying to use jsforce to post a message to the chatter section of a salesforce opportunity. I pieced the following together from watching how salesforce.com works, but it doesn't do what I want it to do. I am guessing on some of this. recordId is the opportunity number as pulled from the salesforce URL. I am using similar code to create tasks and upload files to an opportunity and that works fine. Does anyone have any ideas as to how to approach this? Thanks!
conn.sobject('/feed-elements').create({
feedElementType: "FeedItem",
feedItemInput: {
subjectId: recordId,
body: {
messageSegments: [
{
"type":"MarkupBegin",
"markupType":"Paragraph"
},
{
type: 'Text',
text: 'This is new comment #1'
},
{
"type":"MarkupEnd",
"markupType":"Paragraph"
}
]
}
}
});