# replyToComment

This method allows you to reply to a comment.

```typescript
try {
  const workflow = await linkedapi.replyToComment.execute({
    commentUrl: "https://www.linkedin.com/feed/update/urn:li:activity:123/?dashCommentUrn=urn:li:fsd_comment:(456,urn:li:activity:123)",
    text: "Totally agree — thanks for adding this!"
  });

  const { data, errors } = await linkedapi.replyToComment.result(workflow.workflowId);

  // The list of possible execution errors is below
  if (errors && errors.length > 0) {
    console.warn('Workflow completed with execution errors:');
    errors.forEach(error => {
      console.warn(` - Type: ${error.type}, Message: ${error.message}`);
    });
  }

  // The structure of the 'data' object is below
  if (data) {
    console.log('Workflow completed successfully. Data:', data);
  }
} catch (e) {
  // A list of all critical errors can be found here:
  // https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
  if (e instanceof LinkedApiError) {
    console.error(`Critical Error - Type: ${e.type}, Message: ${e.message}`);
  } else {
    console.error('An unexpected, non-API error occurred:', e);
  }
}
```

```python
from linkedapi import ReplyToCommentParams, LinkedApiError

try:
    workflow = linkedapi.reply_to_comment.execute(
        ReplyToCommentParams(
            comment_url="https://www.linkedin.com/feed/update/urn:li:activity:123/?dashCommentUrn=urn:li:fsd_comment:(456,urn:li:activity:123)",
            text="Totally agree — thanks for adding this!",
        )
    )

    result = linkedapi.reply_to_comment.result(workflow.workflow_id)
    data = result.data
    errors = result.errors

    # The list of possible execution errors is below
    if errors:
        print("Workflow completed with execution errors:")
        for error in errors:
            print(f" - Type: {error.type}, Message: {error.message}")

    # The structure of the 'data' object is below
    if data:
        print("Workflow completed successfully. Data:", data)
except LinkedApiError as e:
    # A list of all critical errors can be found here:
    # https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
    print(f"Critical Error - Type: {e.type}, Message: {e.message}")
except Exception as error:
    print("An unexpected, non-API error occurred:", error)
```

## Params

- `commentUrl` – deep-link URL of the comment to reply to. You can obtain it from the `commentUrl` field returned by `commentOnPost`, `replyToComment`, or a comment retrieved via `fetchPost`.
- `text` – reply text.

## Data

- `commentUrn` – LinkedIn URN of the created reply, if available.
- `commentUrl` – canonical deep-link URL of the created reply, if available. It can be used as the `commentUrl` input for `reactToComment` or `replyToComment`.

## Errors

- `commentNotFound` – the comment could not be opened or no longer exists.
- `replyingNotAllowed` – replying is not allowed on this comment.
