@activepieces/piece-phantombuster 0.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/README.md +7 -0
- package/package.json +25 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +36 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/launch-phantom.d.ts +6 -0
- package/src/lib/actions/launch-phantom.js +77 -0
- package/src/lib/actions/launch-phantom.js.map +1 -0
- package/src/lib/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +31 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +3 -0
- package/src/lib/common/client.js +28 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/props.d.ts +1 -0
- package/src/lib/common/props.js +31 -0
- package/src/lib/common/props.js.map +1 -0
- package/src/lib/triggers/new-output.d.ts +11 -0
- package/src/lib/triggers/new-output.js +83 -0
- package/src/lib/triggers/new-output.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-phantombuster",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@sinclair/typebox": "0.34.11",
|
|
9
|
+
"axios": "1.8.3",
|
|
10
|
+
"axios-retry": "4.4.1",
|
|
11
|
+
"deepmerge-ts": "7.1.0",
|
|
12
|
+
"mime-types": "2.1.35",
|
|
13
|
+
"nanoid": "3.3.8",
|
|
14
|
+
"semver": "7.6.0",
|
|
15
|
+
"socket.io-client": "4.8.1",
|
|
16
|
+
"tslib": "^2.3.0",
|
|
17
|
+
"zod": "3.25.76",
|
|
18
|
+
"@activepieces/pieces-common": "0.8.1",
|
|
19
|
+
"@activepieces/pieces-framework": "0.20.2",
|
|
20
|
+
"@activepieces/shared": "0.26.0"
|
|
21
|
+
},
|
|
22
|
+
"resolutions": {
|
|
23
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const phantombuster: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.phantombuster = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const launch_phantom_1 = require("./lib/actions/launch-phantom");
|
|
7
|
+
const auth_1 = require("./lib/common/auth");
|
|
8
|
+
const new_output_1 = require("./lib/triggers/new-output");
|
|
9
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
10
|
+
const client_1 = require("./lib/common/client");
|
|
11
|
+
const shared_1 = require("@activepieces/shared");
|
|
12
|
+
exports.phantombuster = (0, pieces_framework_1.createPiece)({
|
|
13
|
+
displayName: 'PhantomBuster',
|
|
14
|
+
auth: auth_1.phantombusterAuth,
|
|
15
|
+
minimumSupportedRelease: '0.36.1',
|
|
16
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/phantombuster.png',
|
|
17
|
+
description: 'Automate your web scraping and web automation tasks',
|
|
18
|
+
categories: [shared_1.PieceCategory.MARKETING, shared_1.PieceCategory.SALES_AND_CRM],
|
|
19
|
+
authors: ['sanket-a11y'],
|
|
20
|
+
actions: [
|
|
21
|
+
launch_phantom_1.launchPhantom,
|
|
22
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
23
|
+
auth: auth_1.phantombusterAuth,
|
|
24
|
+
baseUrl: () => client_1.BASE_URL,
|
|
25
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
const apiKey = auth;
|
|
27
|
+
return {
|
|
28
|
+
'X-Phantombuster-Key': `${apiKey}`,
|
|
29
|
+
'Content-Type': 'application/json',
|
|
30
|
+
};
|
|
31
|
+
}),
|
|
32
|
+
}),
|
|
33
|
+
],
|
|
34
|
+
triggers: [new_output_1.newOutput],
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/phantombuster/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,iEAA6D;AAC7D,4CAAsD;AACtD,0DAAsD;AACtD,+DAAwE;AACxE,gDAA+C;AAC/C,iDAAqD;AAExC,QAAA,aAAa,GAAG,IAAA,8BAAW,EAAC;IACvC,WAAW,EAAE,eAAe;IAC5B,IAAI,EAAE,wBAAiB;IACvB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,uDAAuD;IAChE,WAAW,EAAE,qDAAqD;IAClE,UAAU,EAAE,CAAC,sBAAa,CAAC,SAAS,EAAE,sBAAa,CAAC,aAAa,CAAC;IAClE,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,OAAO,EAAE;QACP,8BAAa;QACb,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,wBAAiB;YACvB,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAQ;YACvB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,MAAM,MAAM,GAAG,IAAI,CAAC;gBACpB,OAAO;oBACL,qBAAqB,EAAE,GAAG,MAAgB,EAAE;oBAC5C,cAAc,EAAE,kBAAkB;iBACnC,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,CAAC,sBAAS,CAAC;CACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const launchPhantom: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
agentId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
3
|
+
waitForOutput: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
4
|
+
argument: import("@activepieces/pieces-framework").ObjectProperty<false>;
|
|
5
|
+
maxRetries: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.launchPhantom = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
exports.launchPhantom = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.phantombusterAuth,
|
|
12
|
+
name: 'launchPhantom',
|
|
13
|
+
displayName: 'Launch Phantom',
|
|
14
|
+
description: 'Launch a Phantombuster agent and add it to the execution queue',
|
|
15
|
+
props: {
|
|
16
|
+
agentId: props_1.agentIdDropdown,
|
|
17
|
+
waitForOutput: pieces_framework_1.Property.Checkbox({
|
|
18
|
+
displayName: 'Wait for Output',
|
|
19
|
+
description: 'Wait until the agent execution completes and output is available',
|
|
20
|
+
required: false,
|
|
21
|
+
defaultValue: false,
|
|
22
|
+
}),
|
|
23
|
+
argument: pieces_framework_1.Property.Object({
|
|
24
|
+
displayName: 'Argument',
|
|
25
|
+
description: 'Optional argument to pass to the agent',
|
|
26
|
+
required: false,
|
|
27
|
+
}),
|
|
28
|
+
maxRetries: pieces_framework_1.Property.Number({
|
|
29
|
+
displayName: 'Max Retries',
|
|
30
|
+
description: 'Maximum number of retries if the agent fails',
|
|
31
|
+
required: false,
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
run(context) {
|
|
35
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const body = {
|
|
37
|
+
id: context.propsValue.agentId,
|
|
38
|
+
};
|
|
39
|
+
if (context.propsValue.argument !== undefined) {
|
|
40
|
+
body['argument'] = context.propsValue.argument;
|
|
41
|
+
}
|
|
42
|
+
if (context.propsValue.maxRetries !== undefined) {
|
|
43
|
+
body['maxRetries'] = context.propsValue.maxRetries;
|
|
44
|
+
}
|
|
45
|
+
const launchResponse = yield (0, client_1.makeRequest)(context.auth, pieces_common_1.HttpMethod.POST, '/agents/launch', body);
|
|
46
|
+
if (context.propsValue.waitForOutput) {
|
|
47
|
+
let output = null;
|
|
48
|
+
const pollInterval = 5000; // 5 seconds
|
|
49
|
+
let isCompleted = false;
|
|
50
|
+
while (!isCompleted) {
|
|
51
|
+
try {
|
|
52
|
+
const outputResponse = yield (0, client_1.makeRequest)(context.auth, pieces_common_1.HttpMethod.GET, `/agents/fetch-output?id=${context.propsValue.agentId}`, undefined);
|
|
53
|
+
console.log(outputResponse);
|
|
54
|
+
if (outputResponse) {
|
|
55
|
+
output = outputResponse;
|
|
56
|
+
const status = outputResponse.status;
|
|
57
|
+
if (status === 'finished' ||
|
|
58
|
+
status === 'error' ||
|
|
59
|
+
status === 'unknown') {
|
|
60
|
+
isCompleted = true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
// Continue polling if output is not yet available
|
|
66
|
+
}
|
|
67
|
+
if (!isCompleted) {
|
|
68
|
+
yield new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return output;
|
|
72
|
+
}
|
|
73
|
+
return launchResponse;
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=launch-phantom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch-phantom.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/phantombuster/src/lib/actions/launch-phantom.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAmD;AACnD,6CAA+C;AAC/C,+DAAyD;AACzD,2CAAkD;AAGrC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,wBAAiB;IACvB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,gEAAgE;IAC7E,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe;QACxB,aAAa,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC/B,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EACT,kEAAkE;YACpE,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACxB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,8CAA8C;YAC3D,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,IAAI,GAA4B;gBACpC,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;aAC/B,CAAC;YAEF,IAAI,OAAO,CAAC,UAAU,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC9C,IAAI,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;YACjD,CAAC;YAED,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;gBAChD,IAAI,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC;YACrD,CAAC;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epieces/pieces-framework").SecretTextProperty<true>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.phantombusterAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const client_1 = require("./client");
|
|
8
|
+
const authHelpDescription = `
|
|
9
|
+
1. Login to your Pushbullet Dashboard.
|
|
10
|
+
2. Go to **https://phantombuster.com/workspace-settings**.
|
|
11
|
+
3. change to the **API Keys** tab and **Add API Key**.
|
|
12
|
+
4. Copy the API Key to the clipboard and paste it.
|
|
13
|
+
`;
|
|
14
|
+
exports.phantombusterAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
15
|
+
displayName: 'API Token',
|
|
16
|
+
description: authHelpDescription,
|
|
17
|
+
required: true,
|
|
18
|
+
validate: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
try {
|
|
20
|
+
yield (0, client_1.makeRequest)(auth.auth, pieces_common_1.HttpMethod.GET, '/agents/fetch-all');
|
|
21
|
+
return { valid: true };
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
return {
|
|
25
|
+
valid: false,
|
|
26
|
+
error: 'Invalid API key or insufficient permissions',
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/phantombuster/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAA2D;AAC3D,qCAAuC;AAEvC,MAAM,mBAAmB,GAAG;;;;;CAK3B,CAAC;AAEW,QAAA,iBAAiB,GAAG,4BAAS,CAAC,UAAU,CAAC;IACpD,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,mBAAmB;IAChC,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,CAAO,IAAI,EAAE,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,IAAA,oBAAW,EACf,IAAI,CAAC,IAAc,EACnB,0BAAU,CAAC,GAAG,EACd,mBAAmB,CACpB,CAAC;YACF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,6CAA6C;aACrD,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BASE_URL = void 0;
|
|
4
|
+
exports.makeRequest = makeRequest;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
exports.BASE_URL = `https://api.phantombuster.com/api/v2`;
|
|
8
|
+
function makeRequest(apiKey, method, path, body) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
try {
|
|
11
|
+
console.log(`${exports.BASE_URL}${path}`);
|
|
12
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
13
|
+
method,
|
|
14
|
+
url: `${exports.BASE_URL}${path}`,
|
|
15
|
+
headers: {
|
|
16
|
+
'X-Phantombuster-Key': `${apiKey}`,
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
},
|
|
19
|
+
body,
|
|
20
|
+
});
|
|
21
|
+
return response.body;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
throw new Error(`Unexpected error: ${error.message || String(error)}`);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/phantombuster/src/lib/common/client.ts"],"names":[],"mappings":";;;AAIA,kCAqBC;;AAzBD,+DAAqE;AAExD,QAAA,QAAQ,GAAG,sCAAsC,CAAC;AAE/D,SAAsB,WAAW,CAC/B,MAAc,EACd,MAAkB,EAClB,IAAY,EACZ,IAAc;;QAEd,IAAI,CAAC;YACH,OAAO,CAAC,GAAG,CAAE,GAAG,gBAAQ,GAAG,IAAI,EAAE,CAAC,CAAA;YAClC,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM;gBACN,GAAG,EAAE,GAAG,gBAAQ,GAAG,IAAI,EAAE;gBACzB,OAAO,EAAE;oBACP,qBAAqB,EAAE,GAAG,MAAM,EAAE;oBAClC,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI;aACL,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const agentIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agentIdDropdown = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const client_1 = require("./client");
|
|
7
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
+
exports.agentIdDropdown = pieces_framework_1.Property.Dropdown({
|
|
9
|
+
displayName: 'Agent',
|
|
10
|
+
description: 'Select the Phantombuster agent to use',
|
|
11
|
+
required: true,
|
|
12
|
+
refreshers: [],
|
|
13
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
14
|
+
if (!auth) {
|
|
15
|
+
return {
|
|
16
|
+
disabled: true,
|
|
17
|
+
options: [],
|
|
18
|
+
placeholder: 'Please configure the authentication first',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, '/agents/fetch-all');
|
|
22
|
+
return {
|
|
23
|
+
disabled: false,
|
|
24
|
+
options: response.map((agent) => ({
|
|
25
|
+
label: agent.name + ' ' + agent.createdAt,
|
|
26
|
+
value: agent.id,
|
|
27
|
+
})),
|
|
28
|
+
};
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/phantombuster/src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,qEAA0D;AAC1D,qCAAuC;AACvC,+DAAyD;AAE5C,QAAA,eAAe,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IAC/C,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,uCAAuC;IACpD,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,EAAE;IACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,2CAA2C;aACzD,CAAC;QACJ,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,IAAc,EACd,0BAAU,CAAC,GAAG,EACd,mBAAmB,CACpB,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC;gBACrC,KAAK,EAAE,KAAK,CAAC,IAAI,GAAG,GAAG,GAAG,KAAK,CAAC,SAAS;gBACzC,KAAK,EAAE,KAAK,CAAC,EAAE;aAChB,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const newOutput: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
agentId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
4
|
+
markdown: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
5
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
6
|
+
agentId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
7
|
+
markdown: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
8
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
9
|
+
agentId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
10
|
+
markdown: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newOutput = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
const shared_1 = require("@activepieces/shared");
|
|
9
|
+
exports.newOutput = (0, pieces_framework_1.createTrigger)({
|
|
10
|
+
auth: auth_1.phantombusterAuth,
|
|
11
|
+
name: 'newOutput',
|
|
12
|
+
displayName: 'New Output',
|
|
13
|
+
description: 'Trigger when a new output is generated by a Phantombuster agent ',
|
|
14
|
+
props: {
|
|
15
|
+
agentId: props_1.agentIdDropdown,
|
|
16
|
+
markdown: pieces_framework_1.Property.MarkDown({
|
|
17
|
+
variant: shared_1.MarkdownVariant.INFO,
|
|
18
|
+
value: `## Webhook Configuration
|
|
19
|
+
|
|
20
|
+
To use this trigger, you need to configure a webhook URL in your Phantombuster agent:
|
|
21
|
+
|
|
22
|
+
### Steps to Configure:
|
|
23
|
+
1. Go to your Phantombuster agent page
|
|
24
|
+
2. Click on **Settings**
|
|
25
|
+
3. Select **Advanced Notification Settings**
|
|
26
|
+
4. Input the webhook URL in the webhook field:
|
|
27
|
+
\`\`\`
|
|
28
|
+
{{webhookUrl}}
|
|
29
|
+
\`\`\`
|
|
30
|
+
|
|
31
|
+
### Supported Exit Messages (Status Values):
|
|
32
|
+
- \`finished\` - Agent completed successfully (exitCode: 0)
|
|
33
|
+
- \`killed\` - Agent was killed
|
|
34
|
+
- \`global timeout\` - Global timeout reached
|
|
35
|
+
- \`org timeout\` - Organization timeout reached
|
|
36
|
+
- \`agent timeout\` - Agent timeout reached
|
|
37
|
+
- \`unknown\` - Unknown status
|
|
38
|
+
|
|
39
|
+
### Important Notes:
|
|
40
|
+
- Maximum webhook timeout: 11 seconds
|
|
41
|
+
- Webhooks accept POST requests only
|
|
42
|
+
- Maximum 2 redirections allowed
|
|
43
|
+
- Response body is ignored (you don't need to respond with data)
|
|
44
|
+
|
|
45
|
+
[Learn more about webhooks](https://hub.phantombuster.com/docs/using-webhooks)`,
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
sampleData: {
|
|
49
|
+
agentId: '5027055349780535',
|
|
50
|
+
agentName: 'Test Script',
|
|
51
|
+
containerId: '3358014727012763',
|
|
52
|
+
script: 'test_script_50516785467.js',
|
|
53
|
+
scriptOrg: 'phantombuster',
|
|
54
|
+
branch: 'test-branch-0545107204',
|
|
55
|
+
launchDuration: 121,
|
|
56
|
+
runDuration: 1850,
|
|
57
|
+
resultObject: {},
|
|
58
|
+
exitMessage: 'finished',
|
|
59
|
+
exitCode: 0,
|
|
60
|
+
},
|
|
61
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
62
|
+
onEnable(context) {
|
|
63
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
// implement webhook creation logic
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
onDisable(context) {
|
|
68
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
// implement webhook deletion logic
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
run(context) {
|
|
73
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
const output = context.payload.body;
|
|
75
|
+
console.log(output);
|
|
76
|
+
if (output.agentId != context.propsValue.agentId) {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
return [output];
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=new-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-output.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/phantombuster/src/lib/triggers/new-output.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,yCAAmD;AACnD,2CAAkD;AAClD,iDAAuD;AAE1C,QAAA,SAAS,GAAG,IAAA,gCAAa,EAAC;IACrC,IAAI,EAAE,wBAAiB;IACvB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,YAAY;IACzB,WAAW,EACT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