Skip to content

Commit 2a63a63

Browse files
committed
wip
1 parent 54c05a8 commit 2a63a63

File tree

13 files changed

+403
-7
lines changed

13 files changed

+403
-7
lines changed

components/elastic_email/actions/add-contact/add-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
key: "elastic_email-add-contact",
1111
name: "Add Contact to Mailing List",
1212
description: "Adds a new contact to a mailing list. [See the documentation](https://elasticemail.com/developers/api-documentation/rest-api#operation/contactsPost)",
13-
version: "0.0.2",
13+
version: "0.0.3",
1414
annotations: {
1515
destructiveHint: false,
1616
openWorldHint: true,
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import app from "../../elastic_email.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "elastic_email-create-campaign",
6+
name: "Create Campaign",
7+
description: "Create a campaign in an Elastic Email account. [See the documentation](https://elasticemail.com/developers/api-documentation/rest-api#operation/campaignsPost)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
annotations: {
11+
destructiveHint: false,
12+
openWorldHint: true,
13+
readOnlyHint: false,
14+
},
15+
props: {
16+
app,
17+
name: {
18+
type: "string",
19+
label: "Campaign Name",
20+
description: "The name of the campaign",
21+
},
22+
from: {
23+
type: "string",
24+
label: "From",
25+
description: "Your e-mail with an optional name (e.g.: John Doe email@domain.com)",
26+
},
27+
recipientListNames: {
28+
propDefinition: [
29+
app,
30+
"listNames",
31+
],
32+
label: "Recipient List Names",
33+
description: "Names of lists from your Account to read recipients from",
34+
},
35+
recipientSegmentNames: {
36+
propDefinition: [
37+
app,
38+
"segmentNames",
39+
],
40+
label: "Recipient Segment Names",
41+
description: "Names of segments from your Account to read recipients from",
42+
optional: true,
43+
},
44+
replyTo: {
45+
type: "string",
46+
label: "Reply To",
47+
description: "To what address should the recipients reply to (e.g. John Doe email@domain.com)",
48+
optional: true,
49+
},
50+
subject: {
51+
type: "string",
52+
label: "Subject",
53+
description: "Default subject of email",
54+
optional: true,
55+
},
56+
templateName: {
57+
propDefinition: [
58+
app,
59+
"templateName",
60+
],
61+
optional: true,
62+
},
63+
status: {
64+
propDefinition: [
65+
app,
66+
"campaignStatus",
67+
],
68+
},
69+
excludeRecipientListNames: {
70+
propDefinition: [
71+
app,
72+
"listNames",
73+
],
74+
label: "Exclude Recipient List Names",
75+
description: "Names of lists from your Account to exclude from the campaign",
76+
},
77+
excludeRecipientSegmentNames: {
78+
propDefinition: [
79+
app,
80+
"segmentNames",
81+
],
82+
label: "Exclude Recipient Segment Names",
83+
description: "Names of segments from your Account to exclude from the campaign",
84+
optional: true,
85+
},
86+
},
87+
async run({ $ }) {
88+
if (!this.recipientListNames && !this.recipientSegmentNames) {
89+
throw new ConfigurationError("You must provide at least one list or segment to read recipients from");
90+
}
91+
92+
const response = await this.app.createCampaign({
93+
$,
94+
data: {
95+
Name: this.name,
96+
Recipients: {
97+
ListNames: this.recipientListNames,
98+
SegmentNames: this.recipientSegmentNames,
99+
},
100+
Content: [
101+
{
102+
From: this.from,
103+
ReplyTo: this.replyTo,
104+
Subject: this.subject,
105+
TemplateName: this.templateName,
106+
},
107+
],
108+
Status: this.status,
109+
ExcludeRecipients: this.excludeRecipientListNames || this.excludeRecipientSegmentNames
110+
? {
111+
ListNames: this.excludeRecipientListNames,
112+
SegmentNames: this.excludeRecipientSegmentNames,
113+
}
114+
: undefined,
115+
},
116+
});
117+
$.export("$summary", "Campaign created successfully");
118+
return response;
119+
},
120+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import app from "../../elasticemail.app.mjs";
2+
3+
export default {
4+
key: "elastic_email-create-contact",
5+
name: "Create Contact",
6+
description: "Create a contact in an Elastic Email account. [See the documentation](https://elasticemail.com/developers/api-documentation/rest-api#operation/contactsPost)",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
app,
16+
},
17+
async run() {
18+
},
19+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import app from "../../elastic_email.app.mjs";
2+
3+
export default {
4+
key: "elastic_email-create-segment",
5+
name: "Create Segment",
6+
description: "Create a segment in an Elastic Email account. [See the documentation](https://elasticemail.com/developers/api-documentation/rest-api#tag/Segments)",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
app,
16+
},
17+
async run() {
18+
},
19+
};
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import app from "../../elastic_email.app.mjs";
2+
3+
export default {
4+
key: "elastic_email-list-campaigns",
5+
name: "List Campaigns",
6+
description: "List campaigns in an Elastic Email account. [See the documentation](https://elasticemail.com/developers/api-documentation/rest-api#operation/campaignsGet)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
app,
16+
search: {
17+
type: "string",
18+
label: "Search",
19+
description: "The search query to filter campaigns",
20+
optional: true,
21+
},
22+
limit: {
23+
type: "integer",
24+
label: "Limit",
25+
description: "The maximum number of campaigns to return",
26+
default: 100,
27+
optional: true,
28+
},
29+
offset: {
30+
type: "integer",
31+
label: "Offset",
32+
description: "The offset to start from",
33+
default: 0,
34+
optional: true,
35+
},
36+
},
37+
async run({ $ }) {
38+
const response = await this.app.listCampaigns({
39+
$,
40+
params: {
41+
search: this.search,
42+
limit: this.limit,
43+
offset: this.offset,
44+
},
45+
});
46+
$.export("$summary", `Successfully listed ${response?.length} campaigns.`);
47+
return response;
48+
},
49+
};
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import app from "../../elastic_email.app.mjs";
2+
3+
export default {
4+
key: "elastic_email-list-contacts",
5+
name: "List Contacts",
6+
description: "List contacts in an Elastic Email account. [See the documentation](https://elasticemail.com/developers/api-documentation/rest-api#operation/contactsGet)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
app,
16+
limit: {
17+
type: "integer",
18+
label: "Limit",
19+
description: "The maximum number of contacts to return",
20+
default: 100,
21+
optional: true,
22+
},
23+
offset: {
24+
type: "integer",
25+
label: "Offset",
26+
description: "The offset to start from",
27+
default: 0,
28+
optional: true,
29+
},
30+
},
31+
async run({ $ }) {
32+
const response = await this.app.listContacts({
33+
$,
34+
params: {
35+
limit: this.limit,
36+
offset: this.offset,
37+
},
38+
});
39+
$.export("$summary", `Successfully listed ${response?.length} contacts.`);
40+
return response;
41+
},
42+
};

