acceptConnectionRequest
This method allows you to accept an incoming connection request from a person.
typescript
try {
const workflow = await linkedapi.acceptConnectionRequest.execute({
personUrl: "https://www.linkedin.com/in/john-doe",
});
const { errors } = await linkedapi.acceptConnectionRequest.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("Connection request accepted 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
personUrl– public or hashed LinkedIn URL of the person whose connection request you want to accept.
Data
The method doesn't return any data.
Errors
personNotFound– provided URL is not an existing LinkedIn person.selfProfileNotAllowed– action cannot be performed on your own profile.alreadyConnected– your LinkedIn account is already connected with this person.noPendingRequest– there is no incoming connection request from this person.