st.doForPosts

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

There is a limit of 20 posts that this action can be applied to. If the parent action provides more than 20 posts, only the first 20 will be processed.

Post-scoped actions can be nested directly under st.doForPosts, or wrapped in st.openPost first when you also need the post's data or want to run several post-scoped actions together for each post.

Constraints

⏺️ Root Start: not allowed.

⬆️ Parent Actions: st.retrieveCompanyPosts, st.retrievePersonPosts.

⬇️ Child Actions: st.openPost, st.reactToPost, st.commentOnPost, st.retrievePostComments, st.retrievePostReactions.

Parameters

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

Result options

This action doesn't produce its own distinct result. The effects are visible in the posts 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 latest 3 posts from the company:

Workflow:

json
{
  "actionType": "st.openCompanyPage",
  "companyUrl": "https://www.linkedin.com/company/company1",
  "then": {
    "actionType": "st.retrieveCompanyPosts",
    "limit": 3,
    "then": {
      "actionType": "st.doForPosts",
      "then": {
        "actionType": "st.openPost",
        "basicInfo": false,
        "then": {
          "actionType": "st.reactToPost",
          "type": "like"
        }
      }
    }
  }
}

Completion:

json
{
  "actionType": "st.openCompanyPage",
  "success": true,
  "data": {
    ...
    "then": {
      "actionType": "st.retrieveCompanyPosts",
      "success": true,
      "data": [
        {
          ...
          "then": {
            "actionType": "st.openPost",
            "success": true,
            "data": {
              "then": {
                "actionType": "st.reactToPost",
                "success": true
              }
            }
          }
        },
        {
          ...
          "then": {
            "actionType": "st.openPost",
            "success": true,
            "data": {
              "then": {
                "actionType": "st.reactToPost",
                "success": true
              }
            }
          }
        },
        {
          ...
          "then": {
            "actionType": "st.openPost",
            "success": true,
            "data": {
              "then": {
                "actionType": "st.reactToPost",
                "success": true
              }
            }
          }
        }
      ]
    }
  }
}
  1. Commenting on the person's latest post:

Workflow:

json
{
  "actionType": "st.openPersonPage",
  "personUrl": "https://www.linkedin.com/in/person1",
  "then": {
    "actionType": "st.retrievePersonPosts",
    "limit": 1,
    "then": {
      "actionType": "st.doForPosts",
      "then": {
        "actionType": "st.openPost",
        "basicInfo": false,
        "then": {
          "actionType": "st.commentOnPost",
          "text": "Great post! Thanks for sharing."
        }
      }
    }
  }
}

Completion:

json
{
  "actionType": "st.openPersonPage",
  "success": true,
  "data": {
    ...
    "then": {
      "actionType": "st.retrievePersonPosts",
      "success": true,
      "data": [
        {
          ...
          "then": {
            "actionType": "st.openPost",
            "success": true,
            "data": {
              "then": {
                "actionType": "st.commentOnPost",
                "success": true
              }
            }
          }
        }
      ]
    }
  }
}
  1. Liking the latest 3 posts from a person directly, without opening them:

Workflow:

json
{
  "actionType": "st.openPersonPage",
  "personUrl": "https://www.linkedin.com/in/person1",
  "then": {
    "actionType": "st.retrievePersonPosts",
    "limit": 3,
    "then": {
      "actionType": "st.doForPosts",
      "then": {
        "actionType": "st.reactToPost",
        "type": "like"
      }
    }
  }
}

Completion:

json
{
  "actionType": "st.openPersonPage",
  "success": true,
  "data": {
    ...
    "then": {
      "actionType": "st.retrievePersonPosts",
      "success": true,
      "data": [
        {
          ...
          "then": {
            "actionType": "st.reactToPost",
            "success": true
          }
        }
      ]
    }
  }
}