pollNetwork
This method polls your monitored network to retrieve captured connection events and receive new ones across the account's connection graph.
Before polling, enable network monitoring once with
syncNetwork.
typescript
try {
const { data, errors } = await linkedapi.pollNetwork({
since: "2024-01-01T00:00:00Z", // Optional: only events after this timestamp
type: "connectionAccepted" // Optional: filter by a single event type
});
// 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}`);
});
}
if (data) {
console.log(`Retrieved ${data.events.length} events`);
data.events.forEach(event => {
console.log(`[${event.type}] ${event.personUrl} (${event.detectedAt})`);
});
}
} 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
All fields are optional:
since– timestamp indicating the starting point for retrieving events. If not provided, all captured events are returned.type– filter by a single event type; omit for all:connectionRequestReceived– someone sent you a connection request.connectionAccepted– a new connection that matches a request you sent.connectionAdded– a new connection not attributable to a request you sent.
Data
events– array of connection events, ordered newest first.id– unique identifier for the event.type– one ofconnectionRequestReceived,connectionAccepted, orconnectionAdded.personUrl– LinkedIn URL of the other person.detectedAt– timestamp when Linked API observed the event.
Recommended flow for integrations:
- Leave
sinceempty on the first request to retrieve everything captured so far. - For subsequent requests, pass the timestamp of the most recent event you received as
sinceto fetch only newer events. - Continue polling with an advancing
since. Whenever new events arrive, updatesinceto the latestdetectedAt.
Events are retained for 90 days — poll (or receive webhooks) often enough to consume them within that window, as older events are pruned and will no longer be returned.
For push-based delivery instead of polling, subscribe to the network webhook events.