Loading...
Loading...
Publish text / link posts to your LinkedIn personal feed via the LinkedIn Posts API. Use when the user mentions LinkedIn, sharing or posting an update to LinkedIn, or cross-posting an article / link to their LinkedIn feed.
npx skill4agent add acedatacloud/skills linkedincurl + jq$LINKEDIN_TOKENAuthorization: Bearer $LINKEDIN_TOKENurn:li:person:{sub}SUB=$(curl -sS -H "Authorization: Bearer $LINKEDIN_TOKEN" \
"https://api.linkedin.com/v2/userinfo" | jq -r .sub)
AUTHOR="urn:li:person:$SUB"
echo "$AUTHOR"messageserviceErrorCode401LinkedIn-VersionYYYYMM426jq -n --arg a "$AUTHOR" --arg t "My update text. Check out https://studio.acedata.cloud" \
'{author:$a, commentary:$t, visibility:"PUBLIC",
distribution:{feedDistribution:"MAIN_FEED", targetEntities:[], thirdPartyDistributionChannels:[]},
lifecycleState:"PUBLISHED", isReshareDisabledByAuthor:false}' \
| curl -sS -X POST "https://api.linkedin.com/rest/posts" \
-H "Authorization: Bearer $LINKEDIN_TOKEN" \
-H "Content-Type: application/json" \
-H "LinkedIn-Version: 202401" \
-H "X-Restli-Protocol-Version: 2.0.0" \
-d @- -D - -o /dev/null | tr -d '\r' | awk '/^[Xx]-[Rr]estli-[Ii]d:|^[Ll]ocation:/{print}'201x-restli-idLocationLink posts: put the URL inline in(LinkedIn auto-unfurls it). Rich article attachments need the assets/images API — out of scope for a simple text/link share; keep links inline.commentary
POST https://api.linkedin.com/v2/ugcPostsspecificContent."com.linkedin.ugc.ShareContent"w_member_social/rest/postsurn:li:person:{sub}w_member_socialw_organization_socialLinkedIn-Version/rest/*YYYYMMpublish_artifactpublish_artifact(kind="article", channel="linkedin", title="<title>", url="<the REAL returned URL>", status="delivered")status="failed"_shared/artifacts.md