Skip to content

New Components - instantly #15228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 13, 2025
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/charthop/charthop.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,50 @@
import { parseObject } from "../../common/utils.mjs";
import instantly from "../../instantly.app.mjs";

export default {
key: "instantly-add-lead-campaign",
name: "Add Lead to Campaign",
description: "Adds a lead to a campaign for tracking or further actions. [See the documentation](https://developer.instantly.ai/lead/add-leads-to-a-campaign)",
version: "0.0.1",
type: "action",
props: {
instantly,
leads: {
propDefinition: [
instantly,
"leads",
],
},
campaignId: {
propDefinition: [
instantly,
"campaignId",
],
},
skipIfInWorkspace: {
type: "boolean",
label: "Skip if in Workspace",
description: "Skip lead if it exists in any campaigns in the workspace",
optional: true,
},
skipIfInCampaign: {
type: "boolean",
label: "Skip if in Campaign",
description: "Skip lead if it exists in the campaign",
optional: true,
},
},
async run({ $ }) {
const response = await this.instantly.addLeadsToCampaign({
$,
data: {
leads: parseObject(this.leads),
campaign_id: this.campaignId,
skip_if_in_workspace: this.skipIfInWorkspace,
skip_if_in_campaign: this.skipIfInCampaign,
},
});
$.export("$summary", `Added ${response.leads_uploaded} leads to campaign ${this.campaignId}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { parseObject } from "../../common/utils.mjs";
import instantly from "../../instantly.app.mjs";

export default {
key: "instantly-add-tags-campaign",
name: "Add Tags to Campaign",
description: "Adds tags to a specific campaign. [See the documentation](https://developer.instantly.ai/tags/assign-or-unassign-a-tag)",
version: "0.0.1",
type: "action",
props: {
instantly,
campaignIds: {
propDefinition: [
instantly,
"campaignId",
],
type: "string[]",
},
tagIds: {
propDefinition: [
instantly,
"tagIds",
],
},
},
async run({ $ }) {
const response = await this.instantly.addTagsToCampaign({
$,
data: {
campaign_id: this.campaignId,
tag_ids: parseObject(this.tagIds),
resource_type: 2,
assign: true,
resource_ids: parseObject(this.campaignIds),
},
});
$.export("$summary", response.message);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { ConfigurationError } from "@pipedream/platform";
import instantly from "../../instantly.app.mjs";

export default {
key: "instantly-update-lead-status",
name: "Update Lead Status",
description: "Updates the status of a lead in a campaign. [See the documentation](https://developer.instantly.ai/lead/update-lead-status)",
version: "0.0.1",
type: "action",
props: {
instantly,
campaignId: {
propDefinition: [
instantly,
"campaignId",
],
},
email: {
propDefinition: [
instantly,
"email",
],
},
newStatus: {
propDefinition: [
instantly,
"newStatus",
],
},
},
async run({ $ }) {
try {
const response = await this.instantly.updateLeadStatus({
$,
data: {
email: this.email,
new_status: this.newStatus,
campaign_id: this.campaignId,
},
});
$.export("$summary", `Updated lead ${this.email} to status '${this.newStatus}'`);
return response;
} catch ({ response }) {
throw new ConfigurationError(response.data.error);
}
},
};
77 changes: 77 additions & 0 deletions components/instantly/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
export const LIMIT = 100;

export const EVENT_TYPE_OPTIONS = [
{
label: "Email Sent",
value: "email_sent",
},
{
label: "Email Bounced",
value: "email_bounced",
},
{
label: "Email Opened",
value: "email_opened",
},
{
label: "Email Link Clicked",
value: "email_link_clicked",
},
{
label: "Reply Received",
value: "reply_received",
},
{
label: "Lead Unsubscribed",
value: "lead_unsubscribed",
},
{
label: "Campaign Completed",
value: "campaign_completed",
},
{
label: "Account Error",
value: "account_error",
},
{
label: "Lead Not Interested",
value: "lead_not_interested",
},
{
label: "Lead Neutral",
value: "lead_neutral",
},
{
label: "Lead Meeting Booked",
value: "lead_meeting_booked",
},
{
label: "Lead Meeting Completed",
value: "lead_meeting_completed",
},
{
label: "Lead Closed",
value: "lead_closed",
},
{
label: "Lead Out of Office",
value: "lead_out_of_office",
},
{
label: "Lead Wrong Person",
value: "lead_wrong_person",
},
];

export const NEW_STATUS_OPTIONS = [
"Active",
"Completed",
"Unsubscribed",
"Interested",
"Meeting Booked",
"Meeting Completed",
"Closed",
"Out of Office",
"Not Interested",
"Wrong Person",
];
24 changes: 24 additions & 0 deletions components/instantly/common/utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export const parseObject = (obj) => {
if (!obj) return undefined;

if (Array.isArray(obj)) {
return obj.map((item) => {
if (typeof item === "string") {
try {
return JSON.parse(item);
} catch (e) {
return item;
}
}
return item;
});
}
if (typeof obj === "string") {
try {
return JSON.parse(obj);
} catch (e) {
return obj;
}
}
return obj;
};
Loading
Loading