Skip to content

Commit 09c04e4

Browse files
authored
New Components - companyhub (#16661)
* new components * fix summary
1 parent 229e216 commit 09c04e4

File tree

11 files changed

+689
-5
lines changed

11 files changed

+689
-5
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import companyhub from "../../companyhub.app.mjs";
2+
3+
export default {
4+
key: "companyhub-create-company",
5+
name: "Create Company",
6+
description: "Creates a new company. [See the documentation](https://companyhub.com/docs/api-documentation)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
companyhub,
11+
name: {
12+
type: "string",
13+
label: "Name",
14+
description: "The name of the company",
15+
},
16+
website: {
17+
type: "string",
18+
label: "Website",
19+
description: "The website URL of the company",
20+
optional: true,
21+
},
22+
phone: {
23+
type: "string",
24+
label: "Phone",
25+
description: "The phone number of the company",
26+
optional: true,
27+
},
28+
description: {
29+
type: "string",
30+
label: "Description",
31+
description: "A description of the company",
32+
optional: true,
33+
},
34+
billingStreet: {
35+
type: "string",
36+
label: "Billing Street",
37+
description: "The billing street address",
38+
optional: true,
39+
},
40+
billingCity: {
41+
type: "string",
42+
label: "Billing City",
43+
description: "The billing city",
44+
optional: true,
45+
},
46+
billingState: {
47+
type: "string",
48+
label: "Billing State",
49+
description: "The billing state/province",
50+
optional: true,
51+
},
52+
billingCountry: {
53+
type: "string",
54+
label: "Billing Country",
55+
description: "The billing country",
56+
optional: true,
57+
},
58+
billingPostalCode: {
59+
type: "string",
60+
label: "Billing Postal Code",
61+
description: "The billing postal/zip code",
62+
optional: true,
63+
},
64+
shippingStreet: {
65+
type: "string",
66+
label: "Shipping Street",
67+
description: "The shipping street address",
68+
optional: true,
69+
},
70+
shippingCity: {
71+
type: "string",
72+
label: "Shipping City",
73+
description: "The shipping city",
74+
optional: true,
75+
},
76+
shippingState: {
77+
type: "string",
78+
label: "Shipping State",
79+
description: "The shipping state/province",
80+
optional: true,
81+
},
82+
shippingCountry: {
83+
type: "string",
84+
label: "Shipping Country",
85+
description: "The shipping country",
86+
optional: true,
87+
},
88+
shippingPostalCode: {
89+
type: "string",
90+
label: "Shipping Postal Code",
91+
description: "The shipping postal/zip code",
92+
optional: true,
93+
},
94+
},
95+
async run({ $ }) {
96+
const response = await this.companyhub.createCompany({
97+
$,
98+
data: {
99+
Name: this.name,
100+
Website: this.website,
101+
Phone: this.phone,
102+
Description: this.description,
103+
BillingStreet: this.billingStreet,
104+
BillingCity: this.billingCity,
105+
BillingState: this.billingState,
106+
BillingCountry: this.billingCountry,
107+
BillingPostalCode: this.billingPostalCode,
108+
ShippingStreet: this.shippingStreet,
109+
ShippingCity: this.shippingCity,
110+
ShippingState: this.shippingState,
111+
ShippingCountry: this.shippingCountry,
112+
ShippingPostalCode: this.shippingPostalCode,
113+
},
114+
});
115+
if (response.Success) {
116+
$.export("$summary", `Successfully created company with ID: ${response.Id}`);
117+
}
118+
return response;
119+
},
120+
};
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
import companyhub from "../../companyhub.app.mjs";
2+
3+
export default {
4+
key: "companyhub-create-contact",
5+
name: "Create Contact",
6+
description: "Creates a new contact. [See the documentation](https://companyhub.com/docs/api-documentation)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
companyhub,
11+
firstName: {
12+
type: "string",
13+
label: "First Name",
14+
description: "The first name of the contact",
15+
},
16+
lastName: {
17+
type: "string",
18+
label: "Last Name",
19+
description: "The last name of the contact",
20+
},
21+
email: {
22+
type: "string",
23+
label: "Email",
24+
description: "The email address of the contact",
25+
optional: true,
26+
},
27+
companyId: {
28+
propDefinition: [
29+
companyhub,
30+
"companyId",
31+
],
32+
},
33+
phone: {
34+
type: "string",
35+
label: "Phone Number",
36+
description: "The phone number of the contact",
37+
optional: true,
38+
},
39+
designation: {
40+
type: "string",
41+
label: "Designation",
42+
description: "The designation of the contact",
43+
optional: true,
44+
},
45+
description: {
46+
type: "string",
47+
label: "Description",
48+
description: "The description of the contact",
49+
optional: true,
50+
},
51+
source: {
52+
type: "string",
53+
label: "Source",
54+
description: "The source of the contact",
55+
optional: true,
56+
options: [
57+
"Web",
58+
"Call",
59+
"Referral",
60+
"Other",
61+
],
62+
},
63+
nextFollowUpDate: {
64+
type: "string",
65+
label: "Next Follow Up Date",
66+
description: "The next follow up date with the contact. E.g. `2025-03-14T00:00:00`",
67+
optional: true,
68+
},
69+
hasOptedOutOfEmails: {
70+
type: "boolean",
71+
label: "Has Opted Out of Emails",
72+
description: "Whether the contact has opted out of emails",
73+
optional: true,
74+
},
75+
street: {
76+
type: "string",
77+
label: "Street Address",
78+
description: "The street address of the contact",
79+
optional: true,
80+
},
81+
city: {
82+
type: "string",
83+
label: "City",
84+
description: "The city where the contact is located",
85+
optional: true,
86+
},
87+
state: {
88+
type: "string",
89+
label: "State/Province",
90+
description: "The state or province where the contact is located",
91+
optional: true,
92+
},
93+
country: {
94+
type: "string",
95+
label: "Country",
96+
description: "The country where the contact is located",
97+
optional: true,
98+
},
99+
postalCode: {
100+
type: "string",
101+
label: "Postal Code",
102+
description: "The postal code of the contact's address",
103+
optional: true,
104+
},
105+
},
106+
async run({ $ }) {
107+
const response = await this.companyhub.createContact({
108+
$,
109+
data: {
110+
FirstName: this.firstName,
111+
LastName: this.lastName,
112+
Email: this.email,
113+
Company: this.companyId,
114+
Phone: this.phone,
115+
Designation: this.designation,
116+
Description: this.description,
117+
Source: this.source,
118+
NextFollowUpDate: this.nextFollowUpDate,
119+
HasOptedOutOfEmails: this.hasOptedOutOfEmails,
120+
Street: this.street,
121+
City: this.city,
122+
State: this.state,
123+
Country: this.country,
124+
PostalCode: this.postalCode,
125+
},
126+
});
127+
if (response.Success) {
128+
$.export("$summary", `Successfully created contact with ID: ${response.Id}`);
129+
}
130+
return response;
131+
},
132+
};
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import companyhub from "../../companyhub.app.mjs";
2+
3+
export default {
4+
key: "companyhub-create-deal",
5+
name: "Create Deal",
6+
description: "Creates a new deal. [See the documentation](https://companyhub.com/docs/api-documentation)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
companyhub,
11+
name: {
12+
type: "string",
13+
label: "Deal Name",
14+
description: "The name of the deal",
15+
},
16+
stage: {
17+
type: "string",
18+
label: "Deal Stage",
19+
description: "The stage of the deal",
20+
options: [
21+
"Prospecting",
22+
"Qualification",
23+
"Discussion",
24+
"Proposal",
25+
"Review",
26+
"Closed Won",
27+
"Closed Lost",
28+
],
29+
},
30+
companyId: {
31+
propDefinition: [
32+
companyhub,
33+
"companyId",
34+
],
35+
},
36+
contactId: {
37+
propDefinition: [
38+
companyhub,
39+
"contactId",
40+
],
41+
},
42+
amount: {
43+
type: "string",
44+
label: "Amount",
45+
description: "The amount of the deal",
46+
optional: true,
47+
},
48+
closeDate: {
49+
type: "string",
50+
label: "Expected Close Date",
51+
description: "The expected close date of the deal in ISO-8601 format. E.g. `2025-03-14T00:00:00`",
52+
optional: true,
53+
},
54+
},
55+
async run({ $ }) {
56+
const response = await this.companyhub.createDeal({
57+
$,
58+
data: {
59+
Name: this.name,
60+
Company: this.companyId,
61+
Contact: this.contactId,
62+
Stage: this.stage,
63+
Amount: this.amount,
64+
CloseDate: this.closeDate,
65+
},
66+
});
67+
if (response.Success) {
68+
$.export("$summary", `Successfully created deal with ID: ${response.Id}`);
69+
}
70+
return response;
71+
},
72+
};

0 commit comments

Comments
 (0)