components/elastic_email/actions/send-email/send-email.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
key: "elastic_email-send-email",
1010
name: "Send Email",
1111
description: "Sends an email to one or more recipients. [See the documentation](https://elasticemail.com/developers/api-documentation/rest-api#operation/emailsPost)",
12-
version: "0.0.2",
12+
version: "0.0.3",
1313
annotations: {
1414
destructiveHint: false,
1515
openWorldHint: true,

components/elastic_email/actions/unsubscribe-contact/unsubscribe-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "elastic_email-unsubscribe-contact",
66
name: "Unsubscribe Contact",
77
description: "Unsubscribes a contact from future emails. [See the documentation](https://elasticemail.com/developers/api-documentation/rest-api#operation/suppressionsUnsubscribesPost)",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
annotations: {
1010
destructiveHint: true,
1111
openWorldHint: true,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import app from "../../elastic_email.app.mjs";
2+
3+
export default {
4+
key: "elastic_email-update-campaign",
5+
name: "Update Campaign",
6+
description: "Update a campaign in an Elastic Email account. [See the documentation](https://elasticemail.com/developers/api-documentation/rest-api#operation/campaignsByNamePut)",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: true,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
app,
16+
},
17+
async run() {
18+
},
19+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import app from "../../elastic_email.app.mjs";
2+
3+
export default {
4+
key: "elastic_email-update-contact",
5+
name: "Update Contact",
6+
description: "Update a contact in an Elastic Email account. [See the documentation](https://elasticemail.com/developers/api-documentation/rest-api#operation/contactsByEmailPut)",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: true,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
app,
16+
},
17+
async run() {
18+
},
19+
};

0 commit comments

Comments
 (0)