Skip to content

IG User Mentions

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

Allows you to comment on posts and comments the user is tagged in.

Replying to a Post

Code

use Instagram\User\Mentions;

$config = array( // instantiation config params
    'user_id' => '<IG_USER_ID>',
    'access_token' => '<ACCESS_TOKEN>',
);

// instantiate mentions for use
$mentions = new Mentions( $config );

$mentionsParams = array( // reply to a post the user was mentioned in
    'media_id' => '<MEDIA_ID>', // media id the user was mentioned in
    'message' => '<COMMENT>', // comment text
);

// post the comment
$mentions->replyToMedia( $mentionsParams );

Replying to a Comment

Code

use Instagram\User\Mentions;

$config = array( // instantiation config params
    'user_id' => '<IG_USER_ID>',
    'access_token' => '<ACCESS_TOKEN>',
);

// instantiate mentions for use
$mentions = new Mentions( $config );

$mentionsParams = array( // reply to a comment the user was mentioned in
    'comment_id' => '<COMMENT_ID>', // comment id the user was mentioned in
    'message' => '<COMMENT>', // comment text
);

// post the comment
$mentions->replyToComment( $mentionsParams );
Clone this wiki locally