@pipedream/linkedin 1.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/actions/create-comment/create-comment.mjs +1 -1
  2. package/actions/create-image-post-organization/create-image-post-organization.mjs +4 -3
  3. package/actions/create-image-post-user/create-image-post-user.mjs +4 -3
  4. package/actions/create-like-on-share/create-like-on-share.mjs +1 -1
  5. package/actions/create-text-post-organization/create-text-post-organization.mjs +4 -3
  6. package/actions/create-text-post-user/create-text-post-user.mjs +4 -3
  7. package/actions/delete-post/delete-post.mjs +1 -1
  8. package/actions/fetch-ad-account/fetch-ad-account.mjs +1 -1
  9. package/actions/get-current-member-profile/get-current-member-profile.mjs +1 -1
  10. package/actions/get-member-organization-access-control/get-member-organization-access-control.mjs +8 -19
  11. package/actions/get-member-profile/get-member-profile.mjs +1 -1
  12. package/actions/get-multiple-member-profiles/get-multiple-member-profiles.mjs +1 -1
  13. package/actions/get-organization-access-control/get-organization-access-control.mjs +12 -8
  14. package/actions/get-organization-administrators/get-organization-administrators.mjs +9 -11
  15. package/actions/get-profile-picture-fields/get-profile-picture-fields.mjs +52 -0
  16. package/actions/retrieve-comments-on-comments/retrieve-comments-on-comments.mjs +1 -1
  17. package/actions/retrieve-comments-shares/retrieve-comments-shares.mjs +1 -1
  18. package/actions/search-organization/search-organization.mjs +1 -1
  19. package/common/utils.mjs +27 -0
  20. package/linkedin.app.mjs +7 -2
  21. package/package.json +1 -1
  22. package/sources/new-organization-post-created/new-organization-post-created.mjs +1 -1
@@ -4,7 +4,7 @@ export default {
4
4
  key: "linkedin-create-comment",
5
5
  name: "Create Comment",
6
6
  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)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
@@ -1,12 +1,13 @@
1
1
  import linkedin from "../../linkedin.app.mjs";
2
2
  import { getFileStreamAndMetadata } from "@pipedream/platform";
3
3
  import FormData from "form-data";
4
+ import utils from "../../common/utils.mjs";
4
5
 
5
6
  export default {
6
7
  key: "linkedin-create-image-post-organization",
7
8
  name: "Create Image Post (Organization)",
8
- description: "Create an image post on LinkedIn. [See the docs here](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/images-api?view=li-lms-2023-09&tabs=http#uploading-an-image)",
9
- version: "1.0.1",
9
+ 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)",
10
+ version: "1.0.2",
10
11
  type: "action",
