Skip to content

5. Connection requests

Emir OĞUZ edited this page Jul 12, 2024 · 2 revisions

Send connection request to searched people

After a successful search we will have some of linkedin profiles in an array. We can send connection requests.

const client = new LinkedIn()
await client.login('[email protected]', 'your password')

let people = await client.searchPeople({
  keywords: 'Javscript Developer',
  network: ['S']
}, 250)

for (let person of people) {
  try {
    await person.connectionRequest(client, 'Hi ' + person.details.name + '! Please accept me invitation.')
  }
  catch (e) { console.log(e.message); }
}

let browser = await client.getBrowser()
browser.close()

connectionRequest method

In this method we have 3 parameters.

/** Send connection request to user
* @param {LinkedIn} linkedinClient - Client that will used in request
* @param {string} connectionMessage - Message that will send with connection request
* @param {number} waitMs - Wait milliseconds (default is coming from linkedin client)
*/
async connectionRequest(linkedinClient, connectionMessage, waitMs)
  1. linkedinClient: the client that we created first.
  2. connectionMessage: the message to send in request. (not required)
  3. waitMs: wait milliseconds after request. (not required)

It will throw error if already connected of cannot be connectable.