# st.commentOnPost

This action allows you to leave a comment on a post.

## Constraints

> ⏺️ **Root Start:** allowed, when `postUrl` parameter is provided.

> ⬆️ **Parent Actions:** [st.openPost](/docs/action-st-open-post), [st.doForPosts](/docs/action-st-do-for-posts).

> ⬇️ **Child Actions:** N/A.

## Parameters

```json
{
  "actionType": "st.commentOnPost",
  "label": "post1",
  "postUrl": "https://www.linkedin.com/posts/post1",
  "companyUrl": "https://www.linkedin.com/company/company1",
  "text": "I completely agree with your point."
}
```

- `label` (optional) – custom label for tracking this action in workflow completion.
- `postUrl` (required for root start, forbidden for parent start) – LinkedIn URL of the post.
- `text` – comment text, must be up to **1000** characters.
- `companyUrl` (optional) – LinkedIn company page URL. When provided, the comment will be posted on behalf of the company. Requires content admin access to the company page.

## Result options

1. **Successful post commenting:**

```json
{
  "actionType": "st.commentOnPost",
  "label": "post1",
  "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)"
  }
}
```

- `label` – included only if specified in the action parameters.
- `data` – information about the created comment.
  - `commentUrn` – LinkedIn URN of the created comment, if available.
  - `commentUrl` – canonical deep-link URL of the created comment, if available. It can be used as the `commentUrl` input for [st.openComment](/docs/action-st-open-comment), [st.reactToComment](/docs/action-st-react-to-comment), or [st.replyToComment](/docs/action-st-reply-to-comment).

2. **Failed post commenting:**

```json
{
  "actionType": "st.commentOnPost",
  "label": "post1",
  "success": false,
  "error": {
    "type": "commentingNotAllowed",
    "message": "Commenting is not allowed on this 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.
  - `commentingNotAllowed` – commenting is not allowed on this post. This could be due to the post author's privacy settings, LinkedIn restrictions on commenting, or because the post type does not support comments.
  - `noPostingPermission` – no permission to comment on behalf of this company.