11
12
  props: {
12
13
  linkedin,
@@ -87,7 +88,7 @@ export default {
87
88
  await this.linkedin.createPost({
88
89
  data: {
89
90
  author: this.organizationId,
90
- commentary: this.text,
91
+ commentary: utils.escapeText(this.text),
91
92
  visibility: "PUBLIC",
92
93
  content: {
93
94
  media: {
@@ -1,12 +1,13 @@
1
1
  import linkedin from "../../linkedin.app.mjs";
2
2
  import { getFileStreamAndMetadata } from "@pipedream/platform";
3
3
  import FormData from "form-data";
4
+ import utils from "../../common/utils.mjs";
4
5
 
5
6
  export default {
6
7
  key: "linkedin-create-image-post-user",
7
8
  name: "Create Image Post (User)",
8
- description: "Create an image post on LinkedIn. [See the docs here](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/images-api?view=li-lms-2023-09&tabs=http#uploading-an-image)",
9
- version: "1.0.1",
9
+ 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)",
10
+ version: "1.0.2",
10
11
  type: "action",
11
12
  props: {
12
13
  linkedin,
@@ -86,7 +87,7 @@ export default {
86
87
 
87
88
  await this.linkedin.createPost({
88
89
  data: {
89
- commentary: this.text,
90
+ commentary: utils.escapeText(this.text),
90
91
  visibility: this.visibility,
91
92
  content: {
92
93
  media: {
@@ -4,7 +4,7 @@ export default {
4
4
  key: "linkedin-create-like-on-share",
5
5
  name: "Create Like On Share",
6
6
  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)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
@@ -1,10 +1,11 @@
1
1
  import linkedin from "../../linkedin.app.mjs";
2
+ import utils from "../../common/utils.mjs";
2
3
 
3
4
  export default {
4
5
  key: "linkedin-create-text-post-organization",
5
6
  name: "Create a Simple Post (Organization)",
6
- description: "Create post on LinkedIn using text, URL or article. [See the docs](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",
7
- version: "0.0.6",
7
+ 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",
8
+ version: "0.0.7",
8
9
  type: "action",
9
10
  props: {
10
11
  linkedin,
@@ -30,7 +31,7 @@ export default {
30
31
  async run({ $ }) {
31
32
  const data = {
32
33
  author: this.organizationId,
33
- commentary: this.text,
34
+ commentary: utils.escapeText(this.text),
34
35
  visibility: "PUBLIC",
35
36
  };
36
37
  if (this.article) {
@@ -1,10 +1,11 @@
1
1
  import linkedin from "../../linkedin.app.mjs";
2
+ import utils from "../../common/utils.mjs";
2
3
 
3
4
  export default {
4
5
  key: "linkedin-create-text-post-user",
5
6
  name: "Create a Simple Post (User)",
6
- description: "Create post on LinkedIn using text, URL or article. [See the docs](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",
7
- version: "0.0.6",
7
+ 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",
8
+ version: "0.0.7",
8
9
  type: "action",
9
10
  props: {
10
11
  linkedin,
@@ -29,7 +30,7 @@ export default {
29
30
  },
30
31
  async run({ $ }) {
31
32
  const data = {
32
- commentary: this.text,
33
+ commentary: utils.escapeText(this.text),
33
34
  visibility: this.visibility,
34
35
  };
35
36
  if (this.article) {
@@ -4,7 +4,7 @@ export default {
4
4
  key: "linkedin-delete-post",
5
5
  name: "Delete Post",
6
6
  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",
7
- version: "0.0.6",
7
+ version: "0.0.7",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "linkedin-fetch-ad-account",
5
5
  name: "Fetch Ad Account",
6
6
  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)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "linkedin-get-current-member-profile",
5
5
  name: "Get Current Member Profile",
6
6
  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)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
@@ -3,8 +3,8 @@ import linkedin from "../../linkedin.app.mjs";
3
3
  export default {
4
4
  key: "linkedin-get-member-organization-access-control",
5
5
  name: "Get Member's Organization Access Control Information",
6
- description: "Gets the organization access control information of the current authenticated member. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-access-control?context=linkedin/compliance/context#find-a-members-organization-access-control-information)",
7
- version: "0.1.6",
6
+ 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)",
7
+ version: "1.0.1",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
@@ -28,32 +28,21 @@ export default {
28
28
  },
29
29
  },
30
30
  async run({ $ }) {
31
- const count = 50;
32
- const results = [];
33
-
34
31
  const params = {
35
32
  q: "roleAssignee",
36
33
  role: this.role,
37
34
  state: this.state,
38
35
  start: 0,
39
- count,
36
+ count: 1,
40
37
  };
41
38
 
42
- let done = false;
43
- do {
44
- const { elements } = await this.linkedin.getAccessControl({
45
- $,
46
- params,
47
- });
48
- results.push(...elements);
49
- params.start += count;
50
- if (elements?.length < count) {
51
- done = true;
52
- }
53
- } while (results.length < this.max && !done);
39
+ const { data: { elements } } = await this.linkedin.getAccessControl({
40
+ $,
41
+ params,
42
+ });
54
43
 
55
44
  $.export("$summary", "Successfully retrieved access control information");
56
45
 
57
- return results;
46
+ return elements[0];
58
47
  },
59
48
  };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "linkedin-get-member-profile",
5
5
  name: "Get Member Profile",
6
6
  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)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "linkedin-get-multiple-member-profiles",
5
5
  name: "Get Multiple Member Profiles",
6
6
  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)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
@@ -3,15 +3,17 @@ import linkedin from "../../linkedin.app.mjs";
3
3
  export default {
4
4
  key: "linkedin-get-organization-access-control",
5
5
  name: "Gets Organization Access Control",
6
- description: "Gets an organization's access control information, given the organization urn. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-access-control?context=linkedin/compliance/context#find-access-control-information)",
7
- version: "0.1.6",
6
+ 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)",
7
+ version: "0.2.1",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
11
- organizationUrn: {
12
- type: "string",
13
- label: "Organization Urn",
14
- description: "The organizational entity for which the access control information is being retrieved. Must be in URN format urn:li:organization:{id}.",
11
+ organizationId: {
12
+ propDefinition: [
13
+ linkedin,
14
+ "organizationId",
15
+ ],
16
+ description: "The ID of the organization for which the access control information is being retrieved",
15
17
  },
16
18
  max: {
17
19
  propDefinition: [
@@ -25,12 +27,14 @@ export default {
25
27
  const count = 50;
26
28
  const results = [];
27
29
 
28
- const params = `q=organization&organization=${this.organizationUrn.replace(/:/g, "%3A")}&count=${count}`;
30
+ const organizationUrn = `urn:li:organization:${this.organizationId}`;
31
+
32
+ const params = `q=organization&organization=${organizationUrn.replace(/:/g, "%3A")}&count=${count}`;
29
33
 
30
34
  let done = false;
31
35
  do {
32
36
  const { data: { elements } } = await this.linkedin.getAccessControl({
33
- params: params + `&start=${start}`,
37
+ strParams: params + `&start=${start}`,
34
38
  });
35
39
 
36
40
  results.push(...elements);
@@ -3,21 +3,17 @@ import linkedin from "../../linkedin.app.mjs";
3
3
  export default {
4
4
  key: "linkedin-get-organization-administrators",
5
5
  name: "Get Organization Administrators",
6
- description: "Gets the administator members of an organization, given the organization urn. [See the docs here](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-access-control?context=linkedin/compliance/context#find-organization-administrators)",
7
- version: "0.2.6",
6
+ 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)",
7
+ version: "0.3.1",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
11
- organizationUrn: {
12
- type: "string",
13
- label: "Organization",
14
- description: "The organizational entity for which administrators are being retrieved. Must be in URN format urn:li:organization:{id}.",
15
- },
16
- max: {
11
+ organizationId: {
17
12
  propDefinition: [
18
13
  linkedin,
19
- "max",
14
+ "organizationId",
20
15
  ],
16
+ description: "The ID of the organization for which administrators are being retrieved",
21
17
  },
22
18
  },
23
19
  async run({ $ }) {
@@ -25,12 +21,14 @@ export default {
25
21
  const count = 50;
26
22
  const results = [];
27
23
 
28
- const params = `q=organization&organization=${this.organizationUrn.replace(/:/g, "%3A")}&role=ADMINISTRATOR&state=APPROVED&count=${count}`;
24
+ const organizationUrn = `urn:li:organization:${this.organizationId}`;
25
+
26
+ const params = `q=organization&organization=${organizationUrn.replace(/:/g, "%3A")}&role=ADMINISTRATOR&state=APPROVED&count=${count}`;
29
27
 
30
28
  let done = false;
31
29
  do {
32
30
  const { data: { elements } } = await this.linkedin.getAccessControl({
33
- params: params + `&start=${start}`,
31
+ strParams: params + `&start=${start}`,
34
32
  });
35
33
 
36
34
  results.push(...elements);
@@ -0,0 +1,52 @@
1
+ import linkedin from "../../linkedin.app.mjs";
2
+ import constants from "../../common/constants.mjs";
3
+
4
+ export default {
5
+ key: "linkedin-get-profile-picture-fields",
6
+ name: "Get Profile Picture Fields",
7
+ 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)",
8
+ version: "0.0.2",
9
+ type: "action",
10
+ props: {
11
+ linkedin,
12
+ includeOriginalImage: {
13
+ type: "boolean",
14
+ label: "Include Original Image",
15
+ description: "Whether to include the original image data in the response (requires special permissions)",
16
+ optional: true,
17
+ default: false,
18
+ },
19
+ },
20
+ methods: {
21
+ getProfilePictureFields(args) {
22
+ return this.linkedin._makeRequest({
23
+ url: `${constants.BASE_URL}v2/me`,
24
+ ...args,
25
+ });
26
+ },
27
+ },
28
+ async run({ $ }) {
29
+ let projection = "id,profilePicture(displayImage~digitalmediaAsset:playableStreams";
30
+
31
+ if (this.includeOriginalImage) {
32
+ projection += ",originalImage~digitalmediaAsset:playableStreams";
33
+ }
34
+
35
+ projection += ")";
36
+
37
+ const response = await this.getProfilePictureFields({
38
+ $,
39
+ params: {
40
+ projection: `(${projection})`,
41
+ },
42
+ });
43
+
44
+ if (response.profilePicture) {
45
+ $.export("$summary", "Successfully retrieved profile picture fields");
46
+ } else {
47
+ $.export("$summary", "Profile retrieved, but no profile picture found for this account");
48
+ }
49
+
50
+ return response;
51
+ },
52
+ };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "linkedin-retrieve-comments-on-comments",
5
5
  name: "Retrieves Comments on Comments",
6
6
  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)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "linkedin-retrieve-comments-shares",
5
5
  name: "Retrieve Comments On Shares",
6
6
  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)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "linkedin-search-organization",
5
5
  name: "Search Organization",
6
6
  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)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  linkedin,
package/common/utils.mjs CHANGED
@@ -30,9 +30,36 @@ function getParamsSerializer(encodeFn = defaultEncodeFn) {
30
30
  };
31
31
  }
32
32
 
33
+ function escapeText(text) {
34
+ const chars = [
35
+ "\\",
36
+ "|",
37
+ "{",
38
+ "}",
39
+ "@",
40
+ "[",
41
+ "]",
42
+ "(",
43
+ ")",
44
+ "<",
45
+ ">",
46
+ "#",
47
+ "*",
48
+ "_",
49
+ "~",
50
+ ];
51
+ for (const char of chars) {
52
+ const escapedChar = "\\" + char;
53
+ const regex = new RegExp(`\\${char}`, "g");
54
+ text = text.replace(regex, escapedChar);
55
+ }
56
+ return text;
57
+ }
58
+
33
59
  export default {
34
60
  iterate,
35
61
  getNestedProperty,
36
62
  encodeFn,
37
63
  getParamsSerializer,
64
+ escapeText,
38
65
  };
package/linkedin.app.mjs CHANGED
@@ -234,9 +234,14 @@ export default {
234
234
  ...args,
235
235
  });
236
236
  },
237
- async getAccessControl({ params }) {
237
+ async getAccessControl({
238
+ strParams, ...args
239
+ }) {
238
240
  return this._makeRequestAxios({
239
- path: `/organizationAcls?${params}`,
241
+ path: `/organizationAcls${strParams
242
+ ? `?${strParams}`
243
+ : ""}`,
244
+ ...args,
240
245
  });
241
246
  },
242
247
  async queryAnaltyics(query, args = {} ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/linkedin",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "Pipedream Linkedin Components",
5
5
  "main": "linkedin.app.mjs",
6
6
  "keywords": [
@@ -9,7 +9,7 @@ export default {
9
9
  name: "New Organization Post Created",
10
10
  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).",
11
11
  type: "source",
12
- version: "0.0.1",
12
+ version: "0.0.2",
13
13
  dedupe: "unique",
14
14
  props: {
15
15
  ...common.props,