Links
Comment on page

Send invitation to profile

Tags: #linkedin #invitation #naas_drivers #content #snippet #text
Author: Florent Ravenel​
Last update: 2023-05-29 (Created: 2021-06-18)
Description: This notebook allows users to send invitations to connect on LinkedIn to other profiles.
Disclaimer: This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by Linkedin or any of its affiliates or subsidiaries. It uses an independent and unofficial API. Use at your own risk.
This project violates Linkedin's User Agreement Section 8.2, and because of this, Linkedin may (and will) temporarily or permanently ban your account. We are not responsible for your account being banned.

Input

Import libraries

from naas_drivers import linkedin
import naas

Setup LinkedIn

If you are using the Chrome Extension:
  • ​Create a new token​
  • Copy/Paste your token in your extension
  • Login/Logout your LinkedIn account
  • Your secrets "LINKEDIN_LI_AT" and "LINKEDIN_JSESSIONID" will be added directly on your naas everytime you login and logout.
or
If you are not using the Google Chrome Extension, learn how to get your cookies on LinkedIn and set up the values below:
  • 🍪 li_at
  • 🍪 JSESSIONID
# Cookies
LI_AT = naas.secret.get("LINKEDIN_LI_AT") or "li_at"
JSESSIONID = naas.secret.get("LINKEDIN_JSESSIONID") or "JSESSIONID"
​
# Profile URL you want to send the invitation to
recipient_url = "https://www.linkedin.com/in/****/"
​
# Message to add with your invitation
message = "Hello, \nI will be happy to connect!"

Model

Send invitation

result = linkedin.invitation.send(recipient_url=RECIPIENT_URL, message=message)

Output

Display result

result