Skip to content

Commit 6e90be3

Browse files
authored
LinkedIn improvements and new action (#17401)
* pnpm * LinkedIn action improvements * Adding 'get profile picture fields' action * Improvement * removing comment * pnpm
1 parent 62ed064 commit 6e90be3

File tree

6 files changed

+89
-41
lines changed

6 files changed

+89
-41
lines changed

components/linkedin/actions/get-member-organization-access-control/get-member-organization-access-control.mjs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import linkedin from "../../linkedin.app.mjs";
33
export default {
44
key: "linkedin-get-member-organization-access-control",
55
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.0",
88
type: "action",
99
props: {
1010
linkedin,
@@ -28,32 +28,21 @@ export default {
2828
},
2929
},
3030
async run({ $ }) {
31-
const count = 50;
32-
const results = [];
33-
3431
const params = {
3532
q: "roleAssignee",
3633
role: this.role,
3734
state: this.state,
3835
start: 0,
39-
count,
36+
count: 1,
4037
};
4138

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+
});
5443

5544
$.export("$summary", "Successfully retrieved access control information");
5645

57-
return results;
46+
return elements[0];
5847
},
5948
};

components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ import linkedin from "../../linkedin.app.mjs";
33
export default {
44
key: "linkedin-get-organization-access-control",
55
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.0",
88
type: "action",
99
props: {
1010
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",
1517
},
1618
max: {
1719
propDefinition: [
@@ -25,12 +27,14 @@ export default {
2527
const count = 50;
2628
const results = [];
2729

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}`;
2933

3034
let done = false;
3135
do {
3236
const { data: { elements } } = await this.linkedin.getAccessControl({
33-
params: params + `&start=${start}`,
37+
strParams: params + `&start=${start}`,
3438
});
3539

3640
results.push(...elements);

components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,32 @@ import linkedin from "../../linkedin.app.mjs";
33
export default {
44
key: "linkedin-get-organization-administrators",
55
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.0",
88
type: "action",
99
props: {
1010
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: {
1712
propDefinition: [
1813
linkedin,
19-
"max",
14+
"organizationId",
2015
],
16+
description: "The ID of the organization for which administrators are being retrieved",
2117
},
2218
},
2319
async run({ $ }) {
2420
let start = 0;
2521
const count = 50;
2622
const results = [];
2723

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}`;
2927

3028
let done = false;
3129
do {
3230
const { data: { elements } } = await this.linkedin.getAccessControl({
33-
params: params + `&start=${start}`,
31+
strParams: params + `&start=${start}`,
3432
});
3533

3634
results.push(...elements);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.1",
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+
};

components/linkedin/linkedin.app.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,14 @@ export default {
234234
...args,
235235
});
236236
},
237-
async getAccessControl({ params }) {
237+
async getAccessControl({
238+
strParams, ...args
239+
}) {
238240
return this._makeRequestAxios({
239-
path: `/organizationAcls?${params}`,
241+
path: `/organizationAcls${strParams
242+
? `?${strParams}`
243+
: ""}`,
244+
...args,
240245
});
241246
},
242247
async queryAnaltyics(query, args = {} ) {

components/linkedin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/linkedin",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"description": "Pipedream Linkedin Components",
55
"main": "linkedin.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)