syncInbox

This method enables whole-inbox monitoring for your account so you can poll the inbox for messages across every conversation. Run it once per account.

Recommended first step for reading messages. syncInbox tracks your entire inbox but only captures messages that arrive after it is enabled. To get a person's earlier history, load it once with syncConversation.

syncInbox only switches monitoring on: it records the setting and returns. The messages themselves are picked up afterwards by a sync that runs periodically, so the first ones appear on the next sync rather than the moment the method resolves.

Note: When that sync finds new messages in a thread – including messages you send yourself – it opens the profile page of the other participant in that thread to resolve their public URL – but only when Linked API does not already know it, so a person is visited once, which is what fills personPublicUrl on the messages pollInbox returns and on webhook events. Those visits are made from your own account, and such a visit is visible to the person whose profile is opened. Until a person's thread produces a message, their personPublicUrl is null.

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

  const { errors } = await linkedapi.syncInbox.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('Inbox 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.