Job description
Function in JavaScript, will be used for the Chrome extension, which will take the following parameters:
LinkedIn URL (string)
cookies (object taken from the user's session)
addInviteNote (boolean)
inviteNote (string)
The function should work the same way invitations work in the Chrome extension https://octopuscrm.io/
Requests are to be sent to the LinkedIn voyager API (https://www.linkedin.com/voyager/api/) with a request that will result in an invitation to network a person with the specified LinkedIn URL. If addInviteNote === true, it should send an invitation with the specified note. The function should then return true if the invitation was successful, or return Error with an appropriate reason, (no invitations to use, error in url, etc.). To be executed without using external libraries.