Manage post comments
Learn how to list, add, and delete Instagram post comments with Unipile API.
For endpoints requiring a post ID or comment ID, use identifiers returned by Unipile. Native Instagram app identifiers are not guaranteed to work.
List comments
To retrieve the comments of a post, use List all Post's Comments.
const { data } = await postsApi.getPostCommentsList({
path: {
account_id: "acc_123456789",
post_id: "post_id",
},
});comments = posts_api.get_post_comments_list("post_id", "acc_123456789")curl --request GET \
--url https://api.unipile.com/v2/account_id/posts/post_id/comments \
--header 'accept: application/json'Add a comment
To comment on a post, use Add Comment to a Post and provide the comment text.
const { data } = await postsApi.addPostComment({
path: {
account_id: "acc_123456789",
post_id: "post_id",
},
body: {
text: "Nice post!",
},
});comment = posts_api.add_post_comment(
"post_id",
"acc_123456789",
{"text": "Nice post!"},
)curl --request POST \
--url https://api.unipile.com/v2/account_id/posts/post_id/comments \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"text": "Nice post!"
}
'Delete a comment
To delete one of your comments, use Delete Comment from a Post.
await postsApi.deletePostComment({
path: {
account_id: "acc_123456789",
post_id: "post_id",
comment_id: "comment_id",
},
});posts_api.delete_post_comment(
"post_id",
"comment_id",
"acc_123456789",
)curl --request DELETE \
--url https://api.unipile.com/v2/account_id/posts/post_id/comments/comment_id \
--header 'accept: application/json'Updated about 1 month ago