Skip to content

Commit 9f32f21

Browse files
authored
eslint fixes (#18998)
1 parent 7e5539b commit 9f32f21

File tree

7 files changed

+444
-5
lines changed

7 files changed

+444
-5
lines changed

components/adversus/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Adversus is a powerful dialer and CRM platform tailored to streamline outbound call center operations and enhance sales processes. Leveraging the Adversus API with Pipedream opens up immense possibilities for automating call workflows, syncing lead data, and crafting custom triggers based on call outcomes or performance metrics. By creating serverless workflows on Pipedream, you can connect Adversus to a myriad of other apps and services to optimize lead management, automate repetitive tasks, and gain real-time insights into your sales funnel.
44

5+
# API Documentation
6+
7+
For detailed API documentation, please refer to: https://solutions.adversus.io/api
8+
59
# Example Use Cases
610

711
- **Automated Lead Syncing with CRM**: Whenever a new lead is added to Adversus, the workflow automatically syncs this lead to your chosen CRM, such as Salesforce or HubSpot. It ensures that any updates made by the sales team in Adversus reflect in the CRM, keeping both systems in harmony and up-to-date.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import adversus from "../../adversus.app.mjs";
2+
3+
export default {
4+
key: "adversus-add-note-activity",
5+
name: "Add Note or Activity",
6+
description: "Add a note or activity to a lead in Adversus. [See the API documentation](https://solutions.adversus.io/api).",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
adversus,
16+
leadId: {
17+
propDefinition: [
18+
adversus,
19+
"leadId",
20+
],
21+
},
22+
note: {
23+
type: "string",
24+
label: "Note",
25+
description: "The note text to add to the lead",
26+
optional: true,
27+
},
28+
activityType: {
29+
type: "string",
30+
label: "Activity Type",
31+
description: "The type of activity (e.g., 'call', 'email', 'meeting')",
32+
optional: true,
33+
},
34+
activityDescription: {
35+
type: "string",
36+
label: "Activity Description",
37+
description: "The description of the activity",
38+
optional: true,
39+
},
40+
additionalFields: {
41+
type: "object",
42+
label: "Additional Fields",
43+
description: "Additional fields to include in the note or activity",
44+
optional: true,
45+
},
46+
},
47+
/**
48+
* Execute the action to add a note or activity to a lead
49+
* @param {Object} $ - Pipedream context
50+
* @returns {Promise} The response from adding note/activity
51+
*/
52+
async run({ $ }) {
53+
const promises = [];
54+
55+
if (this.note) {
56+
promises.push(
57+
this.adversus.addNoteToLead(this.leadId, {
58+
data: {
59+
note: this.note,
60+
...(this.additionalFields || {}),
61+
},
62+
}),
63+
);
64+
}
65+
66+
if (this.activityType || this.activityDescription) {
67+
promises.push(
68+
this.adversus.addActivityToLead(this.leadId, {
69+
data: {
70+
...(this.activityType && {
71+
type: this.activityType,
72+
}),
73+
...(this.activityDescription && {
74+
description: this.activityDescription,
75+
}),
76+
...(this.additionalFields || {}),
77+
},
78+
}),
79+
);
80+
}
81+
82+
if (promises.length === 0) {
83+
throw new Error("Either 'Note' or 'Activity Type'/'Activity Description' must be provided");
84+
}
85+
86+
const results = await Promise.all(promises);
87+
88+
$.export("$summary", `Successfully added ${promises.length} item(s) to lead ${this.leadId}`);
89+
90+
return results.length === 1
91+
? results[0]
92+
: results;
93+
},
94+
};
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import adversus from "../../adversus.app.mjs";
2+
3+
export default {
4+
key: "adversus-assign-to-campaign",
5+
name: "Assign Lead to Campaign",
6+
description: "Assign a lead to a campaign in Adversus. [See the API documentation](https://solutions.adversus.io/api).",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: true,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
adversus,
16+
leadId: {
17+
propDefinition: [
18+
adversus,
19+
"leadId",
20+
],
21+
},
22+
campaignId: {
23+
propDefinition: [
24+
adversus,
25+
"campaignId",
26+
],
27+
},
28+
additionalFields: {
29+
type: "object",
30+
label: "Additional Fields",
31+
description: "Additional fields to include when assigning to campaign",
32+
optional: true,
33+
},
34+
},
35+
/**
36+
* Execute the action to assign a lead to a campaign
37+
* @param {Object} $ - Pipedream context
38+
* @returns {Promise} The response from assigning the lead to campaign
39+
*/
40+
async run({ $ }) {
41+
const response = await this.adversus.assignLeadToCampaign(this.leadId, this.campaignId, {
42+
data: {
43+
...(this.additionalFields || {}),
44+
},
45+
});
46+
47+
$.export("$summary", `Successfully assigned lead ${this.leadId} to campaign ${this.campaignId}`);
48+
49+
return response;
50+
},
51+
};
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import adversus from "../../adversus.app.mjs";
2+
3+
export default {
4+
key: "adversus-change-lead-status",
5+
name: "Change Lead Status",
6+
description: "Change the status of a lead in Adversus. [See the API documentation](https://solutions.adversus.io/api).",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: true,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
adversus,
16+
leadId: {
17+
propDefinition: [
18+
adversus,
19+
"leadId",
20+
],
21+
},
22+
statusId: {
23+
propDefinition: [
24+
adversus,
25+
"statusId",
26+
],
27+
},
28+
additionalFields: {
29+
type: "object",
30+
label: "Additional Fields",
31+
description: "Additional fields to include when changing the status",
32+
optional: true,
33+
},
34+
},
35+
/**
36+
* Execute the action to change a lead's status
37+
* @param {Object} $ - Pipedream context
38+
* @returns {Promise} The response from changing the lead status
39+
*/
40+
async run({ $ }) {
41+
const response = await this.adversus.changeLeadStatus(this.leadId, this.statusId, {
42+
data: {
43+
...(this.additionalFields || {}),
44+
},
45+
});
46+
47+
$.export("$summary", `Successfully changed status of lead ${this.leadId} to status ${this.statusId}`);
48+
49+
return response;
50+
},
51+
};
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import adversus from "../../adversus.app.mjs";
2+
3+
export default {
4+
key: "adversus-create-or-update-lead",
5+
name: "Create or Update Lead",
6+
description: "Create a new lead or update an existing lead in Adversus. [See the API documentation](https://solutions.adversus.io/api).",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: true,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
adversus,
16+
firstName: {
17+
type: "string",
18+
label: "First Name",
19+
description: "The first name of the lead",
20+
optional: true,
21+
},
22+
lastName: {
23+
type: "string",
24+
label: "Last Name",
25+
description: "The last name of the lead",
26+
optional: true,
27+
},
28+
email: {
29+
type: "string",
30+
label: "Email",
31+
description: "The email address of the lead",
32+
optional: true,
33+
},
34+
phone: {
35+
type: "string",
36+
label: "Phone",
37+
description: "The phone number of the lead",
38+
optional: true,
39+
},
40+
leadId: {
41+
propDefinition: [
42+
adversus,
43+
"leadId",
44+
],
45+
description: "The ID of the lead to update (leave empty to create a new lead)",
46+
optional: true,
47+
},
48+
additionalFields: {
49+
type: "object",
50+
label: "Additional Fields",
51+
description: "Additional fields to include in the lead data",
52+
optional: true,
53+
},
54+
},
55+
/**
56+
* Execute the action to create or update a lead
57+
* @param {Object} $ - Pipedream context
58+
* @returns {Promise} The created or updated lead response
59+
*/
60+
async run({ $ }) {
61+
const data = {
62+
...(this.firstName && {
63+
firstName: this.firstName,
64+
}),
65+
66+
...(this.lastName && {
67+
lastName: this.lastName,
68+
}),
69+
...(this.email && {
70+
email: this.email,
71+
}),
72+
...(this.phone && {
73+
phone: this.phone,
74+
}),
75+
...(this.additionalFields || {}),
76+
};
77+
78+
if (!Object.keys(data).length) {
79+
throw new Error("At least one field must be provided to create or update a lead. Please provide firstName, lastName, email, phone, or additionalFields.");
80+
}
81+
82+
const response = this.leadId
83+
? await this.adversus.updateLead(this.leadId, {
84+
data,
85+
})
86+
: await this.adversus.createLead({
87+
data,
88+
});
89+
90+
$.export("$summary", this.leadId
91+
? `Successfully updated lead ${this.leadId}`
92+
: "Successfully created new lead");
93+
94+
return response;
95+
},
96+
};

0 commit comments

Comments
 (0)