Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple example of using the LinkedIn JavaScript SDK to send an invite
<!DOCTYPE html>
<html>
<head>
<script>
function invite() {
var url = '/people/~/mailbox',
body = {
recipients: {
values: [{
person: {
_path: '/people/email=a_user@domain.com',
'first-name':'Andrew',
'last-name':'User'
}
}]
},
subject: 'Invitation to connect.',
body: 'Say yes!',
'item-content':{
'invitation-request':{
'connect-type':'friend'
}
}
};
IN.API.Raw()
.url(url)
.method("POST")
.body(JSON.stringify(body))
.result(function (result) {
console.log(result);
})
.error(function (error) {
console.log(error);
});
}
</script>
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: secret
onLoad: invite
authorize: true
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment