Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion components/ai_textraction/ai_textraction.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/attractwell/attractwell.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/deepimage/deepimage.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/fluidforms/fluidforms.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/gainsight_nxt/gainsight_nxt.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/gainsight_px/gainsight_px.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/nerv/nerv.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/runpod/runpod.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/runware/runware.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/teach_n_go/teach_n_go.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import app from "../../the_magic_drip.app.mjs";

export default {
key: "the_magic_drip-add-lead-to-campaign",
name: "Add Lead to Campaign",
description: "Add a lead to a campaign. [See the documentation](https://docs.themagicdrip.com/api-reference/endpoint/post-v1campaignleads)",
version: "0.0.1",
type: "action",
props: {
app,
campaignId: {
propDefinition: [
app,
"campaignId",
],
},
firstName: {
type: "string",
label: "First Name",
description: "First name of the lead",
optional: true,
},
lastName: {
type: "string",
label: "Last Name",
description: "Last name of the lead",
},
linkedInPublicUrl: {
type: "string",
label: "LinkedIn Public URL",
description: "LinkedIn public URL of the lead",
optional: true,
},
company: {
type: "string",
label: "Company",
description: "Company of the lead",
optional: true,
},
companyLinkedInUrl: {
type: "string",
label: "Company LinkedIn URL",
description: "LinkedIn URL of the company",
optional: true,
},
customVariables: {
type: "object",
label: "Custom Variables",
description: "More information about the lead",
optional: true,
},
},
async run({ $ }) {
const {
app, campaignId, ...lead
} = this;
const response = await app.addLeadToCampaign({
$,
campaignId,
data: {
leadsWithCustomVariables: [
lead,
],
},
});
$.export(
"$summary",
`Successfully added lead "${lead.lastName}" to campaign`,
);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import app from "../../the_magic_drip.app.mjs";

export default {
key: "the_magic_drip-list-campaigns",
name: "List Campaigns",
description: "Retrieve all available campaigns. [See the documentation](https://docs.themagicdrip.com/api-reference/endpoint/get-v1campaign)",
version: "0.0.1",
type: "action",
props: {
app,
},
async run({ $ }) {
const { campaigns } = await this.app.listCampaigns({
$,
});
$.export("$summary", `Sucessfully retrieved ${campaigns?.length ?? 0} campaigns`);
return campaigns;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import app from "../../the_magic_drip.app.mjs";

export default {
key: "the_magic_drip-list-templates",
name: "List Templates",
description: "Retrieve all available templates. [See the documentation](https://docs.themagicdrip.com/api-reference/endpoint/get-v1templates)",
version: "0.0.1",
type: "action",
props: {
app,
},
async run({ $ }) {
const { templates } = await this.app.listTemplates({
$,
});
$.export("$summary", `Sucessfully retrieved ${templates?.length ?? 0} templates`);
return templates;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import app from "../../the_magic_drip.app.mjs";

export default {
key: "the_magic_drip-mark-campaign-active-or-inactive",
name: "Mark Campaign Active or Inactive",
description: "Marks a campaign as active or inactive. [See the documentation](https://docs.themagicdrip.com/api-reference/endpoint/post-v1campaign-active)",
version: "0.0.1",
type: "action",
props: {
app,
campaignId: {
propDefinition: [
app,
"campaignId",
],
},
activate: {
type: "boolean",
label: "Activate",
description: "Set to `true` to activate, or `false` to deactivate the campaign",
},
},
async run({ $ }) {
const {
campaignId, activate,
} = this;
const response = await this.app.markCampaignActiveInactive({
$,
campaignId,
activate,
});

$.export("$summary", `Successfully ${activate
? ""
: "de"}activated campaign`);

return response;
},
};
7 changes: 5 additions & 2 deletions components/the_magic_drip/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/the_magic_drip",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream The Magic Drip Components",
"main": "the_magic_drip.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
}
56 changes: 56 additions & 0 deletions components/the_magic_drip/sources/common.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import app from "../the_magic_drip.app.mjs";
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";

export default {
props: {
app,
timer: {
type: "$.interface.timer",
default: {
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
},
},
db: "$.service.db",
},
methods: {
_getSavedIds() {
return this.db.get("savedIds") || [];
},
_setSavedIds(value) {
this.db.set("savedIds", value);
},
getItemId(item) {
return item.id;
},
getItemMetadata() {
return {
summary: "New event",
ts: Date.now(),
};
},
async getAndProcessData(maxEmits = 0) {
const savedIds = this._getSavedIds();
const items = await this.getItems();

items?.filter?.((item) => !savedIds.includes(this.getItemId(item))).forEach((item, index) => {
if ((!maxEmits) || (index < maxEmits)) {
this.$emit(item, {
id: this.getItemId(item),
...this.getItemMetadata(item),
});
}
savedIds.push(this.getItemId(item));
});

this._setSavedIds(savedIds);
},
},
hooks: {
async deploy() {
await this.getAndProcessData(5);
},
},
async run() {
await this.getAndProcessData();
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import common from "../common.mjs";

export default {
...common,
key: "the_magic_drip-new-campaign-created",
name: "New Campaign Created",
description: "Emit new event when a campaign is created. [See the documentation](https://docs.themagicdrip.com/api-reference/endpoint/get-v1campaign)",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
async getItems() {
const { campaigns } = await this.app.listCampaigns();
return campaigns;
},
getItemId(item) {
return item.workflowId;
},
getItemMetadata(item) {
return {
summary: `New Campaign: ${item.name}`,
ts: item.createdAt,
};
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import common from "../common.mjs";

export default {
...common,
key: "the_magic_drip-new-template-created",
name: "New Template Created",
description: "Emit new event when a template is created. [See the documentation](https://docs.themagicdrip.com/api-reference/endpoint/get-v1templates)",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
async getItems() {
const { templates } = await this.app.listTemplates();
return templates;
},
getItemId(item) {
return item.templateId;
},
getItemMetadata(item) {
return {
summary: `New Template: ${item.name}`,
ts: item.createdAt,
};
},
},
};
Loading
Loading