Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import campaignMonitor from "../../campaign_monitor.app.mjs";

export default {
key: "campaign_monitor-add-subscriber",
name: "Add Subscriber",
description: "Creates a new subscriber on a specific list. [See the documentation](https://www.campaignmonitor.com/api/v3-3/subscribers/)",
version: "0.0.1",
type: "action",
props: {
campaignMonitor,
clientId: {
propDefinition: [
campaignMonitor,
"clientId",
],
},
listId: {
propDefinition: [
campaignMonitor,
"listId",
(c) => ({
clientId: c.clientId,
}),
],
},
email: {
type: "string",
label: "Email",
description: "The email address of the subscriber",
},
name: {
type: "string",
label: "Name",
description: "The name of the subscriber",
optional: true,
},
phone: {
type: "string",
label: "Phone",
description: "The phone number of the subscriber. Example: `+5012398752`",
optional: true,
},
consentToTrack: {
propDefinition: [
campaignMonitor,
"consentToTrack",
],
},
consentToSendSMS: {
type: "string",
label: "Consent to Send SMS",
description: "Indicates if consent has been granted by the subscriber to receive Sms",
options: [
"Yes",
"No",
"Unchanged",
],
default: "Unchanged",
optional: true,
},
resubscribe: {
type: "boolean",
label: "Resubscribe",
description: "Resubscribe if the email address has previously been unsubscribed",
optional: true,
},
},
async run({ $ }) {
const response = await this.campaignMonitor.createSubscriber({
$,
listId: this.listId,
data: {
EmailAddress: this.email,
Name: this.name,
MobileNumber: this.phone,
ConsentToTrack: this.consentToTrack,
ConsentToSendSms: this.consentToSendSMS,
Resubscribe: this.resubscribe,
},
});
$.export("$summary", `Successfully added subscriber ${this.email}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import campaignMonitor from "../../campaign_monitor.app.mjs";

export default {
key: "campaign_monitor-send-smart-transactional-email",
name: "Send Smart Transactional Email",
description: "Sends an intelligent transactional email to a specified recipient. [See the documentation](https://www.campaignmonitor.com/api/v3-3/transactional/#send-smart-email)",
version: "0.0.1",
type: "action",
props: {
campaignMonitor,
clientId: {
propDefinition: [
campaignMonitor,
"clientId",
],
},
smartEmailId: {
propDefinition: [
campaignMonitor,
"smartEmailId",
(c) => ({
clientId: c.clientId,
}),
],
},
to: {
type: "string",
label: "To",
description: "An array of email addresses to send the email to",
},
cc: {
type: "string",
label: "CC",
description: "An array of email address to carbon copy the email to",
optional: true,
},
bcc: {
type: "string",
label: "BCC",
description: "An array of email address to blind carbon copy the email to",
optional: true,
},
consentToTrack: {
propDefinition: [
campaignMonitor,
"consentToTrack",
],
},
},
async run({ $ }) {
const response = await this.campaignMonitor.sendSmartEmail({
$,
smartEmailId: this.smartEmailId,
data: {
To: this.to,
CC: this.cc,
BCC: this.bcc,
ConsentToTrack: this.consentToTrack,
},
});
$.export("$summary", "Successfully sent smart transactional email");
return response;
},
};
47 changes: 47 additions & 0 deletions components/campaign_monitor/actions/unsubscribe/unsubscribe.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import campaignMonitor from "../../campaign_monitor.app.mjs";

export default {
key: "campaign_monitor-unsubscribe",
name: "Unsubscribe",
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)",
version: "0.0.1",
type: "action",
props: {
campaignMonitor,
clientId: {
propDefinition: [
campaignMonitor,
"clientId",
],
},
listId: {
propDefinition: [
campaignMonitor,
"listId",
(c) => ({
clientId: c.clientId,
}),
],
},
subscriber: {
propDefinition: [
campaignMonitor,
"subscriber",
(c) => ({
listId: c.listId,
}),
],
},
},
async run({ $ }) {
const response = await this.campaignMonitor.unsubscribeSubscriber({
$,
listId: this.listId,
data: {
EmailAddress: this.subscriber,
},
});
$.export("$summary", `Successfully unsubscribed ${this.subscriber}`);
return response;
},
};
Loading
Loading