Skip to content

Commit 381c7b4

Browse files
committed
new components
1 parent 36b5862 commit 381c7b4

File tree

9 files changed

+498
-215
lines changed

9 files changed

+498
-215
lines changed

components/campaign_monitor/actions/add-subscriber/add-subscriber.mjs

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,82 @@ import campaignMonitor from "../../campaign_monitor.app.mjs";
33
export default {
44
key: "campaign_monitor-add-subscriber",
55
name: "Add Subscriber",
6-
description: "Creates a new subscriber on a specific list. [See the documentation](https://www.campaignmonitor.com/api/subscribers/#adding-a-subscriber)",
7-
version: "0.0.{{ts}}",
6+
description: "Creates a new subscriber on a specific list. [See the documentation](https://www.campaignmonitor.com/api/v3-3/subscribers/)",
7+
version: "0.0.1",
88
type: "action",
99
props: {
1010
campaignMonitor,
11-
email: {
11+
clientId: {
1212
propDefinition: [
1313
campaignMonitor,
14-
"email",
14+
"clientId",
1515
],
1616
},
1717
listId: {
1818
propDefinition: [
1919
campaignMonitor,
2020
"listId",
21+
(c) => ({
22+
clientId: c.clientId,
23+
}),
2124
],
2225
},
26+
email: {
27+
type: "string",
28+
label: "Email",
29+
description: "The email address of the subscriber",
30+
},
2331
name: {
32+
type: "string",
33+
label: "Name",
34+
description: "The name of the subscriber",
35+
optional: true,
36+
},
37+
phone: {
38+
type: "string",
39+
label: "Phone",
40+
description: "The phone number of the subscriber. Example: `+5012398752`",
41+
optional: true,
42+
},
43+
consentToTrack: {
2444
propDefinition: [
2545
campaignMonitor,
26-
"name",
46+
"consentToTrack",
47+
],
48+
},
49+
consentToSendSMS: {
50+
type: "string",
51+
label: "Consent to Send SMS",
52+
description: "Indicates if consent has been granted by the subscriber to receive Sms",
53+
options: [
54+
"Yes",
55+
"No",
56+
"Unchanged",
2757
],
58+
default: "Unchanged",
59+
optional: true,
60+
},
61+
resubscribe: {
62+
type: "boolean",
63+
label: "Resubscribe",
64+
description: "Resubscribe if the email address has previously been unsubscribed",
2865
optional: true,
2966
},
3067
},
3168
async run({ $ }) {
32-
const response =
33-
await this.campaignMonitor.createSubscriber(this.email, this.listId, this.name);
34-
$.export("$summary", `Successfully added subscriber ${this.email} to list ${this.listId}`);
69+
const response = await this.campaignMonitor.createSubscriber({
70+
$,
71+
listId: this.listId,
72+
data: {
73+
EmailAddress: this.email,
74+
Name: this.name,
75+
MobileNumber: this.phone,
76+
ConsentToTrack: this.consentToTrack,
77+
ConsentToSendSms: this.consentToSendSMS,
78+
Resubscribe: this.resubscribe,
79+
},
80+
});
81+
$.export("$summary", `Successfully added subscriber ${this.email}`);
3582
return response;
3683
},
3784
};

components/campaign_monitor/actions/send-smart-transactional-email/send-smart-transactional-email.mjs

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,61 @@ import campaignMonitor from "../../campaign_monitor.app.mjs";
33
export default {
44
key: "campaign_monitor-send-smart-transactional-email",
55
name: "Send Smart Transactional Email",
6-
description: "Sends an intelligent transactional email to a specified recipient.",
7-
version: "0.0.{{ts}}",
6+
description: "Sends an intelligent transactional email to a specified recipient. [See the documentation](https://www.campaignmonitor.com/api/v3-3/transactional/#send-smart-email)",
7+
version: "0.0.1",
88
type: "action",
99
props: {
1010
campaignMonitor,
11-
email: {
12-
type: "string",
13-
label: "Email",
14-
description: "The email of the recipient",
11+
clientId: {
12+
propDefinition: [
13+
campaignMonitor,
14+
"clientId",
15+
],
16+
},
17+
smartEmailId: {
18+
propDefinition: [
19+
campaignMonitor,
20+
"smartEmailId",
21+
(c) => ({
22+
clientId: c.clientId,
23+
}),
24+
],
1525
},
16-
subject: {
26+
to: {
1727
type: "string",
18-
label: "Subject",
19-
description: "The subject of the email",
28+
label: "To",
29+
description: "An array of email addresses to send the email to",
2030
},
21-
content: {
31+
cc: {
2232
type: "string",
23-
label: "Content",
24-
description: "The content of the email",
33+
label: "CC",
34+
description: "An array of email address to carbon copy the email to",
35+
optional: true,
2536
},
26-
listId: {
37+
bcc: {
2738
type: "string",
28-
label: "List ID",
29-
description: "The ID of the list",
39+
label: "BCC",
40+
description: "An array of email address to blind carbon copy the email to",
3041
optional: true,
3142
},
43+
consentToTrack: {
44+
propDefinition: [
45+
campaignMonitor,
46+
"consentToTrack",
47+
],
48+
},
3249
},
3350
async run({ $ }) {
34-
const response = await this.campaignMonitor.sendIntelligentEmail(
35-
this.email,
36-
this.subject,
37-
this.content,
38-
this.listId,
39-
);
51+
const response = await this.campaignMonitor.sendSmartEmail({
52+
$,
53+
smartEmailId: this.smartEmailId,
54+
data: {
55+
To: this.to,
56+
CC: this.cc,
57+
BCC: this.bcc,
58+
ConsentToTrack: this.consentToTrack,
59+
},
60+
});
4061
$.export("$summary", "Successfully sent smart transactional email");
4162
return response;
4263
},

components/campaign_monitor/actions/unsubscribe/unsubscribe.mjs

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,45 @@ import campaignMonitor from "../../campaign_monitor.app.mjs";
33
export default {
44
key: "campaign_monitor-unsubscribe",
55
name: "Unsubscribe",
6-
description: "Removes a subscriber from a mailing list given their email address.",
7-
version: "0.0.{{ts}}",
6+
description: "Removes a subscriber from a mailing list given their email address. [See the documentation](https://www.campaignmonitor.com/api/v3-3/subscribers/#unsubscribing-a-subscriber)",
7+
version: "0.0.1",
88
type: "action",
99
props: {
1010
campaignMonitor,
11-
email: {
12-
type: "string",
13-
label: "Email",
14-
description: "The email of the subscriber to remove",
11+
clientId: {
12+
propDefinition: [
13+
campaignMonitor,
14+
"clientId",
15+
],
1516
},
1617
listId: {
17-
type: "string",
18-
label: "List ID",
19-
description: "The ID of the mailing list from which to remove the subscriber",
20-
optional: true,
18+
propDefinition: [
19+
campaignMonitor,
20+
"listId",
21+
(c) => ({
22+
clientId: c.clientId,
23+
}),
24+
],
25+
},
26+
subscriber: {
27+
propDefinition: [
28+
campaignMonitor,
29+
"subscriber",
30+
(c) => ({
31+
listId: c.listId,
32+
}),
33+
],
2134
},
2235
},
2336
async run({ $ }) {
24-
const response = await this.campaignMonitor.removeSubscriber(this.email, this.listId);
25-
$.export("$summary", `Successfully unsubscribed ${this.email}`);
37+
const response = await this.campaignMonitor.unsubscribeSubscriber({
38+
$,
39+
listId: this.listId,
40+
data: {
41+
EmailAddress: this.subscriber,
42+
},
43+
});
44+
$.export("$summary", `Successfully unsubscribed ${this.subscriber}`);
2645
return response;
2746
},
2847
};

0 commit comments

Comments
 (0)