st.retrievePostComments

This action allows you to retrieve comments for a certain post.

Constraints

⏺️ Root Start: allowed, when postUrl or postUrn parameter is provided.

⬆️ Parent Actions: st.openPost, st.doForPosts.

⬇️ Child Actions: st.doForComments.

Parameters

json
{
  "actionType": "st.retrievePostComments",
  "postUrl": "https://www.linkedin.com/posts/post1",
  "replies": true,
  "limit": 10,
  "sort": "mostRelevant",
  "label": "post1Comments",
  "then": { ... }
}
  • postUrl (required for root start unless postUrn is provided, forbidden for parent start) – LinkedIn URL of the post.
  • postUrn (optional) – URN of the post, accepted instead of postUrl. When both are provided, the URL must contain that same URN.
  • replies (optional, default: true) – when set to true, the action includes replies to the comments in the results.
  • limit (optional) – number of comments to retrieve. Also applies to the replies if replies set to true. Defaults to 10, with a maximum value of 500.
  • sort (optional, default: mostRelevant) – enum representing comments sorting. Options:
    • mostRelevant – show most relevant comments first.
    • mostRecent – show most recent comments first.
  • label (optional) – custom label for tracking this action in workflow completion.
  • then (optional) – object or array of child actions to be executed for each retrieved comment (see st.doForComments).

Result options

  1. Successful comments retrieval:
json
{
  "actionType": "st.retrievePostComments",
  "label": "post1Comments",
  "success": true,
  "data": [
    {
      "commentUrn": "urn:li:comment:(urn:li:activity:1234567890123456789,9876543210)",
      "commentUrl": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890123456789/?dashCommentUrn=urn%3Ali%3Afsd_comment%3A(9876543210%2Curn%3Ali%3Aactivity%3A1234567890123456789)",
      "author": {
        "type": "person",
        "name": "John Doe",
        "profileUrl": "https://www.linkedin.com/in/john-doe",
        "headline": "Product Manager",
        "viewerState": { "connectionDegree": "2nd" }
      },
      "commenterUrl": "https://www.linkedin.com/in/john-doe",
      "commenterName": "John Doe",
      "commenterHeadline": "Product Manager",
      "commenterType": "person",
      "time": "3d",
      "text": "Great work!",
      "image": null,
      "isReply": false,
      "reactionsCount": 3,
      "repliesCount": 2,
      "viewerState": { "reaction": "like", "isOwn": false }
    },
    {
      "commentUrn": "urn:li:comment:(urn:li:activity:1234567890123456789,9876543211)",
      "commentUrl": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890123456789/?dashCommentUrn=urn%3Ali%3Afsd_comment%3A(9876543211%2Curn%3Ali%3Aactivity%3A1234567890123456789)",
      "author": {
        "type": "person",
        "name": "Jane Doe",
        "profileUrl": "https://www.linkedin.com/in/person1",
        "headline": "Helping companies to use AI",
        "viewerState": { "connectionDegree": "3rd+" }
      },
      "commenterUrl": "https://www.linkedin.com/in/person1",
      "commenterName": "Jane Doe",
      "commenterHeadline": "Helping companies to use AI",
      "commenterType": "person",
      "time": "3d",
      "text": "Agree with you!",
      "image": null,
      "isReply": true,
      "reactionsCount": 0,
      "repliesCount": 0,
      "viewerState": { "reaction": null, "isOwn": false }
    },
    {
      "commentUrn": "urn:li:comment:(urn:li:activity:1234567890123456789,9876543212)",
      "commentUrl": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890123456789/?dashCommentUrn=urn%3Ali%3Afsd_comment%3A(9876543212%2Curn%3Ali%3Aactivity%3A1234567890123456789)",
      "author": {
        "type": "company",
        "name": "CloseAI",
        "companyUrl": "https://www.linkedin.com/company/company1"
      },
      "commenterUrl": "https://www.linkedin.com/company/company1",
      "commenterName": "CloseAI",
      "commenterHeadline": "2548 followers",
      "commenterType": "company",
      "time": "1w",
      "text": null,
      "image": "https://static.linkedin.com/image1.jpg",
      "isReply": false,
      "reactionsCount": 8,
      "repliesCount": 4,
      "viewerState": { "reaction": null, "isOwn": false }
    }
  ]
}
  • label – included only if specified in the action parameters.
  • data – array of comments.
    • commentUrn – LinkedIn URN of the comment, if available. It can be used to build a commentUrl for comment-scoped actions.
    • commentUrl – canonical deep-link URL of the comment, if available. It can be used as the commentUrl input for st.openComment, st.reactToComment, or st.replyToComment.
    • author – person or company who wrote the comment.
      • For person authors: type, name, profileUrl, headline, viewerState with connectionDegree – 1st, 2nd, 3rd+, or null if LinkedIn does not show it, which is always the case for comments read in the feed or from LinkedIn's classic post layout (see viewer state).
      • For company authors: type, name, companyUrl.
    • commenterUrl – deprecated, use author instead. Public URL of the person or company.
    • commenterName – deprecated, use author.name. Full name of the person or company.
    • commenterHeadline – deprecated, use author.headline. Headline of the person or company.
    • commenterType – deprecated, use author.type. Commenter type. Enum with the following values:
      • person – commenter is a person.
      • company – commenter is a company.
    • time – relative time when the comment was posted, as shown by LinkedIn (e.g. 3d, 1w).
    • text – text of the comment, if available.
    • image – URL of an image attached to the comment, if available.
    • isReply – boolean indicating whether the comment is a reply to another comment.
    • reactionsCount – number of reactions on the comment.
    • repliesCount – number of replies to the comment.
    • viewerState – what your account has done with the comment, see viewer state.
      • reaction – your reaction to the comment (like, celebrate, support, love, insightful, funny), or null if you have not reacted or the page does not show it. Comments read in the feed or from LinkedIn's classic post layout always report null.
      • isOwn – true if your account wrote the comment, false if someone else did, or null if this cannot be told.
    • then – results of child actions execution, present only when child actions are applied via st.doForComments.
  1. Failed comments retrieval:
json
{
  "actionType": "st.retrievePostComments",
  "success": false,
  "label": "post1",
  "error": {
    "type": "postNotFound",
    "message": "The provided URL is not an existing LinkedIn post."
  }
}
  • label – included only if specified in the action parameters.
  • error.type – enum with the following possible values:
    • postNotFound – provided URL is not an existing LinkedIn post.