@taskmagic/apps-smartlead 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 ADDED
@@ -0,0 +1,7 @@
1
+ # apps-smartlead
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build apps-smartlead` to build the library.
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@taskmagic/apps-smartlead",
3
+ "version": "0.0.1",
4
+ "dependencies": {
5
+ "@anthropic-ai/sdk": "0.33.1",
6
+ "@sinclair/typebox": "0.34.11",
7
+ "axios": "1.17.0",
8
+ "axios-retry": "4.4.1",
9
+ "deepmerge-ts": "7.1.0",
10
+ "mime-types": "2.1.35",
11
+ "nanoid": "3.3.8",
12
+ "openai": "4.67.1",
13
+ "replicate": "0.34.1",
14
+ "semver": "7.6.0",
15
+ "zod": "3.25.76",
16
+ "@taskmagic/pieces-common": "0.4.4",
17
+ "@taskmagic/pieces-framework": "0.7.46",
18
+ "@taskmagic/shared": "0.10.171",
19
+ "tslib": "1.14.1"
20
+ },
21
+ "overrides": {
22
+ "cross-spawn": "7.0.6",
23
+ "elliptic": "^6.6.1",
24
+ "fast-xml-parser": "^4.4.1",
25
+ "protobufjs": "^7.5.5",
26
+ "tmp": "^0.2.4",
27
+ "koa": "^2.16.4",
28
+ "picomatch": "^4.0.4",
29
+ "langsmith": "^0.6.0",
30
+ "serialize-javascript": "^6.0.2",
31
+ "elevenlabs": {
32
+ "form-data": "^4.0.4"
33
+ },
34
+ "@tryfabric/martian": {
35
+ "@notionhq/client": "$@notionhq/client"
36
+ },
37
+ "vite": {
38
+ "rollup": "npm:@rollup/wasm-node@^4.61.1"
39
+ }
40
+ },
41
+ "resolutions": {
42
+ "rollup": "npm:@rollup/wasm-node@^4.61.1"
43
+ },
44
+ "types": "./src/index.d.ts",
45
+ "main": "./src/index.js",
46
+ "type": "commonjs"
47
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const smartlead: import("@taskmagic/pieces-framework").Piece<import("@taskmagic/pieces-framework").SecretTextProperty<true>>;
package/src/index.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.smartlead = void 0;
4
+ const pieces_framework_1 = require("@taskmagic/pieces-framework");
5
+ const shared_1 = require("@taskmagic/shared");
6
+ const pieces_common_1 = require("@taskmagic/pieces-common");
7
+ const auth_1 = require("./lib/auth");
8
+ const client_1 = require("./lib/common/client");
9
+ const create_campaign_1 = require("./lib/actions/create-campaign");
10
+ const add_leads_to_campaign_1 = require("./lib/actions/add-leads-to-campaign");
11
+ const get_campaign_statistics_1 = require("./lib/actions/get-campaign-statistics");
12
+ const update_campaign_settings_1 = require("./lib/actions/update-campaign-settings");
13
+ exports.smartlead = (0, pieces_framework_1.createPiece)({
14
+ displayName: 'SmartLead',
15
+ description: 'Powerful cold email outreach platform with multi-account rotation, email warmup, unified inbox, and advanced analytics.',
16
+ auth: auth_1.smartleadAuth,
17
+ minimumSupportedRelease: '0.30.0',
18
+ logoUrl: 'https://cdn.activepieces.com/pieces/smartlead.png',
19
+ categories: [shared_1.PieceCategory.MARKETING, shared_1.PieceCategory.SALES_AND_CRM],
20
+ authors: ['Harmatta'],
21
+ actions: [
22
+ create_campaign_1.createCampaignAction,
23
+ add_leads_to_campaign_1.addLeadsToCampaignAction,
24
+ get_campaign_statistics_1.getCampaignStatisticsAction,
25
+ update_campaign_settings_1.updateCampaignSettingsAction,
26
+ (0, pieces_common_1.createCustomApiCallAction)({
27
+ auth: auth_1.smartleadAuth,
28
+ baseUrl: () => client_1.BASE_URL,
29
+ }),
30
+ ],
31
+ triggers: [],
32
+ });
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/smartlead/src/index.ts"],"names":[],"mappings":";;;AAAA,kEAA0D;AAC1D,8CAAkD;AAClD,4DAAqE;AAErE,qCAA2C;AAC3C,gDAA+C;AAC/C,mEAAqE;AACrE,+EAA+E;AAC/E,mFAAoF;AACpF,qFAAsF;AAEzE,QAAA,SAAS,GAAG,IAAA,8BAAW,EAAC;IACnC,WAAW,EAAE,WAAW;IACxB,WAAW,EACT,yHAAyH;IAC3H,IAAI,EAAE,oBAAa;IACnB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,mDAAmD;IAC5D,UAAU,EAAE,CAAC,sBAAa,CAAC,SAAS,EAAE,sBAAa,CAAC,aAAa,CAAC;IAClE,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,OAAO,EAAE;QACP,sCAAoB;QACpB,gDAAwB;QACxB,qDAA2B;QAC3B,uDAA4B;QAC5B,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,oBAAa;YACnB,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAQ;SACxB,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const addLeadsToCampaignAction: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
2
+ campaign_id: import("@taskmagic/pieces-framework").NumberProperty<true>;
3
+ lead_list: import("@taskmagic/pieces-framework").JsonProperty<true>;
4
+ ignore_global_block_list: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
5
+ ignore_unsubscribe_list: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
6
+ ignore_duplicate_leads_in_other_campaign: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
7
+ ignore_community_bounce_list: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
8
+ }>;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addLeadsToCampaignAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@taskmagic/pieces-framework");
6
+ const pieces_common_1 = require("@taskmagic/pieces-common");
7
+ const client_1 = require("../common/client");
8
+ const auth_1 = require("../auth");
9
+ exports.addLeadsToCampaignAction = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.smartleadAuth,
11
+ name: 'add_leads_to_campaign',
12
+ displayName: 'Add Leads to Campaign',
13
+ description: 'Add one or more leads to a campaign with validation and deduplication. Maximum 400 leads per request.',
14
+ props: {
15
+ campaign_id: pieces_framework_1.Property.Number({
16
+ displayName: 'Campaign ID',
17
+ description: 'The ID of the campaign to add leads to',
18
+ required: true,
19
+ }),
20
+ lead_list: pieces_framework_1.Property.Json({
21
+ displayName: 'Lead List',
22
+ description: `Array of lead objects. Each lead must have an "email" field. Optional fields: first_name, last_name, phone_number, company_name, website, location, linkedin_profile, company_url, custom_fields (object).
23
+
24
+ Example:
25
+ \`\`\`json
26
+ [
27
+ {
28
+ "email": "john@example.com",
29
+ "first_name": "John",
30
+ "last_name": "Doe",
31
+ "company_name": "Acme Corp",
32
+ "custom_fields": { "job_title": "CEO" }
33
+ }
34
+ ]
35
+ \`\`\``,
36
+ required: true,
37
+ }),
38
+ ignore_global_block_list: pieces_framework_1.Property.Checkbox({
39
+ displayName: 'Ignore Global Block List',
40
+ description: 'Skip global block list validation',
41
+ required: false,
42
+ defaultValue: false,
43
+ }),
44
+ ignore_unsubscribe_list: pieces_framework_1.Property.Checkbox({
45
+ displayName: 'Ignore Unsubscribe List',
46
+ description: 'Include previously unsubscribed leads',
47
+ required: false,
48
+ defaultValue: false,
49
+ }),
50
+ ignore_duplicate_leads_in_other_campaign: pieces_framework_1.Property.Checkbox({
51
+ displayName: 'Ignore Duplicates in Other Campaigns',
52
+ description: 'Allow the same lead in multiple campaigns',
53
+ required: false,
54
+ defaultValue: false,
55
+ }),
56
+ ignore_community_bounce_list: pieces_framework_1.Property.Checkbox({
57
+ displayName: 'Ignore Community Bounce List',
58
+ description: 'Skip community bounce list check',
59
+ required: false,
60
+ defaultValue: false,
61
+ }),
62
+ },
63
+ run(context) {
64
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
65
+ const { campaign_id, lead_list, ignore_global_block_list, ignore_unsubscribe_list, ignore_duplicate_leads_in_other_campaign, ignore_community_bounce_list, } = context.propsValue;
66
+ const apiKey = context.auth;
67
+ const leads = typeof lead_list === 'string'
68
+ ? JSON.parse(lead_list)
69
+ : lead_list;
70
+ if (!Array.isArray(leads)) {
71
+ throw new Error('lead_list must be a JSON array of lead objects with at least an "email" field');
72
+ }
73
+ if (leads.length === 0) {
74
+ throw new Error('lead_list must contain at least one lead.');
75
+ }
76
+ if (leads.length > 400) {
77
+ throw new Error(`Maximum 400 leads per request. Got ${leads.length}. Split into multiple requests.`);
78
+ }
79
+ for (let i = 0; i < leads.length; i++) {
80
+ if (!leads[i].email || typeof leads[i].email !== 'string') {
81
+ throw new Error(`Lead at index ${i} is missing a required "email" field.`);
82
+ }
83
+ }
84
+ const body = {
85
+ lead_list: leads,
86
+ };
87
+ const settings = {};
88
+ if (ignore_global_block_list)
89
+ settings['ignore_global_block_list'] = true;
90
+ if (ignore_unsubscribe_list)
91
+ settings['ignore_unsubscribe_list'] = true;
92
+ if (ignore_duplicate_leads_in_other_campaign)
93
+ settings['ignore_duplicate_leads_in_other_campaign'] = true;
94
+ if (ignore_community_bounce_list)
95
+ settings['ignore_community_bounce_list'] = true;
96
+ if (Object.keys(settings).length > 0) {
97
+ body['settings'] = settings;
98
+ }
99
+ return yield (0, client_1.smartleadRequest)({
100
+ endpoint: `campaigns/${campaign_id}/leads`,
101
+ method: pieces_common_1.HttpMethod.POST,
102
+ apiKey,
103
+ body,
104
+ });
105
+ });
106
+ },
107
+ });
108
+ //# sourceMappingURL=add-leads-to-campaign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-leads-to-campaign.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/smartlead/src/lib/actions/add-leads-to-campaign.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAsD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CAA0C,CAAC,GAAG,IAAI,CAAC;YAC9D,IAAI,4BAA4B;gBAC9B,QAAQ,CAAC,8BAA8B,CAAC,GAAG,IAAI,CAAC;YAElD,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrC,IAAI,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;YAC9B,CAAC;YAED,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,QAAQ,EAAE,aAAa,WAAW,QAAQ;gBAC1C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,MAAM;gBACN,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const createCampaignAction: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
2
+ name: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
3
+ client_id: import("@taskmagic/pieces-framework").NumberProperty<false>;
4
+ }>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCampaignAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@taskmagic/pieces-framework");
6
+ const pieces_common_1 = require("@taskmagic/pieces-common");
7
+ const client_1 = require("../common/client");
8
+ const auth_1 = require("../auth");
9
+ exports.createCampaignAction = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.smartleadAuth,
11
+ name: 'create_campaign',
12
+ displayName: 'Create Campaign',
13
+ description: 'Create a new cold email campaign in SmartLead',
14
+ props: {
15
+ name: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Campaign Name',
17
+ description: 'Name of the campaign. Defaults to "Untitled Campaign" if not provided.',
18
+ required: true,
19
+ }),
20
+ client_id: pieces_framework_1.Property.Number({
21
+ displayName: 'Client ID',
22
+ description: 'Associate the campaign with a specific client (for agency/white-label accounts). Leave empty to use your default.',
23
+ required: false,
24
+ }),
25
+ },
26
+ run(context) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ const { name, client_id } = context.propsValue;
29
+ const apiKey = context.auth;
30
+ const body = { name };
31
+ if (client_id !== undefined && client_id !== null) {
32
+ body['client_id'] = client_id;
33
+ }
34
+ return yield (0, client_1.smartleadRequest)({
35
+ endpoint: 'campaigns/create',
36
+ method: pieces_common_1.HttpMethod.POST,
37
+ apiKey,
38
+ body,
39
+ });
40
+ });
41
+ },
42
+ });
43
+ //# sourceMappingURL=create-campaign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-campaign.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/smartlead/src/lib/actions/create-campaign.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAsD;AACtD,6CAAoD;AACpD,kCAAwC;AAE3B,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,+CAA+C;IAC5D,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,eAAe;YAC5B,WAAW,EACT,wEAAwE;YAC1E,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACzB,WAAW,EAAE,WAAW;YACxB,WAAW,EACT,mHAAmH;YACrH,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAc,CAAC;YAEtC,MAAM,IAAI,GAA4B,EAAE,IAAI,EAAE,CAAC;YAC/C,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;gBAClD,IAAI,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;YAChC,CAAC;YAED,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,QAAQ,EAAE,kBAAkB;gBAC5B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,MAAM;gBACN,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const getCampaignStatisticsAction: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
2
+ campaign_id: import("@taskmagic/pieces-framework").NumberProperty<true>;
3
+ }>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCampaignStatisticsAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@taskmagic/pieces-framework");
6
+ const pieces_common_1 = require("@taskmagic/pieces-common");
7
+ const client_1 = require("../common/client");
8
+ const auth_1 = require("../auth");
9
+ exports.getCampaignStatisticsAction = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.smartleadAuth,
11
+ name: 'get_campaign_statistics',
12
+ displayName: 'Get Campaign Statistics',
13
+ description: 'Retrieve comprehensive analytics for a campaign including open rates, click rates, reply rates, and engagement statistics.',
14
+ props: {
15
+ campaign_id: pieces_framework_1.Property.Number({
16
+ displayName: 'Campaign ID',
17
+ description: 'The ID of the campaign to get statistics for',
18
+ required: true,
19
+ }),
20
+ },
21
+ run(context) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ const { campaign_id } = context.propsValue;
24
+ const apiKey = context.auth;
25
+ return yield (0, client_1.smartleadRequest)({
26
+ endpoint: `campaigns/${campaign_id}/analytics`,
27
+ method: pieces_common_1.HttpMethod.GET,
28
+ apiKey,
29
+ });
30
+ });
31
+ },
32
+ });
33
+ //# sourceMappingURL=get-campaign-statistics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-campaign-statistics.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/smartlead/src/lib/actions/get-campaign-statistics.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAsD;AACtD,6CAAoD;AACpD,kCAAwC;AAE3B,QAAA,2BAA2B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,yBAAyB;IACtC,WAAW,EACT,4HAA4H;IAC9H,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC3B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,8CAA8C;YAC3D,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAc,CAAC;YAEtC,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,QAAQ,EAAE,aAAa,WAAW,YAAY;gBAC9C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,MAAM;aACP,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const updateCampaignSettingsAction: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
2
+ campaign_id: import("@taskmagic/pieces-framework").NumberProperty<true>;
3
+ track_open: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
4
+ track_click: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
5
+ stop_lead_settings: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
6
+ unsubscribe_text: import("@taskmagic/pieces-framework").LongTextProperty<false>;
7
+ enable_ai_esp_matching: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
8
+ send_as_plain_text: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
9
+ follow_up_percentage: import("@taskmagic/pieces-framework").NumberProperty<false>;
10
+ }>;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateCampaignSettingsAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@taskmagic/pieces-framework");
6
+ const pieces_common_1 = require("@taskmagic/pieces-common");
7
+ const client_1 = require("../common/client");
8
+ const auth_1 = require("../auth");
9
+ exports.updateCampaignSettingsAction = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.smartleadAuth,
11
+ name: 'update_campaign_settings',
12
+ displayName: 'Update Campaign Settings',
13
+ description: 'Update campaign settings including tracking, stop conditions, and deliverability options.',
14
+ props: {
15
+ campaign_id: pieces_framework_1.Property.Number({
16
+ displayName: 'Campaign ID',
17
+ description: 'The ID of the campaign to update',
18
+ required: true,
19
+ }),
20
+ track_open: pieces_framework_1.Property.Checkbox({
21
+ displayName: 'Track Opens',
22
+ description: 'Enable email open tracking',
23
+ required: false,
24
+ }),
25
+ track_click: pieces_framework_1.Property.Checkbox({
26
+ displayName: 'Track Clicks',
27
+ description: 'Enable link click tracking',
28
+ required: false,
29
+ }),
30
+ stop_lead_settings: pieces_framework_1.Property.StaticDropdown({
31
+ displayName: 'Stop Lead Condition',
32
+ description: 'When to stop emailing a lead',
33
+ required: false,
34
+ options: {
35
+ options: [
36
+ { label: 'Reply to an email', value: 'REPLY_TO_AN_EMAIL' },
37
+ { label: 'Opened email', value: 'OPENED_EMAIL' },
38
+ { label: 'Clicked link', value: 'CLICKED_LINK' },
39
+ ],
40
+ },
41
+ }),
42
+ unsubscribe_text: pieces_framework_1.Property.LongText({
43
+ displayName: 'Unsubscribe Text',
44
+ description: 'Custom unsubscribe text added to campaign emails',
45
+ required: false,
46
+ }),
47
+ enable_ai_esp_matching: pieces_framework_1.Property.Checkbox({
48
+ displayName: 'Enable AI ESP Matching',
49
+ description: 'Use AI to intelligently pair leads with optimal email accounts',
50
+ required: false,
51
+ }),
52
+ send_as_plain_text: pieces_framework_1.Property.Checkbox({
53
+ displayName: 'Send as Plain Text',
54
+ description: 'Send emails as plain text for better deliverability with technical audiences',
55
+ required: false,
56
+ }),
57
+ follow_up_percentage: pieces_framework_1.Property.Number({
58
+ displayName: 'Follow Up Percentage',
59
+ description: 'Percentage of leads to follow up with (0-100)',
60
+ required: false,
61
+ }),
62
+ },
63
+ run(context) {
64
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
65
+ const { campaign_id, track_open, track_click, stop_lead_settings, unsubscribe_text, enable_ai_esp_matching, send_as_plain_text, follow_up_percentage, } = context.propsValue;
66
+ const apiKey = context.auth;
67
+ const body = {};
68
+ if (track_open !== undefined || track_click !== undefined) {
69
+ body['track_settings'] = Object.assign(Object.assign({}, (track_open !== undefined && { track_open })), (track_click !== undefined && { track_click }));
70
+ }
71
+ if (stop_lead_settings !== undefined)
72
+ body['stop_lead_settings'] = stop_lead_settings;
73
+ if (unsubscribe_text !== undefined && unsubscribe_text !== '')
74
+ body['unsubscribe_text'] = unsubscribe_text;
75
+ if (enable_ai_esp_matching !== undefined)
76
+ body['enable_ai_esp_matching'] = enable_ai_esp_matching;
77
+ if (send_as_plain_text !== undefined)
78
+ body['send_as_plain_text'] = send_as_plain_text;
79
+ if (follow_up_percentage !== undefined) {
80
+ if (follow_up_percentage < 0 || follow_up_percentage > 100) {
81
+ throw new Error(`follow_up_percentage must be between 0 and 100. Got ${follow_up_percentage}.`);
82
+ }
83
+ body['follow_up_percentage'] = follow_up_percentage;
84
+ }
85
+ if (Object.keys(body).length === 0) {
86
+ throw new Error('At least one setting must be provided to update.');
87
+ }
88
+ return yield (0, client_1.smartleadRequest)({
89
+ endpoint: `campaigns/${campaign_id}/settings`,
90
+ method: pieces_common_1.HttpMethod.POST,
91
+ apiKey,
92
+ body,
93
+ });
94
+ });
95
+ },
96
+ });
97
+ //# sourceMappingURL=update-campaign-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-campaign-settings.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/smartlead/src/lib/actions/update-campaign-settings.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAsD;AACtD,6CAAoD;AACpD,kCAAwC;AAE3B,QAAA,4BAA4B,GAAG,IAAA,+BAAY,EAAC;IACvD,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EACT,2FAA2F;IAC7F,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC3B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC5B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,kBAAkB,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC1C,WAAW,EAAE,qBAAqB;YAClC,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,mBAAmB,EAAE;oBAC1D,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE;oBAChD,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE;iBACjD;aACF;SACF,CAAC;QACF,gBAAgB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAClC,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EAAE,kDAAkD;YAC/D,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sB,CAAC;YAC1D,IAAI,kBAAkB,KAAK,SAAS;gBAClC,IAAI,CAAC,oBAAoB,CAAC,GAAG,kBAAkB,CAAC;YAClD,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;gBACvC,IAAI,oBAAoB,GAAG,CAAC,IAAI,oBAAoB,GAAG,GAAG,EAAE,CAAC;oBAC3D,MAAM,IAAI,KAAK,CACb,uDAAuD,oBAAoB,GAAG,CAC/E,CAAC;gBACJ,CAAC;gBACD,IAAI,CAAC,sBAAsB,CAAC,GAAG,oBAAoB,CAAC;YACtD,CAAC;YAED,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACnC,MAAM,IAAI,KAAK,CACb,kDAAkD,CACnD,CAAC;YACJ,CAAC;YAED,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,QAAQ,EAAE,aAAa,WAAW,WAAW;gBAC7C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,MAAM;gBACN,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const smartleadAuth: import("@taskmagic/pieces-framework").SecretTextProperty<true>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.smartleadAuth = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@taskmagic/pieces-framework");
6
+ const pieces_common_1 = require("@taskmagic/pieces-common");
7
+ const client_1 = require("./common/client");
8
+ const markdownDescription = `
9
+ To obtain your API key:
10
+ 1. Log in to your SmartLead account
11
+ 2. Go to **Profile -> Settings → API Key **
12
+ 3. Copy your API key
13
+
14
+ The API key is passed as a query parameter to all API requests.
15
+ `;
16
+ exports.smartleadAuth = pieces_framework_1.PieceAuth.SecretText({
17
+ displayName: 'API Key',
18
+ description: markdownDescription,
19
+ required: true,
20
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
21
+ var _b;
22
+ try {
23
+ yield pieces_common_1.httpClient.sendRequest({
24
+ method: pieces_common_1.HttpMethod.GET,
25
+ url: `${client_1.BASE_URL}/campaigns`,
26
+ queryParams: {
27
+ api_key: auth,
28
+ },
29
+ });
30
+ return { valid: true };
31
+ }
32
+ catch (error) {
33
+ const status = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status;
34
+ if (status === 401 || status === 403) {
35
+ return {
36
+ valid: false,
37
+ error: 'Invalid API key. Please check your Smartlead API credentials.',
38
+ };
39
+ }
40
+ throw error;
41
+ }
42
+ }),
43
+ });
44
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/smartlead/src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,kEAAwD;AACxD,4DAAkE;AAClE,4CAA2C;AAE3C,MAAM,mBAAmB,GAAG;;;;;;;CAO3B,CAAC;AAEW,QAAA,aAAa,GAAG,4BAAS,CAAC,UAAU,CAAC;IAChD,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,mBAAmB;IAChC,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,iBAAQ,YAAY;gBAC5B,WAAW,EAAE;oBACX,OAAO,EAAE,IAAc;iBACxB;aACF,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,MAAC,KAA4C,aAA5C,KAAK,uBAAL,KAAK,CAAyC,QAAQ,0CAAE,MAAM,CAAC;YAC/E,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;gBACrC,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,+DAA+D;iBACvE,CAAC;YACJ,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { HttpMethod } from '@taskmagic/pieces-common';
2
+ export declare const BASE_URL = "https://server.smartlead.ai/api/v1";
3
+ export declare function smartleadRequest<T = Record<string, unknown>>({ endpoint, method, apiKey, body, queryParams, }: {
4
+ endpoint: string;
5
+ method: HttpMethod;
6
+ apiKey: string;
7
+ body?: Record<string, unknown>;
8
+ queryParams?: Record<string, string | number | boolean>;
9
+ }): Promise<T>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BASE_URL = void 0;
4
+ exports.smartleadRequest = smartleadRequest;
5
+ const tslib_1 = require("tslib");
6
+ const pieces_common_1 = require("@taskmagic/pieces-common");
7
+ exports.BASE_URL = 'https://server.smartlead.ai/api/v1';
8
+ function smartleadRequest(_a) {
9
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ endpoint, method, apiKey, body, queryParams = {}, }) {
10
+ const allParams = {
11
+ api_key: apiKey,
12
+ };
13
+ for (const [k, value] of Object.entries(queryParams)) {
14
+ if (value !== undefined && value !== null) {
15
+ allParams[k] = String(value);
16
+ }
17
+ }
18
+ const response = yield pieces_common_1.httpClient.sendRequest({
19
+ method,
20
+ url: `${exports.BASE_URL}/${endpoint}`,
21
+ headers: {
22
+ 'Content-Type': 'application/json',
23
+ },
24
+ queryParams: allParams,
25
+ body,
26
+ });
27
+ return response.body;
28
+ });
29
+ }
30
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/smartlead/src/lib/common/client.ts"],"names":[],"mappings":";;;AAIA,4CAkCC;;AAtCD,4DAAkE;AAErD,QAAA,QAAQ,GAAG,oCAAoC,CAAC;AAE7D,SAAsB,gBAAgB;iEAA8B,EAClE,QAAQ,EACR,MAAM,EACN,MAAM,EACN,IAAI,EACJ,WAAW,GAAG,EAAE,GAOjB;QACC,MAAM,SAAS,GAA2B;YACxC,OAAO,EAAE,MAAM;SAChB,CAAC;QAEF,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YACrD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBAC1C,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;YAC5C,MAAM;YACN,GAAG,EAAE,GAAG,gBAAQ,IAAI,QAAQ,EAAE;YAC9B,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,WAAW,EAAE,SAAS;YACtB,IAAI;SACL,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAS,CAAC;IAC5B,CAAC;CAAA"}