Skip to content

IG Comment

Justin Stolpe edited this page May 21, 2022 · 4 revisions

Represents and IG comment on a media post.

Getting a Comment

Get data for the specified comment.

use Instagram\Comment\Comment;

$config = array( // instantiation config params
    'user_id' => '<IG_USER_ID>',
    'comment_id' => '<COMMENT_ID>', // id of comment to get data on
    'access_token' => '<ACCESS_TOKEN>',
);

// instantiate comment for use
$comment = new Comment( $config );

// get comment data
$commentInfo = $comment->getSelf();

Show/Hide a Comment

Show or hide the specified comment.

use Instagram\Comment\Comment;

$config = array( // instantiation config params
    'user_id' => '<IG_USER_ID>',
    'comment_id' => '<COMMENT_ID>', // id of comment to show or hide
    'access_token' => '<ACCESS_TOKEN>',
);

// instantiate comment for use
$comment = new Comment( $config );

// set the hide to either true or false
$commentShowHide = $comment->setHide( '<BOOLEAN>' );

Delete a Comment

Delete the specified comment.

use Instagram\Comment\Comment;

$config = array( // instantiation config params
    'user_id' => '<IG_USER_ID>',
    'comment_id' => '<COMMENT_ID>', // id of comment to delete
    'access_token' => '<ACCESS_TOKEN>',
);

// instantiate comment for use
$comment = new Comment( $config );

// delete the comment from IG
$commentDeleted = $comment->remove();
Clone this wiki locally