st.doForComments

This action allows you to apply the actions specified in its then parameter to each comment provided by the parent action.

The comments this action iterates over are the ones returned by the parent st.retrievePostComments action, so their number is controlled by its limit parameter.

Constraints

⏺️ Root Start: not allowed.

⬆️ Parent Actions: st.retrievePostComments.

⬇️ Child Actions: st.openComment, st.reactToComment, st.replyToComment.

Parameters

json
{
  "actionType": "st.doForComments",
  "then": { ... }
}
  • then – object or array of child actions to apply to each comment from the parent action.

Result options

This action doesn't produce its own distinct result. The effects are visible in the comments that were involved, as they will contain a then field with the results of the applied actions. See usage examples for more details.

Usage examples

  1. Liking the 5 most relevant comments on a post:

Workflow:

json
{
  "actionType": "st.retrievePostComments",
  "postUrl": "https://www.linkedin.com/posts/post1",
  "limit": 5,
  "sort": "mostRelevant",
  "then": {
    "actionType": "st.doForComments",
    "then": {
      "actionType": "st.reactToComment",
      "type": "like"
    }
  }
}

Completion:

json
{
  "actionType": "st.retrievePostComments",
  "success": true,
  "data": [
    {
      ...
      "then": {
        "actionType": "st.reactToComment",
        "success": true
      }
    },
    {
      ...
      "then": {
        "actionType": "st.reactToComment",
        "success": true
      }
    }
  ]
}
  1. Reacting to and replying to each comment through the st.openComment wrapper:

Workflow:

json
{
  "actionType": "st.retrievePostComments",
  "postUrl": "https://www.linkedin.com/posts/post1",
  "limit": 3,
  "then": {
    "actionType": "st.doForComments",
    "then": {
      "actionType": "st.openComment",
      "then": [
        {
          "actionType": "st.reactToComment",
          "type": "celebrate"
        },
        {
          "actionType": "st.replyToComment",
          "text": "Well said, thanks for sharing!"
        }
      ]
    }
  }
}

Completion:

json
{
  "actionType": "st.retrievePostComments",
  "success": true,
  "data": [
    {
      ...
      "then": {
        "actionType": "st.openComment",
        "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)",
          "then": [
            {
              "actionType": "st.reactToComment",
              "success": true
            },
            {
              "actionType": "st.replyToComment",
              "success": true,
              "data": {
                "commentUrn": "urn:li:comment:(urn:li:activity:1234567890123456789,1122334455)",
                "commentUrl": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890123456789/?dashCommentUrn=urn%3Ali%3Afsd_comment%3A(1122334455%2Curn%3Ali%3Aactivity%3A1234567890123456789)"
              }
            }
          ]
        }
      }
    }
  ]
}