Skip to content

[BUG] 403 error when trying to create a simple text post in LinkedIn #17829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-create-comment",
name: "Create Comment",
description: "Create a comment on a share or user generated content post. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/network-update-social-actions#create-comment)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "linkedin-create-image-post-organization",
name: "Create Image Post (Organization)",
description: "Create an image post on LinkedIn. [See the documentation](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/images-api?view=li-lms-2023-09&tabs=http#uploading-an-image)",
version: "1.0.2",
version: "1.0.3",
type: "action",
props: {
linkedin,
Expand Down Expand Up @@ -87,7 +87,11 @@ export default {

await this.linkedin.createPost({
data: {
author: this.organizationId,
author: `urn:li:organization:${this.organizationId}`,
lifecycleState: "PUBLISHED",
distribution: {
feedDistribution: "MAIN_FEED",
},
commentary: utils.escapeText(this.text),
visibility: "PUBLIC",
content: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "linkedin-create-image-post-user",
name: "Create Image Post (User)",
description: "Create an image post on LinkedIn. [See the documentation](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/images-api?view=li-lms-2023-09&tabs=http#uploading-an-image)",
version: "1.0.2",
version: "1.0.3",
type: "action",
props: {
linkedin,
Expand Down Expand Up @@ -85,8 +85,17 @@ export default {

await this.uploadImage(uploadUrl, formData);

const { id } = await this.linkedin.getCurrentMemberProfile({
$,
});

await this.linkedin.createPost({
data: {
author: `urn:li:person:${id}`,
lifecycleState: "PUBLISHED",
distribution: {
feedDistribution: "MAIN_FEED",
},
commentary: utils.escapeText(this.text),
visibility: this.visibility,
content: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-create-like-on-share",
name: "Create Like On Share",
description: "Creates a like on a share. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/network-update-social-actions#create-a-like-on-a-share)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "linkedin-create-text-post-organization",
name: "Create a Simple Post (Organization)",
description: "Create post on LinkedIn using text, URL or article. [See the documentation](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/posts-api?view=li-lms-2022-11&tabs=http#create-organic-posts) for more information",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
linkedin,
Expand All @@ -30,9 +30,13 @@ export default {
},
async run({ $ }) {
const data = {
author: this.organizationId,
author: `urn:li:organization:${this.organizationId}`,
commentary: utils.escapeText(this.text),
visibility: "PUBLIC",
lifecycleState: "PUBLISHED",
distribution: {
feedDistribution: "MAIN_FEED",
},
};
if (this.article) {
data.content = {
Expand All @@ -47,6 +51,8 @@ export default {
data,
});
$.export("$summary", "Successfully created a new Post as Organization");
return response;
return response || {
success: true,
};
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "linkedin-create-text-post-user",
name: "Create a Simple Post (User)",
description: "Create post on LinkedIn using text, URL or article. [See the documentation](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/posts-api?view=li-lms-2022-11&tabs=http#create-organic-posts) for more information",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
linkedin,
Expand All @@ -29,23 +29,43 @@ export default {
},
},
async run({ $ }) {
const data = {
commentary: utils.escapeText(this.text),
visibility: this.visibility,
};
if (this.article) {
data.content = {
article: {
source: this.article,
title: this.article,
},
};
}
const response = await this.linkedin.createPost({
const {
linkedin,
visibility,
text,
article,
} = this;

const profile = await linkedin.getCurrentMemberProfile({
$,
});

const response = await linkedin.createPost({
$,
data,
data: {
author: `urn:li:person:${profile?.id}`,
lifecycleState: "PUBLISHED",
distribution: {
feedDistribution: "MAIN_FEED",
},
commentary: utils.escapeText(text),
visibility,
...(article
? {
content: {
article: {
source: article,
title: article,
},
},
}
: {}
),
},
});
$.export("$summary", "Successfully created a new Post as User");
return response;
return response || {
success: true,
};
},
};
2 changes: 1 addition & 1 deletion components/linkedin/actions/delete-post/delete-post.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-delete-post",
name: "Delete Post",
description: "Removes a post from user's wall. [See the docs](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/share-api?tabs=http#delete-shares) for more information",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-fetch-ad-account",
name: "Fetch Ad Account",
description: "Fetches an individual adAccount given its id. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-accounts#fetch-ad-account)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-get-current-member-profile",
name: "Get Current Member Profile",
description: "Gets the profile of the current authenticated member. [See the docs here](https://docs.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api#retrieve-current-members-profile)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-get-member-profile",
name: "Get Member Profile",
description: "Gets another member's profile, given its person id. [See the docs here](https://docs.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api#retrieve-other-members-profile)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-get-multiple-member-profiles",
name: "Get Multiple Member Profiles",
description: "Gets multiple member profiles at once. [See the docs here](https://docs.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api#retrieve-other-members-profile)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-get-org-member-access",
name: "Get Member's Organization Access Control Information",
description: "Gets the organization access control information of the current authenticated member. [See the documentation](https://learn.microsoft.com/en-us/linkedin/marketing/community-management/organizations/organization-access-control-by-role?view=li-lms-2025-01&tabs=http#find-a-members-organization-access-control-information)",
version: "1.0.2",
version: "1.0.3",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-get-organization-access-control",
name: "Gets Organization Access Control",
description: "Gets a selected organization's access control information. [See the documentation](https://learn.microsoft.com/en-us/linkedin/marketing/community-management/organizations/organization-access-control-by-role?view=li-lms-2025-01&tabs=http#find-organization-access-control)",
version: "0.2.1",
version: "0.2.2",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-get-organization-administrators",
name: "Get Organization Administrators",
description: "Gets the administrator members of a selected organization. [See the documentation](https://learn.microsoft.com/en-us/linkedin/marketing/community-management/organizations/organization-access-control-by-role?view=li-lms-2025-01&tabs=http#find-organization-administrators)",
version: "0.3.1",
version: "0.3.2",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "linkedin-get-profile-picture-fields",
name: "Get Profile Picture Fields",
description: "Gets the authenticated user's profile picture data including display image and metadata. [See the documentation](https://learn.microsoft.com/en-us/linkedin/shared/references/v2/profile/profile-picture)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-retrieve-comments-on-comments",
name: "Retrieves Comments on Comments",
description: "Retrieves comments on comments, given the parent comment urn. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/network-update-social-actions#retrieve-comments-on-comments)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-retrieve-comments-shares",
name: "Retrieve Comments On Shares",
description: "Retrieve comments on shares given the share urn. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/network-update-social-actions#retrieve-comments-on-shares)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
linkedin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linkedin-search-organization",
name: "Search Organization",
description: "Searches for an organization by vanity name or email domain. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-lookup-api)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
linkedin,
Expand Down
15 changes: 1 addition & 14 deletions components/linkedin/linkedin.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,10 @@ export default {
...otherConfig,
});
},
async createPost({
data, ...args
}) {
data = {
...data,
author: `urn:li:${data?.author
? "organization"
: "person"}:${data.author || this.$auth.oauth_uid}`,
lifecycleState: "PUBLISHED",
distribution: {
feedDistribution: "MAIN_FEED",
},
};
createPost(args = {}) {
return this._makeRequest({
method: "POST",
path: "/posts",
data,
...args,
});
},
Expand Down
2 changes: 1 addition & 1 deletion components/linkedin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/linkedin",
"version": "1.2.0",
"version": "1.2.1",
"description": "Pipedream Linkedin Components",
"main": "linkedin.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
name: "New Organization Post Created",
description: "Emit new event when a new post is created by the organization. [See the documentation](https://learn.microsoft.com/en-us/linkedin/marketing/community-management/shares/posts-api?view=li-lms-2024-09&tabs=curl#find-posts-by-authors).",
type: "source",
version: "0.0.2",
version: "0.0.3",
dedupe: "unique",
props: {
...common.props,
Expand Down
Loading
Loading