reactToComment

This method allows you to react to a comment using any available reaction type.

typescript
try {
  const workflow = await linkedapi.reactToComment.execute({
    commentUrl: "https://www.linkedin.com/feed/update/urn:li:activity:123/?dashCommentUrn=urn:li:fsd_comment:(456,urn:li:activity:123)",
    type: "like"
  });

  const { errors } = await linkedapi.reactToComment.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}`);
    });
  } else {
    console.log('Workflow completed successfully.');
  }
} 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);
  }
}

Params

  • commentUrl – deep-link URL of the comment to react to. You can obtain it from the commentUrl field returned by commentOnPost, replyToComment, or a comment retrieved via fetchPost.
  • type (optional, default: like) – enum describing the reaction type.
    • like – standard "like".
    • celebrate – to celebrate an achievement.
    • support – to show support.
    • love – to express love or admiration.
    • insightful – to appreciate insightful content.
    • funny – to react to something humorous.

Data

The method doesn't return any data.

Errors

  • commentNotFound – the comment could not be opened or no longer exists.