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);
}
}Params
commentUrl– deep-link URL of the comment to reply to. You can obtain it from thecommentUrlfield returned bycommentOnPost,replyToComment, or a comment retrieved viafetchPost.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 thecommentUrlinput forreactToCommentorreplyToComment.
Errors
commentNotFound– the comment could not be opened or no longer exists.replyingNotAllowed– replying is not allowed on this comment.