Facebook Pixel
APILinkedIn Messaging

Get recent messages

Retrieve recent LinkedIn messages/conversations for the authenticated account. Supports filtering by keywords and read status. Returns simplified conversation list with latest message preview. Rate limit: 150 messages per day per account.

GET/messaging/recent-messages
Authentication requiredMessaging

Code Examples

curl -X GET 'https://api.connectsafely.ai/linkedin/messaging/recent-messages' \
-H 'Authorization: Bearer <your_api_key>'

Parameters

NameInRequiredTypeDescription
accountIdqueryNostringLinkedIn account ID to use. If not provided, uses the default account.
nextCursorqueryNostringCursor for pagination from previous response
countqueryNonumberNumber of conversations to return
keywordsqueryNostringSearch keywords to filter conversations
readqueryNostringFilter by read status: "true" or "false"

Request Body

No request body.

Responses

StatusDescription
200Recent messages retrieved successfully
401Unauthorized - Invalid or missing API key
500Server error

200 Response Parameters

NameTypeDescription
successboolean
accountIdstring
profileUrnstring
conversationsarray
totalnumber
nextCursorstring

200 Example

{
  "success": true,
  "accountId": "696ce9e780e0483585e4e553",
  "profileUrn": "urn:li:fsd_profile:ACoAAATPlQ0Bc8wdg-Iy8wZgEDuSdIVWJiE1Aio",
  "conversations": [
    {
      "conversationId": "2-ODFkYjU4M2ItZDlmYS00YTVjLThlNTQtZjI5YTE4ZWUyZDk5XzEwMA==",
      "conversationUrn": "urn:li:msg_conversation:(urn:li:fsd_profile:ACoAAATPlQ0Bc8wdg-Iy8wZgEDuSdIVWJiE1Aio,2-ODFkYjU4M2ItZDlmYS00YTVjLThlNTQtZjI5YTE4ZWUyZDk5XzEwMA==)",
      "backendConversationUrn": "urn:li:messagingThread:2-ODFkYjU4M2ItZDlmYS00YTVjLThlNTQtZjI5YTE4ZWUyZDk5XzEwMA==",
      "conversationUrl": "https://www.linkedin.com/messaging/thread/2-ODFkYjU4M2ItZDlmYS00YTVjLThlNTQtZjI5YTE4ZWUyZDk5XzEwMA==/",
      "participants": [
        {
          "profileId": "ACoAADSoo60BM6hxemTbnN2aA_Z1-WlNFRhRYhU",
          "name": "John Doe",
          "headline": "Software Engineer at Tech Company",
          "profileUrl": "https://www.linkedin.com/in/ACoAADSoo60BM6hxemTbnN2aA_Z1-WlNFRhRYhU",
          "profilePicture": "https://media.licdn.com/dms/image/...",
          "distance": "DISTANCE_1",
          "memberBadgeType": null,
          "participantUrn": "urn:li:msg_messagingParticipant:urn:li:fsd_profile:ACoAADSoo60BM6hxemTbnN2aA_Z1-WlNFRhRYhU",
          "backendUrn": "urn:li:member:883467181",
          "hostIdentityUrn": "urn:li:fsd_profile:ACoAADSoo60BM6hxemTbnN2aA_Z1-WlNFRhRYhU"
        }
      ],
      "unreadCount": 0,
      "lastActivityAt": 1771950346603,
      "createdAt": 1771317337868,
      "lastReadAt": 1771950726332,
      "isRead": true,
      "state": null,
      "latestMessage": {
        "messageUrn": "urn:li:msg_message:(urn:li:fsd_profile:ACoAAATPlQ0Bc8wdg-Iy8wZgEDuSdIVWJiE1Aio,2-MTc3MTk1MDM0NjYwM2I5NzY0NS0xMDA=)",
        "backendMessageUrn": "urn:li:messagingMessage:2-MTc3MTk1MDM0NjYwM2I5NzY0NS0xMDA=",
        "text": "Hello, how are you?",
        "sentAt": 1771950346603,
        "senderName": "John Doe",
        "senderProfileUrl": "https://www.linkedin.com/in/ACoAADSoo60BM6hxemTbnN2aA_Z1-WlNFRhRYhU",
        "senderUrn": "urn:li:msg_messagingParticipant:urn:li:fsd_profile:ACoAADSoo60BM6hxemTbnN2aA_Z1-WlNFRhRYhU",
        "hasAttachment": false
      }
    }
  ]
}

401 Example

{
  "error": "Unauthorized - Invalid credentials"
}

500 Example

{
  "error": "Failed to get LinkedIn authentication credentials",
  "success": false
}