Comment on page
Get messages from conversation
Tags: #linkedin #message #naas_drivers #content #snippet #dataframe
Last update: 2023-08-31 (Created: 2023-08-31)
Description: This notebook allows you to access all messages from a LinkedIn conversation using the conversation URL.
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.
from naas_drivers import linkedin
import naas
Mandatory
li_at
: Cookie used to authenticate Members and API clients.JSESSIONID
: Cookie used for Cross Site Request Forgery (CSRF) protection and URL signature validation.conversation_url
: LinkedIn conversation URL
Optional
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
conversation_url = "https://www.linkedin.com/messaging/thread/2-YzRhNGMxMjAtNGFiMy01ZmFiLWI3YTYtMWNkNmQ0YzJhMGU3XzAwMA==/"
# Optional
limit = 40
file_path = "linkedin_messages.csv"
df = linkedin.connect(li_at, JSESSIONID).message.get_messages(conversation_url=conversation_url, limit=limit)
print("Row fetched:", len(df))
df.head(1)
df
Last modified 3mo ago