Available on Premium, Business, Enterprise plans.

The Comments endpoints allow your users to post, reply, retrieve, and delete comments on their posts. There are four types of comments IDs: Ayrshare Post ID, Social Post ID, Ayrshare Comment ID, and Social Comment ID. Each of these IDs are used for different purposes.

Comment ID Types

Comments with Ayrshare Post ID

The typical flow is when you publish a post via Ayrshare, you get the Ayrshare Post ID. You can then use this Ayrshare Post ID to manage comments on that post.

Supported platforms: Facebook Pages, Instagram, LinkedIn, Reddit, TikTok, Twitter, and YouTube.

For example:

1

Publish a Post

Use the /post endpoint to publish a post via Ayrshare, which can be sent to multiple social networks in a single call.

In the return is the top level Ayrshare Post ID.

{
    "status": "success",
    "errors": [],
    "postIds": [
    {
        "status": "success",
        "id": "106638148652329_591370753547555",
        "postUrl": "https://www.facebook.com/106638148652329/posts/591370753547555",
        "platform": "facebook"
    }
    ],
    "id": "E4UdUr1yRbvI7qqCSlaq", // Ayrshare Post ID
    "refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc055",
    "post": "What an amazing day",
    "validate": true
}
2

Post a Comment

Use the /comments endpoint to post a comment with the Ayrshare Post ID. The commetn will be sent to all the social networks associated with the post.

POST https://api.ayrshare.com/api/comments/:id
3

Get Comments

Use the /comments endpoint to get the comments for the post with the Ayrshare Post ID. This will return comments for all the social networks associated with the post.

GET https://api.ayrshare.com/api/comments/:id

Comments with Social Post ID

Sometimes you may want to manage comments on a post that were not published via Ayrshare. In this case you can use the Social Post ID, which is the social network assigned post ID.

If the post was published via Ayrshare, use the Ayrshare Post ID.

For example:

1

Get Post History

Start by getting the Instagram posts published outside of Ayrshare with the Get All Post History endpoint.

The endpoint returns a list of posts with the social id of the post.

{
    "status": "success",
    "posts": [
        {
            "mediaUrl": "https://scontent.cdninstagram.com/v/t51.2885-15/7531.jpg",
            "permalink": "https://www.instagram.com/p/B5OBT3ygpfg/",
            "commentsCount": 0,
            "created": "2022-05-20T17:26:03Z",
            "likeCount": 0,
            "mediaProductType": "FEED",
            "mediaType": "IMAGE",
            "username": "thegoodone",
            "id": "17833140557332933", // Instagram Social Post ID
            "thumbnailUrl": "https://scontent-lga3-2.cdninstagram.com/v/t51..jpg",
            "post": "The #Mandalorian is on tonight instead of Friday",
            "postUrl": "https://www.instagram.com/p/B5OBT3ygpfg/"
        },
    ]
}

The social id is also returned in the postIds field for the post endpoint.

2

Get Comments on a Post

Use the returned id to get all the comments for a specific Instagram post using the social id, searchPlatformId set to true, and platform set to instagram.

    GET https://api.ayrshare.com/api/comments/17833140557332933?platform=instagram&searchPlatformId=true
3

Use the Comment ID to Get Comment Details

The returned JSON will from the previous step have a commentId for each comment, which is the social comment ID.

{
    "instagram": [
        {
            "comment": "What an amazing comment",
            "commentId": "17969247335804735", // Social Comment ID
            "created": "2024-11-26T11:49:00Z",
            "from": {
            "id": "103038435208332",
            "username": "john_smith"
            },
            "hidden": false,
            "likeCount": 3,
            "platform": "instagram",
            "postId": "18231730279304333",
            "username": "john_smith"
        }
    ]
}

The commentId can be used to get the comment details for a specific comment. This might be useful if you want to get the comment details for a single comment, such as the replies to the comment.

    GET https://api.ayrshare.com/api/comments/17969247335804735?platform=instagram&searchPlatformId=true&commentId=true

Comments with Ayrshare Comment ID

Manage comments on a post that were published via Ayrshare by using the Ayrshare Comment ID. The Ayrshare comment ID is the comment ID assigned from Ayrshare and can be found in the commentId field in the response when posting a comment.

This is often used if you want to get details on a particular comment published via Ayrshare.

Comments with Social Comment ID

Manage comments on a post that were not published via Ayrshare by using the Social Comment ID. The social comment ID is the comment ID from the social network, not the Ayrshare ID, and can be found in the commentId field in the response when getting comments.

This is often used if you want to get details on a particular comment published outside of Ayrshare.

Disable Comments

You can disable comments when publishing a post using the disableComments field in the /post endpoint. Comments will only be disabled for Instagram, LinkedIn, and TikTok.

You may also enable or disable comments on an already published post.