Modules@robinpath/linkedin
linkedin

@robinpath/linkedin

0.1.2Node.jsPublic

LinkedIn module for RobinPath.

LinkedIn

LinkedIn module for RobinPath.

Package: @robinpath/linkedin | Category: Social Media | Type: Integration

Authentication

linkedin.setToken "your-access-token"

Call this once at the start of your script before using any other function. Credentials persist for the duration of the script execution.

Use Cases

Use the linkedin module when you need to:

  • Get the authenticated user's profile using /v2/userinfo -- Use linkedin.getProfile to perform this operation
  • Get organization/company page information -- Use linkedin.getOrganization to perform this operation
  • Create a text post (share on feed) -- Use linkedin.createPost to perform this operation
  • Share an article with URL, title, and description -- Use linkedin.createArticlePost to perform this operation
  • Share an image post with text -- Use linkedin.createImagePost to perform this operation

Quick Reference

FunctionDescriptionReturns
setTokenStore an OAuth2 access token for LinkedIn API requests{ok: true}
getProfileGet the authenticated user's profile using /v2/userinfoUser profile object with sub, name, email, picture, etc.
getOrganizationGet organization/company page informationOrganization object with name, description, website, etc.
createPostCreate a text post (share on feed)Created post object with id
createArticlePostShare an article with URL, title, and descriptionCreated post object with id
createImagePostShare an image post with textCreated post object with id
deletePostDelete a post by its URN{ok: true, status}
getPostGet post details by URNPost object with author, text, visibility, etc.
registerImageUploadRegister an image upload and get the upload URL and image URN{uploadUrl, imageUrn, mediaArtifact}
uploadImageUpload an image binary to the URL from registerImageUpload{ok: true, status}
addCommentAdd a comment on a postCreated comment object
getCommentsList comments on a postObject with elements array of comments
deleteCommentDelete a comment by its URN{ok: true, status}
addReactionReact to a post (LIKE, PRAISE, EMPATHY, INTEREST, APPRECIATION)Reaction result object
removeReactionRemove a reaction from a post{ok: true, status}
getReactionsGet all reactions on a postObject with elements array of reactions
getFollowerCountGet the follower count for an organization{organizationId, followerCount}
getShareStatisticsGet post/share analytics for an organizationShare statistics with impressions, clicks, engagement, etc.
searchPeopleSearch for people on LinkedIn (limited access, requires special permissions)Search results object with people array
getConnectionsGet first-degree connections of the authenticated userConnections list with elements array

Functions

setToken

Store an OAuth2 access token for LinkedIn API requests

Module: linkedin | Returns: object -- {ok: true}

linkedin.setToken "your-access-token"
ParameterTypeRequiredDescription
accessTokenstringYesOAuth2 access token

getProfile

Get the authenticated user's profile using /v2/userinfo

Module: linkedin | Returns: object -- User profile object with sub, name, email, picture, etc.

linkedin.getProfile
ParameterTypeRequiredDescription
(none)NoCall with no arguments

getOrganization

Get organization/company page information

Module: linkedin | Returns: object -- Organization object with name, description, website, etc.

linkedin.getOrganization "12345678"
ParameterTypeRequiredDescription
organizationIdstringYesOrganization numeric ID

createPost

Create a text post (share on feed)

Module: linkedin | Returns: object -- Created post object with id

