Newer Version Available

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

Post an @Mention

Post an @mention in a Chatter feed item or comment.
Resource
To post a feed item with a mention, use /chatter/feed-elements.
To post a comment with a mention, use /chatter/feed-elements/feedElementId/capabilities/comments/items.
HTTP method
POST
Request body
For a feed item, use Feed Item Input

For a comment, use Comment Input

Both of these input request bodies include a body property that is a Message Body Input request body. In these examples, the Message Body Input request body includes a messageSegments property that has one Message Segment Input: Text request body and one Message Segment Input: Mention request body.

Request body example
This example is for a feed item:
1{ 
2   "body" : {
3      "messageSegments" : [
4         {
5            "type" : "Text",
6            "text" : "When should we meet for release planning? "
7         },
8         {   
9            "type" : "Mention",
10            "id" : "005T0000000mzCy"
11         }
12      ]
13   },
14   "feedElementType" : "FeedItem",
15   "subjectId" : "005D00000016Qxp"
16}
This example is for a comment:
1{ "body" : 
2   { 
3      "messageSegments" : [ 
4         { 
5           "type": "mention", 
6           "id" : "005D0000001GpHp" 
7         },
8         { 
9           "type": "text", 
10           "text" : " Did you see the new plans?" 
11         }
12      ]
13   }
14}

Include a space in the text message segment because spaces aren’t added automatically before or after a mention.

Note

Returns
Feed Item
Comment