LinkedIn Connection Guide
Use this guide to connect LinkedIn and publish posts through the LinkedIn integration.
Before You Start
Make sure you have:
• A LinkedIn app with the right permissions
• A LinkedIn account already connected to your system
• These values saved for the companycompany.linkedin.accessTokencompany.linkedin.memberId
Connect LinkedIn
1. Create a LinkedIn App
Create a LinkedIn app and set the OAuth redirect URL to:
{YOUR_BASE_URL}/api/auth/linkedin/callback
2. Add Client Credentials
Save your LinkedIn client credentials in the company configuration.
{
"linkedin": {
"client_id": { "ciphertext": "...", "iv": "..." },
"client_secret": { "ciphertext": "...", "iv": "..." }
}
}
3. Complete Authorization
Once OAuth is complete, the system stores:
• linkedin.accessToken
• linkedin.memberId
• linkedin.profile
How Posting Works
The integration reads data from body.linkedin and converts it into LinkedIn UGC posts.
You only need to send the correct structure. The system handles the rest.
Basic Request Structure
{
"collection": "posts",
"linkedin": {
"enabled": true,
"postType": "text",
"fields": {
"shareCommentary": "title",
"media": "images",
"originalUrl": "link"
}
}
}
Field Mapping
The fields object maps your data to LinkedIn fields.
Nested values are supported.
Example
{
"linkedin": {
"enabled": true,
"postType": "image",
"fields": {
"shareCommentary": "title",
"media": "assets.images",
"originalUrl": "links.primary"
}
}
}
Supported LinkedIn Fields
• author (full URN, optional)
• authorId (member or organization ID)
• authorType (person or organization)
• shareCommentary
• originalUrl
• media
• mediaTitle
• lifecycleState
• visibility
• shareMediaCategory
If author details are missing, the connected user’s memberId is used.
Post Types
All posts are published as LinkedIn UGC posts with this base structure:
{
"author": "urn:li:person:PERSON_ID",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
Text Post
{
"title": "Hello LinkedIn",
"linkedin": {
"enabled": true,
"postType": "text",
"fields": {
"shareCommentary": "title"
}
}
}
Link Post
{
"title": "New blog is live",
"link": "https://yourdomain.com/blog/post-1",
"linkedin": {
"enabled": true,
"postType": "link",
"fields": {
"shareCommentary": "title",
"originalUrl": "link"
}
}
}
Single Image
{
"title": "Here’s an image",
"imageUrl": "https://yourcdn.com/image-1.jpg",
"linkedin": {
"enabled": true,
"postType": "image",
"fields": {
"shareCommentary": "title",
"media": "imageUrl"
}
}
}
Multiple Images
{
"title": "Photo dump",
"images": [
"https://yourcdn.com/image-1.jpg",
"https://yourcdn.com/image-2.jpg"
],
"linkedin": {
"enabled": true,
"postType": "multi-image",
"fields": {
"shareCommentary": "title",
"media": "images"
}
}
}
Video
{
"title": "New demo video",
"videoUrl": "https://yourcdn.com/video-1.mp4",
"linkedin": {
"enabled": true,
"postType": "video",
"fields": {
"shareCommentary": "title",
"media": "videoUrl"
}
}
}
Media Upload Handling
For image and video posts, the integration automatically:
Registers an upload with LinkedIn
Uploads the file
Uses the returned asset ID in the post
You just provide a public URL.
Deleting a Post
To delete a LinkedIn post, store its ID or URN.
The system checks these fields in order:
• linkedin.id
• linkedin.urn
• linkedin.ugcPostId
• id
Example
{
"linkedin": {
"id": "urn:li:ugcPost:1234567890"
}
}
The API then calls:
DELETE /ugcPosts/{id}
Defaults Used
• lifecycleState → PUBLISHED
• visibility → PUBLIC
• shareMediaCategory → based on post type
• author → connected user’s memberId