Code Assist MCP for Facebook

Build 25.0.9539

Comments

Create, update, delete, and query the Comments for a Target. Comments may also be inserted based on a Target or deleted based on Id. To write comments, a custom OAuth app with the pages_manage_engagement permission is required.

Table Specific Information

Comments in Facebook are comments about a specific thing. They are always associated with a target, which is the item the comment is directed toward. For example, this could be a post, a picture, or a video. Using this table, you can list the comments for a specific target and also insert new comments about a target.

Note: Due to a deprecation in the Facebook API, queries to the Comments, Photos, Posts, and Videos views where a user profile is either the defined or default target, no longer return data for the following fields:

  • comments
  • message_tags
  • reactions
  • sharedposts
  • story
  • story_tags
  • to
  • via
For further information, see https://developers.facebook.com/docs/graph-api/changelog/version16.0.

Select

When querying comments, either the Target or the Id of the comment may be specified. For example, to retrieve all the comments about a specific post, your SELECT statement could look something like this:

SELECT * FROM Comments WHERE Target = '15526475270_410830705612736'

Alternatively, you can specify the Id to retrieve a specific comment. For example:

SELECT * FROM Comments WHERE Id = '15526475270_410830705612736_5193593'

If no Target or Id is specified, comments will be queried from the posts of the feed of the currently authenticated user or page.

Multiple queries can also be composed together to retrieve comments from posts across multiple Facebook entities. For instance:

SELECT * FROM Comments WHERE Target IN (SELECT Id FROM Posts WHERE Target IN (SELECT Id FROM Pages))

If you are looking for comments for all posts, please consider looking at the Posts table or the Wall view. They contain the columns 'CommentsData' and 'CommentsCount'. 'CommentsCount' can be queried to filter and only select posts (targets) on which a comment has been made:

SELECT * FROM Wall WHERE CommentsCount > 0

Insert

The Target is required for Insert operations. Additionally, one of the following must also be specified: Message, AttachmentId, AttachmentShareUrl, AttachmentUrl, Source

Note that a custom OAuth app with the pages_manage_engagement permission is required for this operation.

A sample Insert is provided below:

INSERT INTO Comments (Target, Message) VALUES ('100194609664082_445376221798618', 'hello')

Update

The Target is required for Update operations. Additionally, one of the following must also be specified: Message, AttachmentId, AttachmentShareUrl, AttachmentUrl

Note that a custom OAuth app with the pages_manage_engagement and pages_read_engagement permissions is required for this operation.

A sample Update is provided below:

UPDATE Comments SET Message = 'new message' WHERE Id = '445376221798618_773440321618637'

Delete

Note that a custom OAuth app with the pages_manage_engagement and pages_read_engagement permissions is required for this operation.

A sample Delete is provided below:

DELETE FROM Comments WHERE Id = '445376221798618_773440321618637'

Columns

Name Type ReadOnly Description
ID [KEY] String True

The Id of the comment.

Target String False

The Id of the target you are retrieving comments for. This may be an album, checkin, link, note, photo, post, status update, or video.

FromId String True

Id of the user who made the comment.

FromName String True

Name of the user who made the comment.

FromPicture String True

Picture of the user who made the comment.

Message String False

The text of the comment.

MessageTags String True

Aggregate of tags contained in the message.

Likes Integer True

The number of likes the comment has.

CommentsCount Integer True

The number of comments in reply to this comment.

LikesData String True

Aggregate of likes information on the comment.

UserLikes Boolean True

Boolean indicating if the authenticated user likes the comment.

CanRemove Boolean True

Boolean indicating if the comment can be removed.

Attachments String True

An aggregate for the attachments of the post.

CreatedTime Datetime True

The time the comment was created.

Pseudo-Columns

Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source. For more information, see the WHERE clause section.

Name Type Description
AttachmentId String

An optional ID of a unpublished photo uploaded to Facebook to include as a photo comment.

AttachmentShareUrl String

The URL of a GIF to include as a animated GIF comment.

AttachmentUrl String

The URL of an image to include as a photo comment.

Source String

A photo, encoded as form data, to use as a photo comment.

IsHidden Boolean

Whether this comment is hidden or visible.

offset String

Which result to begin returning results from. Used for manual paging of results.

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 25.0.9539