Skip to content

Commit d0c0ff6

Browse files
Loops.so new components (#14226)
* Delete Contact * List Mailing Lists * List Custom Fields * Version bumps * pnpm * syntax adjustment * Update components/loops_so/actions/send-transactional-email/send-transactional-email.mjs Co-authored-by: michelle0927 <[email protected]> --------- Co-authored-by: michelle0927 <[email protected]>
1 parent 447c2b1 commit d0c0ff6

File tree

11 files changed

+118
-9
lines changed

11 files changed

+118
-9
lines changed

components/loops_so/actions/create-contact/create-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "loops_so-create-contact",
66
name: "Create Contact",
77
description: "Creates a new contact. [See the Documentation](https://loops.so/docs/add-users/api-reference#add)",
8-
version: "0.1.0",
8+
version: "0.1.1",
99
type: "action",
1010
async run({ $ }) {
1111
const { // eslint-disable-next-line no-unused-vars
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { ConfigurationError } from "@pipedream/platform";
2+
import loops from "../../loops_so.app.mjs";
3+
4+
export default {
5+
key: "loops_so-delete-contact",
6+
name: "Delete Contact",
7+
description: "Delete an existing contact. [See the documentation](https://loops.so/docs/api-reference/delete-contact)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
loops,
12+
infoAlert: {
13+
type: "alert",
14+
alertType: "info",
15+
content: "You can provide either the contact's email address or user ID.",
16+
},
17+
email: {
18+
propDefinition: [
19+
loops,
20+
"email",
21+
],
22+
optional: true,
23+
},
24+
userId: {
25+
type: "string",
26+
label: "User ID",
27+
description: "User ID of the contact",
28+
optional: true,
29+
},
30+
},
31+
async run({ $ }) {
32+
const {
33+
loops, email, userId,
34+
} = this;
35+
if (!email && !userId) {
36+
throw new ConfigurationError("You must provide either the contact's email address or user ID.");
37+
}
38+
const response = await loops.deleteContact({
39+
$,
40+
data: {
41+
email,
42+
userId,
43+
},
44+
});
45+
46+
const summary = response?.success
47+
? "Successfully deleted contact"
48+
: "Failed to delete contact";
49+
50+
$.export("$summary", summary);
51+
52+
return response;
53+
},
54+
};

components/loops_so/actions/find-contact/find-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "loops_so-find-contact",
55
name: "Find Contact",
66
description: "Search for a contact by email address. [See the Documentation](https://loops.so/docs/add-users/api-reference#find)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
loops,
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import loops from "../../loops_so.app.mjs";
2+
3+
export default {
4+
key: "loops_so-list-custom-fields",
5+
name: "List Custom Fields",
6+
description: "List your account's custom contact properties. [See the documentation](https://loops.so/docs/api-reference/list-custom-fields)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
loops,
11+
},
12+
async run({ $ }) {
13+
const response = await this.loops.listCustomFields({
14+
$,
15+
});
16+
17+
$.export("$summary", `Successfully retrieved ${response.length} custom fields`);
18+
19+
return response;
20+
},
21+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import loops from "../../loops_so.app.mjs";
2+
3+
export default {
4+
key: "loops_so-list-mailing-lists",
5+
name: "List Mailing Lists",
6+
description: "List your account's mailing lists. [See the documentation](https://loops.so/docs/api-reference/list-mailing-lists)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
loops,
11+
},
12+
async run({ $ }) {
13+
const response = await this.loops.listMailingLists({
14+
$,
15+
});
16+
17+
$.export("$summary", `Successfully retrieved ${response.length} mailing lists`);
18+
19+
return response;
20+
},
21+
};

components/loops_so/actions/send-event/send-event.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "loops_so-send-event",
55
name: "Send Event",
66
description: "Send an event to an email address. [See the Documentation](https://loops.so/docs/add-users/api-reference#send)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
loops,

components/loops_so/actions/send-transactional-email/send-transactional-email.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "loops_so-send-transactional-email",
55
name: "Send Transactional Email",
66
description: "Send a transactional email. [See the Documentation](https://loops.so/docs/transactional/guide#send-your-email)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
loops,

components/loops_so/actions/update-contact/update-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "loops_so-update-contact",
77
name: "Update Contact",
88
description: "Updates an existing contact by email. If email not found, a new contact will be created. [See the Documentation](https://loops.so/docs/add-users/api-reference#update)",
9-
version: "0.1.0",
9+
version: "0.1.1",
1010
type: "action",
1111
async run({ $ }) {
1212
const { // eslint-disable-next-line no-unused-vars

components/loops_so/loops_so.app.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ export default {
8585
...args,
8686
});
8787
},
88+
deleteContact(args = {}) {
89+
return this._makeRequest({
90+
path: "/contacts/delete",
91+
method: "POST",
92+
...args,
93+
});
94+
},
8895
sendEvent(args = {}) {
8996
return this._makeRequest({
9097
path: "/events/send",
@@ -105,5 +112,11 @@ export default {
105112
...args,
106113
});
107114
},
115+
listMailingLists(args = {}) {
116+
return this._makeRequest({
117+
path: "/lists",
118+
...args,
119+
});
120+
},
108121
},
109122
};

components/loops_so/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/loops_so",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "Pipedream Loops.so Components",
55
"main": "loops_so.app.mjs",
66
"keywords": [
@@ -13,7 +13,7 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^1.5.1",
16+
"@pipedream/platform": "^3.0.3",
1717
"lodash.pickby": "^4.6.0"
1818
}
1919
}

0 commit comments

Comments
 (0)