syncNetwork

This method enables network monitoring for your account so you can poll the network for connection events as they happen. Run it once per account.

Instead of repeatedly retrieving connections and pending requests and comparing the results, syncNetwork watches the account's network in the background and captures every change. Only changes that happen after it is enabled are captured — existing connections and pending invitations are used as a silent baseline and never emitted.

typescript
try {
  const workflow = await linkedapi.syncNetwork.execute();

  const { errors } = await linkedapi.syncNetwork.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('Network monitoring enabled.');
  }
} 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

This method takes no parameters.

Data

The method doesn't return any data.