Reacting and commenting
This page describes how to create workflows for reacting and commenting on LinkedIn posts.
Reacting to post
To react to a post, you need to include st.reactToPost action in your workflow. Here's an example:
Workflow:
{
"actionType": "st.reactToPost",
"postUrl": "https://www.linkedin.com/posts/post1",
"type": "like"
}Completion:
{
"actionType": "st.reactToPost",
"success": true
}Commenting on post
To comment on a post, you need to include st.commentOnPost action in your workflow. Here's an example:
Workflow:
{
"actionType": "st.commentOnPost",
"postUrl": "https://www.linkedin.com/posts/post1",
"text": "I completely agree with your point."
}Completion:
{
"actionType": "st.commentOnPost",
"success": true
}Reacting + commenting
To react and comment on the same post, you need to include st.reactToPost and st.commentOnPost as child actions of st.openPost action. Here's an example:
Workflow:
{
"actionType": "st.openPost",
"postUrl": "https://www.linkedin.com/posts/post1",
"basicInfo": false,
"then": [
{
"actionType": "st.reactToPost",
"type": "like"
},
{
"actionType": "st.commentOnPost",
"text": "I completely agree with your point."
}
]
}Completion:
{
"actionType": "st.openPost",
"success": true,
"data": {
"then": [
{
"actionType": "st.reactToPost",
"success": true
},
{
"actionType": "st.commentOnPost",
"success": true
}
]
}
}Reacting to a comment
To react to a comment, you need to include st.reactToComment action in your workflow. It accepts a commentUrl, which you can obtain from the commentUrl field returned by st.commentOnPost, st.replyToComment, or st.retrievePostComments. Here's an example:
Workflow:
{
"actionType": "st.reactToComment",
"commentUrl": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890123456789/?dashCommentUrn=urn%3Ali%3Afsd_comment%3A(9876543210%2Curn%3Ali%3Aactivity%3A1234567890123456789)",
"type": "like"
}Completion:
{
"actionType": "st.reactToComment",
"success": true
}Replying to a comment
To reply to a comment, you need to include st.replyToComment action in your workflow. It returns the commentUrn and commentUrl of the created reply. Here's an example:
Workflow:
{
"actionType": "st.replyToComment",
"commentUrl": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890123456789/?dashCommentUrn=urn%3Ali%3Afsd_comment%3A(9876543210%2Curn%3Ali%3Aactivity%3A1234567890123456789)",
"text": "Thanks for sharing your thoughts!"
}Completion:
{
"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)"
}
}Engaging with all comments on a post
To react to or reply to every comment on a post without knowing their URLs upfront, retrieve the comments with st.retrievePostComments and iterate over them with st.doForComments. Each iterated comment can either react/reply directly, or open first with st.openComment to run several comment-scoped actions. Here's an example that likes and replies to each of the 3 most relevant comments:
Workflow:
{
"actionType": "st.retrievePostComments",
"postUrl": "https://www.linkedin.com/posts/post1",
"limit": 3,
"sort": "mostRelevant",
"then": {
"actionType": "st.doForComments",
"then": {
"actionType": "st.openComment",
"then": [
{
"actionType": "st.reactToComment",
"type": "celebrate"
},
{
"actionType": "st.replyToComment",
"text": "Great point, thanks for sharing!"
}
]
}
}
}Completion:
{
"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)"
}
}
]
}
}
}
]
}This page provides examples of workflows and their completions. For detailed documentation on constraints, parameters, and possible results of specific actions, always refer to the corresponding action documentation pages.