Skip to content

Commit

Permalink
Loops.so new components (#14226)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
GTFalcao and michelle0927 authored Oct 9, 2024
1 parent 447c2b1 commit d0c0ff6
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "loops_so-create-contact",
name: "Create Contact",
description: "Creates a new contact. [See the Documentation](https://loops.so/docs/add-users/api-reference#add)",
version: "0.1.0",
version: "0.1.1",
type: "action",
async run({ $ }) {
const { // eslint-disable-next-line no-unused-vars
Expand Down
54 changes: 54 additions & 0 deletions components/loops_so/actions/delete-contact/delete-contact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { ConfigurationError } from "@pipedream/platform";
import loops from "../../loops_so.app.mjs";

export default {
key: "loops_so-delete-contact",
name: "Delete Contact",
description: "Delete an existing contact. [See the documentation](https://loops.so/docs/api-reference/delete-contact)",
version: "0.0.1",
type: "action",
props: {
loops,
infoAlert: {
type: "alert",
alertType: "info",
content: "You can provide either the contact's email address or user ID.",
},
email: {
propDefinition: [
loops,
"email",
],
optional: true,
},
userId: {
type: "string",
label: "User ID",
description: "User ID of the contact",
optional: true,
},
},
async run({ $ }) {
const {
loops, email, userId,
} = this;
if (!email && !userId) {
throw new ConfigurationError("You must provide either the contact's email address or user ID.");
}
const response = await loops.deleteContact({
$,
data: {
email,
userId,
},
});

const summary = response?.success
? "Successfully deleted contact"
: "Failed to delete contact";

$.export("$summary", summary);

return response;
},
};
2 changes: 1 addition & 1 deletion components/loops_so/actions/find-contact/find-contact.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "loops_so-find-contact",
name: "Find Contact",
description: "Search for a contact by email address. [See the Documentation](https://loops.so/docs/add-users/api-reference#find)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
loops,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import loops from "../../loops_so.app.mjs";

export default {
key: "loops_so-list-custom-fields",
name: "List Custom Fields",
description: "List your account's custom contact properties. [See the documentation](https://loops.so/docs/api-reference/list-custom-fields)",
version: "0.0.1",
type: "action",
props: {
loops,
},
async run({ $ }) {
const response = await this.loops.listCustomFields({
$,
});

$.export("$summary", `Successfully retrieved ${response.length} custom fields`);

return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import loops from "../../loops_so.app.mjs";

export default {
key: "loops_so-list-mailing-lists",
name: "List Mailing Lists",
description: "List your account's mailing lists. [See the documentation](https://loops.so/docs/api-reference/list-mailing-lists)",
version: "0.0.1",
type: "action",
props: {
loops,
},
async run({ $ }) {
const response = await this.loops.listMailingLists({
$,
});

$.export("$summary", `Successfully retrieved ${response.length} mailing lists`);

return response;
},
};
2 changes: 1 addition & 1 deletion components/loops_so/actions/send-event/send-event.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "loops_so-send-event",
name: "Send Event",
description: "Send an event to an email address. [See the Documentation](https://loops.so/docs/add-users/api-reference#send)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
loops,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "loops_so-send-transactional-email",
name: "Send Transactional Email",
description: "Send a transactional email. [See the Documentation](https://loops.so/docs/transactional/guide#send-your-email)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
loops,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "loops_so-update-contact",
name: "Update Contact",
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)",
version: "0.1.0",
version: "0.1.1",
type: "action",
async run({ $ }) {
const { // eslint-disable-next-line no-unused-vars
Expand Down
13 changes: 13 additions & 0 deletions components/loops_so/loops_so.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ export default {
...args,
});
},
deleteContact(args = {}) {
return this._makeRequest({
path: "/contacts/delete",
method: "POST",
...args,
});
},
sendEvent(args = {}) {
return this._makeRequest({
path: "/events/send",
Expand All @@ -105,5 +112,11 @@ export default {
...args,
});
},
listMailingLists(args = {}) {
return this._makeRequest({
path: "/lists",
...args,
});
},
},
};
4 changes: 2 additions & 2 deletions components/loops_so/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/loops_so",
"version": "0.2.0",
"version": "0.3.0",
"description": "Pipedream Loops.so Components",
"main": "loops_so.app.mjs",
"keywords": [
Expand All @@ -13,7 +13,7 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.5.1",
"@pipedream/platform": "^3.0.3",
"lodash.pickby": "^4.6.0"
}
}
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d0c0ff6

Please sign in to comment.