Skip to content

Commit 0f19ace

Browse files
committed
salespype init
1 parent a57dd3d commit 0f19ace

File tree

8 files changed

+723
-5
lines changed

8 files changed

+723
-5
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import salespype from "../../salespype.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "salespype-add-contact-to-campaign",
6+
name: "Add Contact to Campaign",
7+
description: "Adds a contact to a campaign. [See the documentation]()",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
salespype,
12+
campaignId: {
13+
propDefinition: [
14+
salespype,
15+
"campaignId",
16+
],
17+
},
18+
contactId: {
19+
propDefinition: [
20+
salespype,
21+
"contactId",
22+
],
23+
},
24+
},
25+
async run({ $ }) {
26+
const response = await this.salespype.addContactToCampaign({
27+
campaignId: this.campaignId,
28+
contactId: this.contactId,
29+
});
30+
$.export("$summary", `Added contact ${this.contactId} to campaign ${this.campaignId}`);
31+
return response;
32+
},
33+
};
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import salespype from "../../salespype.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "salespype-create-contact",
6+
name: "Create Contact",
7+
description: "Creates a new contact in Salespype. [See the documentation]()",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
salespype: {
12+
type: "app",
13+
app: "salespype",
14+
},
15+
firstName: {
16+
propDefinition: [
17+
salespype,
18+
"firstName",
19+
],
20+
},
21+
lastName: {
22+
propDefinition: [
23+
salespype,
24+
"lastName",
25+
],
26+
},
27+
email: {
28+
propDefinition: [
29+
salespype,
30+
"email",
31+
],
32+
},
33+
address: {
34+
propDefinition: [
35+
salespype,
36+
"address",
37+
],
38+
optional: true,
39+
},
40+
city: {
41+
propDefinition: [
42+
salespype,
43+
"city",
44+
],
45+
optional: true,
46+
},
47+
state: {
48+
propDefinition: [
49+
salespype,
50+
"state",
51+
],
52+
optional: true,
53+
},
54+
zip: {
55+
propDefinition: [
56+
salespype,
57+
"zip",
58+
],
59+
optional: true,
60+
},
61+
country: {
62+
propDefinition: [
63+
salespype,
64+
"country",
65+
],
66+
optional: true,
67+
},
68+
companyName: {
69+
propDefinition: [
70+
salespype,
71+
"companyName",
72+
],
73+
optional: true,
74+
},
75+
birthDate: {
76+
propDefinition: [
77+
salespype,
78+
"birthDate",
79+
],
80+
optional: true,
81+
},
82+
},
83+
async run({ $ }) {
84+
const contact = await this.salespype.createContact({
85+
firstName: this.firstName,
86+
lastName: this.lastName,
87+
email: this.email,
88+
address: this.address,
89+
city: this.city,
90+
state: this.state,
91+
zip: this.zip,
92+
country: this.country,
93+
companyName: this.companyName,
94+
birthDate: this.birthDate,
95+
});
96+
$.export("$summary", `Created contact ${contact.first_name} ${contact.last_name} (${contact.email})`);
97+
return contact;
98+
},
99+
};
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import salespype from "../../salespype.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "salespype-create-task",
6+
name: "Create Task",
7+
description: "Creates a new task in Salespype. [See the documentation]()",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
salespype,
12+
contactId: {
13+
propDefinition: [
14+
salespype,
15+
"contactId",
16+
],
17+
},
18+
task: {
19+
propDefinition: [
20+
salespype,
21+
"task",
22+
],
23+
},
24+
taskTypeId: {
25+
propDefinition: [
26+
salespype,
27+
"taskTypeId",
28+
],
29+
},
30+
date: {
31+
propDefinition: [
32+
salespype,
33+
"date",
34+
],
35+
optional: true,
36+
},
37+
time: {
38+
propDefinition: [
39+
salespype,
40+
"time",
41+
],
42+
optional: true,
43+
},
44+
duration: {
45+
propDefinition: [
46+
salespype,
47+
"duration",
48+
],
49+
optional: true,
50+
},
51+
note: {
52+
propDefinition: [
53+
salespype,
54+
"note",
55+
],
56+
optional: true,
57+
},
58+
},
59+
async run({ $ }) {
60+
const taskData = {
61+
contact_id: this.contactId,
62+
task: this.task,
63+
task_type_id: this.taskTypeId,
64+
...(this.date && {
65+
date: this.date,
66+
}),
67+
...(this.time && {
68+
time: this.time,
69+
}),
70+
...(this.duration && {
71+
duration: this.duration,
72+
}),
73+
...(this.note && {
74+
note: this.note,
75+
}),
76+
};
77+
78+
const task = await this.salespype.createTask(taskData);
79+
80+
$.export("$summary", `Created task '${this.task}' with ID ${task.id}`);
81+
return task;
82+
},
83+
};

components/salespype/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
"publishConfig": {
1313
"access": "public"
1414
}
15-
}
15+
}

0 commit comments

Comments
 (0)