Get DM for Linkedin avatar
Get DM for Linkedin
Under maintenance

Pricing

Pay per event

Go to Apify Store
Get DM for Linkedin

Get DM for Linkedin

Under maintenance

Export LinkedIn DMs and conversation history to JSON. Uses internal API interception for fast, accurate extraction without HTML rendering. Captures participants, timestamps, and text. Perfect for CRM sync and backups.

Pricing

Pay per event

Rating

0.0

(0)

Developer

Addeus

Addeus

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

1

Monthly active users

2 days ago

Last modified

Share

LinkedIn Get Direct Messages Actor

Apify actor that retrieves all direct messages from your LinkedIn messaging inbox with comprehensive conversation details, participant information, and message metadata.

Features

  • Retrieves all conversations from LinkedIn messaging inbox
  • Extracts detailed information for each conversation:
    • Thread URL
    • Participant LinkedIn profile URL
    • Last message content
    • Sender information (firstname, lastname, occupation, company)
    • Message direction (from me or from contact)
    • Read/unread status
    • Message timestamp
  • Uses LinkedIn session cookies for authentication
  • Follows the same authentication pattern as other Apify LinkedIn actors
  • Multi-selector strategy for robust element detection
  • Automatic scrolling to load all conversations

Input

The actor requires the following input parameters:

Required

  • liAtCookie (string, required): Your LinkedIn li_at cookie value for authentication
    • Example: "AQEDATEtZ..."
    • How to get it: Open LinkedIn in your browser, open Developer Tools (F12), go to Application/Storage → Cookies → https://www.linkedin.com, and copy the value of the li_at cookie

Optional

  • jsessionid (string, optional): Your LinkedIn JSESSIONID cookie value for additional authentication

    • Example: "ajax:1234567890123456789"
    • Found in the same location as li_at cookie
  • userAgent (string, optional): Custom user agent string

    • Default: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
    • Use a recent Chrome/Edge user agent for best results

Input Example

{
"liAtCookie": "AQEDATEtZ...",
"jsessionid": "ajax:1234567890123456789",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
}

Output

The actor outputs a single dataset item containing:

  • success (boolean): Whether the operation was successful
  • message (string): Status message
  • conversationCount (number): Total number of conversations retrieved
  • conversations (array): Array of conversation objects
  • timestamp (string): ISO timestamp of when the data was retrieved

Conversation Object Structure

Each conversation in the conversations array contains:

  • threadUrl (string): Direct URL to the conversation thread
  • linkedInUrl (string): LinkedIn profile URL of the contact
  • message (string): Content of the last message in the thread
  • lastMessageFromUrl (string): Profile URL of the last message sender
  • firstname (string): First name of the contact
  • lastname (string): Last name of the contact
  • occupation (string): Current job title/occupation of the contact
  • companyName (string): Company name where the contact works
  • isLastMessageFromMe (boolean): Whether the last message was sent by you
  • readStatus (boolean): Whether the conversation has been read (true = read, false = unread)
  • lastMessageDate (string): Human-readable date of the last message (e.g., "2h", "Yesterday", "Sep 01")
  • timestamp (string): ISO timestamp of the last message (if available)

Output Example

{
"success": true,
"message": "Successfully retrieved 25 conversations",
"conversationCount": 25,
"conversations": [
{
"threadUrl": "https://www.linkedin.com/messaging/thread/2-MGFjMTExN2YtOWI3NS00NmJlLWEyNjMtNjhlZDFjZWZkNDVkXzEwMA==/",
"linkedInUrl": "https://www.linkedin.com/in/ACoAABJnny0ButYTqma7Tmq-SqQDoFJVPpqBIr8",
"message": "Salut Pierre, j'ai vu que tu as jeté un œil à Hootsuite...",
"lastMessageFromUrl": "https://www.linkedin.com/in/ACoAABJnny0ButYTqma7Tmq-SqQDoFJVPpqBIr8",
"firstname": "Charlotte",
"lastname": "Clemens",
"occupation": "VP of Sales Enterprise Europe - Hootsuite & Talkwalker",
"companyName": "Hootsuite",
"isLastMessageFromMe": false,
"readStatus": true,
"lastMessageDate": "Sep 01",
"timestamp": "2024-09-01T10:30:00.000Z"
}
],
"timestamp": "2025-01-15T14:23:45.123Z"
}

How It Works

  1. Authentication: Sets LinkedIn session cookies (li_at and optionally JSESSIONID)
  2. Navigation: Opens LinkedIn messaging page (https://www.linkedin.com/messaging/)
  3. Conversation Loading: Automatically scrolls to load all available conversations
  4. Data Extraction: For each conversation:
    • Extracts thread URL, message content, timestamp, and read status from the messaging list
    • Navigates to the contact's profile page
    • Extracts detailed profile information (name, occupation, company)
  5. Output: Returns all conversation data in a structured format

Performance

  • Execution Time: ~2-5 seconds per conversation (due to profile information extraction)
  • Scrolling: Automatically scrolls up to 5 times to load all conversations
  • Anti-Detection: Includes user-agent spoofing and webdriver masking

Error Handling

The actor will throw an error if:

  • The liAtCookie parameter is missing
  • LinkedIn returns a non-200 status code
  • The messaging page fails to load
  • Authentication fails (invalid cookies)

Notes

  • Cookie Expiration: LinkedIn cookies expire periodically. If the actor fails, try getting fresh cookies from your browser.
  • Rate Limiting: LinkedIn may rate-limit requests if you run the actor too frequently. Use reasonable delays between runs.
  • Profile Privacy: Some profile information may not be available if the contact has restricted their profile visibility.
  • Headless Mode: The actor runs in headless mode by default for better performance.

Security

  • Never share your li_at cookie publicly as it grants full access to your LinkedIn account
  • Use Apify's secret input feature to store cookies securely
  • Cookies are only used for authentication and are not stored or logged

Use Cases

  • Export LinkedIn conversations for backup
  • Analyze messaging patterns and response rates
  • Integrate LinkedIn messaging data with CRM systems
  • Monitor unread messages and follow-ups
  • Generate reports on networking activities
  • linkedin-send-dm: Send direct messages to LinkedIn profiles
  • linkedin-like-post: Automatically like LinkedIn posts
  • linkedin-comment-post: Automatically comment on LinkedIn posts
  • linkedin-quote-post: Repost LinkedIn content with your thoughts

Support

For issues or questions, please contact the development team.

Version History

  • 1.0.0 (2025-01-15): Initial release
    • Basic conversation retrieval
    • Profile information extraction
    • Read status detection
    • Multi-selector strategies for robust element detection