---
schema_version: "1"
id: 265082f60f8e68be7a6df7d0626f413e7586d5579ffcffcf9fd641d21d0229fc
title: Post a Comment
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/connectapi_examples_post_comment_feed_element.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/connectapi_examples_post_comment_feed_element.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: e97b2ce81cf25c5c74e5ef1bfc81760b510b3c0532568c088be33fc484e03354
description: Call a method to post a comment.
---
# Post a Comment

Call a method to post a comment.

Call [postCommentToFeedElement(communityId, feedElementId, text)](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_ConnectAPI_ChatterFeeds_static_methods.htm#apex_ConnectAPI_ChatterFeeds_postCommentToFeedElement_1) to post a plain text comment to a feed element.

ConnectApi.Comment comment = ConnectApi.ChatterFeeds.postCommentToFeedElement(null, '0D5D0000000KuGh', 'I agree with the proposal.' );