linkedin.createPost "urn:li:person:abc123" "Hello LinkedIn!" {"visibility": "PUBLIC"}
ParameterTypeRequiredDescription
authorUrnstringYesAuthor URN (e.g. urn:li:person:{id} or urn:li:organization:{id})
textstringYesPost text content
optionsobjectNo{visibility?: 'PUBLIC'

createArticlePost

Share an article with URL, title, and description

Module: linkedin | Returns: object -- Created post object with id

linkedin.createArticlePost "urn:li:person:abc123" "Great read!" "https://example.com/article" {"title": "Article Title"}
ParameterTypeRequiredDescription
authorUrnstringYesAuthor URN
textstringYesPost commentary text
articleUrlstringYesURL of the article to share
optionsobjectNo{visibility?, title?, description?}

createImagePost

Share an image post with text

Module: linkedin | Returns: object -- Created post object with id

linkedin.createImagePost "urn:li:person:abc123" "Check this out!" "urn:li:digitalmediaAsset:abc" {"title": "Photo"}
ParameterTypeRequiredDescription
authorUrnstringYesAuthor URN
textstringYesPost text content
imageUrnstringYesImage URN from registerImageUpload
optionsobjectNo{visibility?, title?, description?}

deletePost

Delete a post by its URN

Module: linkedin | Returns: object -- {ok: true, status}

linkedin.deletePost "urn:li:ugcPost:123456"
ParameterTypeRequiredDescription
postUrnstringYesURN of the post to delete

getPost

Get post details by URN

Module: linkedin | Returns: object -- Post object with author, text, visibility, etc.

linkedin.getPost "urn:li:ugcPost:123456"
ParameterTypeRequiredDescription
postUrnstringYesURN of the post

registerImageUpload

Register an image upload and get the upload URL and image URN

Module: linkedin | Returns: object -- {uploadUrl, imageUrn, mediaArtifact}

linkedin.registerImageUpload "urn:li:person:abc123"
ParameterTypeRequiredDescription
ownerUrnstringYesOwner URN (e.g. urn:li:person:{id})

uploadImage

Upload an image binary to the URL from registerImageUpload

Module: linkedin | Returns: object -- {ok: true, status}

linkedin.uploadImage "https://api.linkedin.com/mediaUpload/..." "./photo.jpg"
ParameterTypeRequiredDescription
uploadUrlstringYesUpload URL from registerImageUpload
imagePathstringYesLocal path to the image file

addComment

Add a comment on a post

Module: linkedin | Returns: object -- Created comment object

linkedin.addComment "urn:li:ugcPost:123456" "Great post!"
ParameterTypeRequiredDescription
postUrnstringYesURN of the post to comment on
textstringYesComment text

getComments

List comments on a post

Module: linkedin | Returns: object -- Object with elements array of comments

linkedin.getComments "urn:li:ugcPost:123456" {"count": 20}
ParameterTypeRequiredDescription
postUrnstringYesURN of the post
optionsobjectNo{start?: number, count?: number}

deleteComment

Delete a comment by its URN

Module: linkedin | Returns: object -- {ok: true, status}

linkedin.deleteComment "urn:li:comment:(ugcPost:123,456)"
ParameterTypeRequiredDescription
commentUrnstringYesURN of the comment to delete

addReaction

React to a post (LIKE, PRAISE, EMPATHY, INTEREST, APPRECIATION)

Module: linkedin | Returns: object -- Reaction result object

linkedin.addReaction "urn:li:ugcPost:123456" "LIKE"
ParameterTypeRequiredDescription
postUrnstringYesURN of the post to react to
reactionTypestringYesReaction type: LIKE, PRAISE, EMPATHY, INTEREST, APPRECIATION

removeReaction

Remove a reaction from a post

Module: linkedin | Returns: object -- {ok: true, status}

linkedin.removeReaction "urn:li:ugcPost:123456" "LIKE"
ParameterTypeRequiredDescription
postUrnstringYesURN of the post
reactionTypestringYesReaction type to remove: LIKE, PRAISE, EMPATHY, INTEREST, APPRECIATION

getReactions

Get all reactions on a post

Module: linkedin | Returns: object -- Object with elements array of reactions

linkedin.getReactions "urn:li:ugcPost:123456"
ParameterTypeRequiredDescription
postUrnstringYesURN of the post

getFollowerCount

Get the follower count for an organization

Module: linkedin | Returns: object -- {organizationId, followerCount}

linkedin.getFollowerCount "urn:li:organization:12345678"
ParameterTypeRequiredDescription
organizationUrnstringYesOrganization URN or numeric ID

getShareStatistics

Get post/share analytics for an organization

Module: linkedin | Returns: object -- Share statistics with impressions, clicks, engagement, etc.

linkedin.getShareStatistics "urn:li:organization:12345678"
ParameterTypeRequiredDescription
ownerUrnstringYesOwner URN (organizational entity)
shareUrnsarrayNoOptional array of share URNs to filter

searchPeople

Search for people on LinkedIn (limited access, requires special permissions)

Module: linkedin | Returns: object -- Search results object with people array

linkedin.searchPeople "software engineer" {"count": 10}
ParameterTypeRequiredDescription
querystringYesSearch keywords
optionsobjectNo{start?: number, count?: number}

getConnections

Get first-degree connections of the authenticated user

Module: linkedin | Returns: object -- Connections list with elements array

linkedin.getConnections {"count": 20}
ParameterTypeRequiredDescription
optionsobjectNo{start?: number, count?: number}

Error Handling

All functions throw on failure. Common errors:

ErrorCause
Access token not set. Call linkedin.setToken first.Check the error message for details
LinkedIn API GET ${path} failed (${response.status}): ${errText}Check the error message for details
LinkedIn API POST ${path} failed (${response.status}): ${errText}Check the error message for details
LinkedIn API DELETE ${path} failed (${response.status}): ${errText}Check the error message for details
Access token is requiredCheck the error message for details
Organization ID is requiredCheck the error message for details
Author URN is required (e.g. urn:li:person:{id})Check the error message for details
Post text is requiredCheck the error message for details
@desc "Get profile and validate result"
do
  set $result as linkedin.getProfile
  if $result != null
    print "Success"
  else
    print "No result"
  end
enddo

Recipes

1. List and iterate Profile

Retrieve all items and loop through them.

@desc "Setup authentication"
do
  linkedin.setToken $token
enddo

@desc "Get profile and iterate results"
do
  set $result as linkedin.getProfile
  each $item in $result
    print $item
  end
enddo

2. Create a new item with createPost

Create a new resource and capture the result.

@desc "Setup authentication"
do
  linkedin.setToken $token
enddo

@desc "Create post"
do
  set $result as linkedin.createPost "urn:li:person:abc123" "Hello LinkedIn!" {"visibility": "PUBLIC"}
  print "Created: " + $result
enddo

3. Check before creating

List existing items and only create if needed.

@desc "Setup authentication"
do
  linkedin.setToken $token
enddo

@desc "Get profile and create post"
do
  set $existing as linkedin.getProfile
  if $existing == null
    linkedin.createPost "urn:li:person:abc123" "Hello LinkedIn!" {"visibility": "PUBLIC"}
    print "Item created"
  else
    print "Item already exists"
  end
enddo

4. Multi-step LinkedIn workflow

Chain multiple linkedin operations together.

@desc "Setup authentication"
do
  linkedin.setToken $token
enddo

@desc "Get profile, get organization, and more"
do
  set $r_getProfile as linkedin.getProfile
  set $r_getOrganization as linkedin.getOrganization "12345678"
  set $r_createPost as linkedin.createPost "urn:li:person:abc123" "Hello LinkedIn!" {"visibility": "PUBLIC"}
  print "All operations complete"
enddo

5. Safe getProfile with validation

Check results before proceeding.

@desc "Setup authentication"
do
  linkedin.setToken $token
enddo

@desc "Get profile and validate result"
do
  set $result as linkedin.getProfile
  if $result != null
    print "Success: " + $result
  else
    print "Operation returned no data"
  end
enddo

Related Modules

  • facebook -- Facebook module for complementary functionality
  • instagram -- Instagram module for complementary functionality
  • twitter -- Twitter/X module for complementary functionality
  • tiktok -- TikTok module for complementary functionality
  • pinterest -- Pinterest module for complementary functionality

Versions (1)

VersionTagPublished
0.1.2latest1 months ago
Install
$ robinpath add @robinpath/linkedin

Collaborators

Dumitru Balaban
Dumitru Balaban
@dumitru
View all @robinpath modules
Version0.1.2
LicenseMIT
Unpacked Size8.6 KB
Versions1
Weekly Downloads22
Total Downloads22
Stars0
Last Publish1 months ago
Created1 months ago

Category

marketing