Get conversations

Tags: #linkedin #messaging #conversations #sales #naas_drivers #content #snippet #dataframe
Author: Florent Ravenel
Last update: 2023-08-22 (Created: 2021-06-18)
Description: This notebook get all your conversations from LinkedIn with the last message sent.
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.


Import libraries

from naas_drivers import linkedin
import naas

Setup variables

  • li_at: Cookie used to authenticate Members and API clients.
  • JSESSIONID: Cookie used for Cross Site Request Forgery (CSRF) protection and URL signature validation.
  • limit: Number of conversations to be retrieved. Max limit is 600.
  • file_path: CSV file path to be saved
# Mandatory
li_at = naas.secret.get("LINKEDIN_LI_AT") or "YOUR_LINKEDIN_LI_AT" #example: AQFAzQN_PLPR4wAAAXc-FCKmgiMit5FLdY1af3-2
JSESSIONID = naas.secret.get("LINKEDIN_JSESSIONID") or "YOUR_LINKEDIN_JSESSIONID" #example: ajax:8379907400220387585
# Optional
limit = 100
file_path = "linkedin_conversations.csv"


Get LinkedIn conversations

df = linkedin.connect(li_at, JSESSIONID).message.get_conversations(limit=limit)
print("Row fetched:", len(df))


Save DataFrame to csv

df.to_csv(file_path, index=False)