@pipedream/linkupapi 0.2.0 → 1.0.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.
- package/actions/connect-account/connect-account.mjs +85 -0
- package/actions/connect-to-profile/connect-to-profile.mjs +36 -33
- package/actions/create-comment/create-comment.mjs +26 -31
- package/actions/get-account-details/get-account-details.mjs +32 -0
- package/actions/get-company-info/get-company-info.mjs +18 -34
- package/actions/get-conversation-messages/get-conversation-messages.mjs +39 -48
- package/actions/get-invitations-status/get-invitations-status.mjs +38 -34
- package/actions/get-profile-info/get-profile-info.mjs +31 -26
- package/actions/list-accounts/list-accounts.mjs +51 -0
- package/actions/list-inbox/list-inbox.mjs +67 -0
- package/actions/search-companies/search-companies.mjs +29 -55
- package/actions/search-profiles/search-profiles.mjs +78 -79
- package/actions/send-message/send-message.mjs +27 -48
- package/actions/verify-code/verify-code.mjs +16 -29
- package/common/constants.mjs +29 -0
- package/linkupapi.app.mjs +140 -64
- package/package.json +1 -1
- package/actions/login/login.mjs +0 -56
- package/common/utils.mjs +0 -9
|
@@ -2,16 +2,22 @@ import app from "../../linkupapi.app.mjs";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
type: "action",
|
|
5
|
+
ai: "optimized",
|
|
5
6
|
key: "linkupapi-verify-code",
|
|
6
7
|
name: "Verify Code",
|
|
7
|
-
description: "
|
|
8
|
-
version: "
|
|
8
|
+
description: "Submit a checkpoint/challenge verification code to complete authentication for a connected account. [See the documentation](https://docs.linkupapi.com/api-reference/v2/accounts/checkpoint)",
|
|
9
|
+
version: "1.0.1",
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
9
15
|
props: {
|
|
10
16
|
app,
|
|
11
|
-
|
|
17
|
+
accountId: {
|
|
12
18
|
propDefinition: [
|
|
13
19
|
app,
|
|
14
|
-
"
|
|
20
|
+
"accountId",
|
|
15
21
|
],
|
|
16
22
|
},
|
|
17
23
|
code: {
|
|
@@ -19,39 +25,20 @@ export default {
|
|
|
19
25
|
app,
|
|
20
26
|
"code",
|
|
21
27
|
],
|
|
28
|
+
optional: true,
|
|
29
|
+
description: "Verification code received via email, SMS, or authenticator app. Required for a `code_challenge`; leave empty for an `app_challenge` (approve the login from the LinkedIn mobile app first).",
|
|
22
30
|
},
|
|
23
|
-
country: {
|
|
24
|
-
propDefinition: [
|
|
25
|
-
app,
|
|
26
|
-
"country",
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
annotations: {
|
|
31
|
-
readOnlyHint: false,
|
|
32
|
-
destructiveHint: false,
|
|
33
|
-
openWorldHint: true,
|
|
34
|
-
idempotentHint: false,
|
|
35
31
|
},
|
|
36
32
|
async run({ $ }) {
|
|
37
|
-
const {
|
|
38
|
-
app,
|
|
39
|
-
email,
|
|
40
|
-
code,
|
|
41
|
-
country,
|
|
42
|
-
} = this;
|
|
43
|
-
|
|
44
|
-
const response = await app.verify({
|
|
33
|
+
const response = await this.app.verifyCheckpoint({
|
|
45
34
|
$,
|
|
46
35
|
data: {
|
|
47
|
-
|
|
48
|
-
code,
|
|
49
|
-
country,
|
|
36
|
+
account_id: this.accountId,
|
|
37
|
+
code: this.code,
|
|
50
38
|
},
|
|
51
39
|
});
|
|
52
40
|
|
|
53
|
-
$.export("$summary",
|
|
54
|
-
|
|
41
|
+
$.export("$summary", `Successfully verified code for account ${this.accountId}`);
|
|
55
42
|
return response;
|
|
56
43
|
},
|
|
57
44
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const BASE_URL = "https://api.linkupapi.com/v2";
|
|
2
|
+
|
|
3
|
+
export const ENDPOINTS = {
|
|
4
|
+
LOGIN: "/login",
|
|
5
|
+
CHECKPOINT: "/checkpoint",
|
|
6
|
+
ACCOUNTS: "/accounts",
|
|
7
|
+
PROFILES: "/profiles",
|
|
8
|
+
MESSAGES: "/messages",
|
|
9
|
+
NETWORK: "/network",
|
|
10
|
+
CONTENT: "/content",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const ACTIONS = {
|
|
14
|
+
GET: "get",
|
|
15
|
+
SEARCH_PEOPLE: "search_people",
|
|
16
|
+
SEARCH_COMPANIES: "search_companies",
|
|
17
|
+
GET_COMPANY: "get_company",
|
|
18
|
+
INVITE: "invite",
|
|
19
|
+
LIST_INVITATIONS: "list_invitations",
|
|
20
|
+
SEND: "send",
|
|
21
|
+
GET_CONVERSATION: "get_conversation",
|
|
22
|
+
LIST_INBOX: "list_inbox",
|
|
23
|
+
COMMENT: "comment",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const DEFAULT_PLATFORM = "linkedin";
|
|
27
|
+
|
|
28
|
+
// Max accounts the List Accounts endpoint returns per page (GET /accounts `limit`).
|
|
29
|
+
export const ACCOUNTS_MAX_PAGE_SIZE = 500;
|
package/linkupapi.app.mjs
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { axios } from "@pipedream/platform";
|
|
2
|
+
import {
|
|
3
|
+
ACTIONS,
|
|
4
|
+
BASE_URL,
|
|
5
|
+
ENDPOINTS,
|
|
6
|
+
} from "./common/constants.mjs";
|
|
2
7
|
|
|
3
8
|
export default {
|
|
4
9
|
type: "app",
|
|
@@ -7,18 +12,20 @@ export default {
|
|
|
7
12
|
email: {
|
|
8
13
|
type: "string",
|
|
9
14
|
label: "Email",
|
|
10
|
-
description: "Email address for LinkedIn account",
|
|
15
|
+
description: "Email address for the LinkedIn account.",
|
|
16
|
+
optional: true,
|
|
11
17
|
},
|
|
12
18
|
password: {
|
|
13
19
|
type: "string",
|
|
14
20
|
label: "Password",
|
|
15
|
-
description: "Password for LinkedIn account",
|
|
21
|
+
description: "Password for the LinkedIn account.",
|
|
16
22
|
secret: true,
|
|
23
|
+
optional: true,
|
|
17
24
|
},
|
|
18
25
|
country: {
|
|
19
26
|
type: "string",
|
|
20
27
|
label: "Country",
|
|
21
|
-
description: "Country code for proxy selection",
|
|
28
|
+
description: "Country code for proxy selection (e.g. `US`, `UK`, `FR`). Defaults to `FR` server-side.",
|
|
22
29
|
optional: true,
|
|
23
30
|
options: [
|
|
24
31
|
"US",
|
|
@@ -34,16 +41,15 @@ export default {
|
|
|
34
41
|
"IN",
|
|
35
42
|
],
|
|
36
43
|
},
|
|
37
|
-
|
|
44
|
+
accountId: {
|
|
38
45
|
type: "string",
|
|
39
|
-
label: "
|
|
40
|
-
description: "
|
|
41
|
-
secret: true,
|
|
46
|
+
label: "Account ID",
|
|
47
|
+
description: "The persistent account identifier (e.g. `acc_abc123`). Run **Connect Account** to create one, or **List Accounts** to look up existing account IDs.",
|
|
42
48
|
},
|
|
43
49
|
code: {
|
|
44
50
|
type: "string",
|
|
45
51
|
label: "Verification Code",
|
|
46
|
-
description: "Verification code received via email",
|
|
52
|
+
description: "Verification code received via email or challenge.",
|
|
47
53
|
},
|
|
48
54
|
linkedinUrl: {
|
|
49
55
|
type: "string",
|
|
@@ -53,35 +59,27 @@ export default {
|
|
|
53
59
|
conversationId: {
|
|
54
60
|
type: "string",
|
|
55
61
|
label: "Conversation ID",
|
|
56
|
-
description: "LinkedIn conversation identifier",
|
|
62
|
+
description: "LinkedIn conversation identifier. Pick from your inbox, or run **List Inbox** to find one.",
|
|
57
63
|
async options({
|
|
58
|
-
prevContext,
|
|
64
|
+
prevContext, accountId,
|
|
59
65
|
}) {
|
|
60
|
-
if (!
|
|
66
|
+
if (!accountId || prevContext?.nextCursor === null) {
|
|
61
67
|
return [];
|
|
62
68
|
}
|
|
63
|
-
const {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
} = await this.getConversations({
|
|
69
|
-
data: {
|
|
70
|
-
login_token: loginToken,
|
|
71
|
-
next_cursor: prevContext?.nextCursor,
|
|
69
|
+
const { data } = await this.listInbox({
|
|
70
|
+
accountId,
|
|
71
|
+
params: {
|
|
72
|
+
cursor: prevContext?.nextCursor,
|
|
72
73
|
},
|
|
73
74
|
});
|
|
75
|
+
const conversations = data?.conversations || [];
|
|
74
76
|
return {
|
|
75
|
-
options: conversations.map(({
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
participant: { name },
|
|
79
|
-
}) => ({
|
|
80
|
-
label: `${name || "Unknown"} - ${text?.substring(0, 50) || "No message"}`,
|
|
81
|
-
value,
|
|
77
|
+
options: conversations.map((conversation) => ({
|
|
78
|
+
label: `${conversation.participant?.name || "Unknown"} - ${conversation.last_message?.text?.slice(0, 50) || "No message"}`,
|
|
79
|
+
value: conversation.conversation_id,
|
|
82
80
|
})),
|
|
83
81
|
context: {
|
|
84
|
-
nextCursor: next_cursor,
|
|
82
|
+
nextCursor: data?.next_cursor || null,
|
|
85
83
|
},
|
|
86
84
|
};
|
|
87
85
|
},
|
|
@@ -89,25 +87,48 @@ export default {
|
|
|
89
87
|
messageText: {
|
|
90
88
|
type: "string",
|
|
91
89
|
label: "Message Text",
|
|
92
|
-
description: "Message content",
|
|
90
|
+
description: "Message content.",
|
|
93
91
|
},
|
|
94
92
|
location: {
|
|
95
93
|
type: "string[]",
|
|
96
94
|
label: "Locations",
|
|
97
|
-
description: "Geographic locations to filter",
|
|
95
|
+
description: "Geographic locations to filter, passed as an array of strings, e.g. `[\"San Francisco, CA\", \"Paris, France\"]`.",
|
|
98
96
|
optional: true,
|
|
99
97
|
},
|
|
100
98
|
companyUrl: {
|
|
101
99
|
type: "string[]",
|
|
102
100
|
label: "Company URLs",
|
|
103
|
-
description: "LinkedIn company URLs. Eg. `https://www.linkedin.com/company/stripe/`",
|
|
101
|
+
description: "LinkedIn company URLs to filter (passed as an array). Eg. `https://www.linkedin.com/company/stripe/`",
|
|
102
|
+
optional: true,
|
|
103
|
+
},
|
|
104
|
+
keyword: {
|
|
105
|
+
type: "string",
|
|
106
|
+
label: "Keyword",
|
|
107
|
+
description: "Free-text keyword to search by.",
|
|
108
|
+
optional: true,
|
|
109
|
+
},
|
|
110
|
+
totalResults: {
|
|
111
|
+
type: "integer",
|
|
112
|
+
label: "Total Results",
|
|
113
|
+
description: "Maximum number of results to return.",
|
|
114
|
+
optional: true,
|
|
115
|
+
min: 1,
|
|
116
|
+
default: 50,
|
|
117
|
+
},
|
|
118
|
+
identifier: {
|
|
119
|
+
type: "string",
|
|
120
|
+
label: "Identifier",
|
|
121
|
+
description: "LinkedIn public identifier (public ID) of the target profile.",
|
|
122
|
+
optional: true,
|
|
123
|
+
},
|
|
124
|
+
profileUrn: {
|
|
125
|
+
type: "string",
|
|
126
|
+
label: "Profile URN",
|
|
127
|
+
description: "LinkedIn profile URN of the target (e.g. `ACoAAB...`).",
|
|
104
128
|
optional: true,
|
|
105
129
|
},
|
|
106
130
|
},
|
|
107
131
|
methods: {
|
|
108
|
-
getUrl(path) {
|
|
109
|
-
return `https://api.linkupapi.com/v1${path}`;
|
|
110
|
-
},
|
|
111
132
|
_getHeaders() {
|
|
112
133
|
return {
|
|
113
134
|
"x-api-key": this.$auth.api_key,
|
|
@@ -119,85 +140,140 @@ export default {
|
|
|
119
140
|
} = {}) {
|
|
120
141
|
return axios($, {
|
|
121
142
|
...opts,
|
|
122
|
-
url:
|
|
143
|
+
url: `${BASE_URL}${path}`,
|
|
123
144
|
headers: this._getHeaders(),
|
|
124
145
|
});
|
|
125
146
|
},
|
|
126
|
-
|
|
147
|
+
_post(opts = {}) {
|
|
127
148
|
return this._makeRequest({
|
|
128
149
|
method: "POST",
|
|
129
150
|
...opts,
|
|
130
151
|
});
|
|
131
152
|
},
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
153
|
+
// Shared wrapper for the V2 action envelope: { account_id, action, params }.
|
|
154
|
+
_action({
|
|
155
|
+
path, action, accountId, params, ...opts
|
|
156
|
+
} = {}) {
|
|
157
|
+
return this._post({
|
|
158
|
+
...opts,
|
|
159
|
+
path,
|
|
160
|
+
data: {
|
|
161
|
+
account_id: accountId,
|
|
162
|
+
action,
|
|
163
|
+
params,
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
},
|
|
167
|
+
async _paginate({
|
|
168
|
+
requestPage, getItems, getNext, max,
|
|
169
|
+
}) {
|
|
170
|
+
const results = [];
|
|
171
|
+
let next;
|
|
172
|
+
let page = [];
|
|
173
|
+
do {
|
|
174
|
+
const response = await requestPage({
|
|
175
|
+
next,
|
|
176
|
+
count: max - results.length,
|
|
177
|
+
});
|
|
178
|
+
page = getItems(response) || [];
|
|
179
|
+
results.push(...page.slice(0, max - results.length));
|
|
180
|
+
next = getNext(response);
|
|
181
|
+
} while (next && page.length && results.length < max);
|
|
182
|
+
return results;
|
|
183
|
+
},
|
|
184
|
+
connectAccount(opts = {}) {
|
|
185
|
+
return this._post({
|
|
186
|
+
path: ENDPOINTS.LOGIN,
|
|
135
187
|
...opts,
|
|
136
188
|
});
|
|
137
189
|
},
|
|
138
|
-
|
|
139
|
-
return this.
|
|
140
|
-
path:
|
|
190
|
+
verifyCheckpoint(opts = {}) {
|
|
191
|
+
return this._post({
|
|
192
|
+
path: ENDPOINTS.CHECKPOINT,
|
|
193
|
+
...opts,
|
|
194
|
+
});
|
|
195
|
+
},
|
|
196
|
+
listAccounts(opts = {}) {
|
|
197
|
+
return this._makeRequest({
|
|
198
|
+
path: ENDPOINTS.ACCOUNTS,
|
|
199
|
+
...opts,
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
getAccountDetails({
|
|
203
|
+
accountId, ...opts
|
|
204
|
+
} = {}) {
|
|
205
|
+
return this._makeRequest({
|
|
206
|
+
path: `${ENDPOINTS.ACCOUNTS}/${encodeURIComponent(accountId)}`,
|
|
141
207
|
...opts,
|
|
142
208
|
});
|
|
143
209
|
},
|
|
144
210
|
getProfileInfo(opts = {}) {
|
|
145
|
-
return this.
|
|
146
|
-
path:
|
|
211
|
+
return this._action({
|
|
212
|
+
path: ENDPOINTS.PROFILES,
|
|
213
|
+
action: ACTIONS.GET,
|
|
147
214
|
...opts,
|
|
148
215
|
});
|
|
149
216
|
},
|
|
150
217
|
searchProfiles(opts = {}) {
|
|
151
|
-
return this.
|
|
152
|
-
path:
|
|
218
|
+
return this._action({
|
|
219
|
+
path: ENDPOINTS.PROFILES,
|
|
220
|
+
action: ACTIONS.SEARCH_PEOPLE,
|
|
153
221
|
...opts,
|
|
154
222
|
});
|
|
155
223
|
},
|
|
156
224
|
searchCompanies(opts = {}) {
|
|
157
|
-
return this.
|
|
158
|
-
path:
|
|
225
|
+
return this._action({
|
|
226
|
+
path: ENDPOINTS.PROFILES,
|
|
227
|
+
action: ACTIONS.SEARCH_COMPANIES,
|
|
159
228
|
...opts,
|
|
160
229
|
});
|
|
161
230
|
},
|
|
162
231
|
getCompanyInfo(opts = {}) {
|
|
163
|
-
return this.
|
|
164
|
-
path:
|
|
232
|
+
return this._action({
|
|
233
|
+
path: ENDPOINTS.PROFILES,
|
|
234
|
+
action: ACTIONS.GET_COMPANY,
|
|
165
235
|
...opts,
|
|
166
236
|
});
|
|
167
237
|
},
|
|
168
238
|
connectToProfile(opts = {}) {
|
|
169
|
-
return this.
|
|
170
|
-
path:
|
|
239
|
+
return this._action({
|
|
240
|
+
path: ENDPOINTS.NETWORK,
|
|
241
|
+
action: ACTIONS.INVITE,
|
|
171
242
|
...opts,
|
|
172
243
|
});
|
|
173
244
|
},
|
|
174
|
-
|
|
175
|
-
return this.
|
|
176
|
-
path:
|
|
245
|
+
getInvitations(opts = {}) {
|
|
246
|
+
return this._action({
|
|
247
|
+
path: ENDPOINTS.NETWORK,
|
|
248
|
+
action: ACTIONS.LIST_INVITATIONS,
|
|
177
249
|
...opts,
|
|
178
250
|
});
|
|
179
251
|
},
|
|
180
252
|
sendMessage(opts = {}) {
|
|
181
|
-
return this.
|
|
182
|
-
path:
|
|
253
|
+
return this._action({
|
|
254
|
+
path: ENDPOINTS.MESSAGES,
|
|
255
|
+
action: ACTIONS.SEND,
|
|
183
256
|
...opts,
|
|
184
257
|
});
|
|
185
258
|
},
|
|
186
259
|
getConversationMessages(opts = {}) {
|
|
187
|
-
return this.
|
|
188
|
-
path:
|
|
260
|
+
return this._action({
|
|
261
|
+
path: ENDPOINTS.MESSAGES,
|
|
262
|
+
action: ACTIONS.GET_CONVERSATION,
|
|
189
263
|
...opts,
|
|
190
264
|
});
|
|
191
265
|
},
|
|
192
|
-
|
|
193
|
-
return this.
|
|
194
|
-
path:
|
|
266
|
+
listInbox(opts = {}) {
|
|
267
|
+
return this._action({
|
|
268
|
+
path: ENDPOINTS.MESSAGES,
|
|
269
|
+
action: ACTIONS.LIST_INBOX,
|
|
195
270
|
...opts,
|
|
196
271
|
});
|
|
197
272
|
},
|
|
198
273
|
createComment(opts = {}) {
|
|
199
|
-
return this.
|
|
200
|
-
path:
|
|
274
|
+
return this._action({
|
|
275
|
+
path: ENDPOINTS.CONTENT,
|
|
276
|
+
action: ACTIONS.COMMENT,
|
|
201
277
|
...opts,
|
|
202
278
|
});
|
|
203
279
|
},
|
package/package.json
CHANGED
package/actions/login/login.mjs
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import app from "../../linkupapi.app.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
type: "action",
|
|
5
|
-
key: "linkupapi-login",
|
|
6
|
-
name: "Login",
|
|
7
|
-
description: "Authenticate with LinkedIn credentials. [See the documentation](https://docs.linkupapi.com/api-reference/linkup/authentication/login)",
|
|
8
|
-
version: "0.0.2",
|
|
9
|
-
props: {
|
|
10
|
-
app,
|
|
11
|
-
email: {
|
|
12
|
-
propDefinition: [
|
|
13
|
-
app,
|
|
14
|
-
"email",
|
|
15
|
-
],
|
|
16
|
-
},
|
|
17
|
-
password: {
|
|
18
|
-
propDefinition: [
|
|
19
|
-
app,
|
|
20
|
-
"password",
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
country: {
|
|
24
|
-
propDefinition: [
|
|
25
|
-
app,
|
|
26
|
-
"country",
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
annotations: {
|
|
31
|
-
readOnlyHint: false,
|
|
32
|
-
destructiveHint: false,
|
|
33
|
-
openWorldHint: true,
|
|
34
|
-
},
|
|
35
|
-
async run({ $ }) {
|
|
36
|
-
const {
|
|
37
|
-
app,
|
|
38
|
-
email,
|
|
39
|
-
password,
|
|
40
|
-
country,
|
|
41
|
-
} = this;
|
|
42
|
-
|
|
43
|
-
const response = await app.login({
|
|
44
|
-
$,
|
|
45
|
-
data: {
|
|
46
|
-
email,
|
|
47
|
-
password,
|
|
48
|
-
country,
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
$.export("$summary", "Successfully authenticated with LinkedIn account");
|
|
53
|
-
|
|
54
|
-
return response;
|
|
55
|
-
},
|
|
56
|
-
};
|