Skip to content

New Components - companyhub #16661

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 2 commits into from
May 19, 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
120 changes: 120 additions & 0 deletions components/companyhub/actions/create-company/create-company.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import companyhub from "../../companyhub.app.mjs";

export default {
key: "companyhub-create-company",
name: "Create Company",
description: "Creates a new company. [See the documentation](https://companyhub.com/docs/api-documentation)",
version: "0.0.1",
type: "action",
props: {
companyhub,
name: {
type: "string",
label: "Name",
description: "The name of the company",
},
website: {
type: "string",
label: "Website",
description: "The website URL of the company",
optional: true,
},
phone: {
type: "string",
label: "Phone",
description: "The phone number of the company",
optional: true,
},
description: {
type: "string",
label: "Description",
description: "A description of the company",
optional: true,
},
billingStreet: {
type: "string",
label: "Billing Street",
description: "The billing street address",
optional: true,
},
billingCity: {
type: "string",
label: "Billing City",
description: "The billing city",
optional: true,
},
billingState: {
type: "string",
label: "Billing State",
description: "The billing state/province",
optional: true,
},
billingCountry: {
type: "string",
label: "Billing Country",
description: "The billing country",
optional: true,
},
billingPostalCode: {
type: "string",
label: "Billing Postal Code",
description: "The billing postal/zip code",
optional: true,
},
shippingStreet: {
type: "string",
label: "Shipping Street",
description: "The shipping street address",
optional: true,
},
shippingCity: {
type: "string",
label: "Shipping City",
description: "The shipping city",
optional: true,
},
shippingState: {
type: "string",
label: "Shipping State",
description: "The shipping state/province",
optional: true,
},
shippingCountry: {
type: "string",
label: "Shipping Country",
description: "The shipping country",
optional: true,
},
shippingPostalCode: {
type: "string",
label: "Shipping Postal Code",
description: "The shipping postal/zip code",
optional: true,
},
},
async run({ $ }) {
const response = await this.companyhub.createCompany({
$,
data: {
Name: this.name,
Website: this.website,
Phone: this.phone,
Description: this.description,
BillingStreet: this.billingStreet,
BillingCity: this.billingCity,
BillingState: this.billingState,
BillingCountry: this.billingCountry,
BillingPostalCode: this.billingPostalCode,
ShippingStreet: this.shippingStreet,
ShippingCity: this.shippingCity,
ShippingState: this.shippingState,
ShippingCountry: this.shippingCountry,
ShippingPostalCode: this.shippingPostalCode,
},
});
if (response.Success) {
$.export("$summary", `Successfully created company with ID: ${response.Id}`);
}
return response;
},
};
132 changes: 132 additions & 0 deletions components/companyhub/actions/create-contact/create-contact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import companyhub from "../../companyhub.app.mjs";

export default {
key: "companyhub-create-contact",
name: "Create Contact",
description: "Creates a new contact. [See the documentation](https://companyhub.com/docs/api-documentation)",
version: "0.0.1",
type: "action",
props: {
companyhub,
firstName: {
type: "string",
label: "First Name",
description: "The first name of the contact",
},
lastName: {
type: "string",
label: "Last Name",
description: "The last name of the contact",
},
email: {
type: "string",
label: "Email",
description: "The email address of the contact",
optional: true,
},
companyId: {
propDefinition: [
companyhub,
"companyId",
],
},
phone: {
type: "string",
label: "Phone Number",
description: "The phone number of the contact",
optional: true,
},
designation: {
type: "string",
label: "Designation",
description: "The designation of the contact",
optional: true,
},
description: {
type: "string",
label: "Description",
description: "The description of the contact",
optional: true,
},
source: {
type: "string",
label: "Source",
description: "The source of the contact",
optional: true,
options: [
"Web",
"Call",
"Referral",
"Other",
],
},
nextFollowUpDate: {
type: "string",
label: "Next Follow Up Date",
description: "The next follow up date with the contact. E.g. `2025-03-14T00:00:00`",
optional: true,
},
hasOptedOutOfEmails: {
type: "boolean",
label: "Has Opted Out of Emails",
description: "Whether the contact has opted out of emails",
optional: true,
},
street: {
type: "string",
label: "Street Address",
description: "The street address of the contact",
optional: true,
},
city: {
type: "string",
label: "City",
description: "The city where the contact is located",
optional: true,
},
state: {
type: "string",
label: "State/Province",
description: "The state or province where the contact is located",
optional: true,
},
country: {
type: "string",
label: "Country",
description: "The country where the contact is located",
optional: true,
},
postalCode: {
type: "string",
label: "Postal Code",
description: "The postal code of the contact's address",
optional: true,
},
},
async run({ $ }) {
const response = await this.companyhub.createContact({
$,
data: {
FirstName: this.firstName,
LastName: this.lastName,
Email: this.email,
Company: this.companyId,
Phone: this.phone,
Designation: this.designation,
Description: this.description,
Source: this.source,
NextFollowUpDate: this.nextFollowUpDate,
HasOptedOutOfEmails: this.hasOptedOutOfEmails,
Street: this.street,
City: this.city,
State: this.state,
Country: this.country,
PostalCode: this.postalCode,
},
});
if (response.Success) {
$.export("$summary", `Successfully created contact with ID: ${response.Id}`);
}
return response;
},
};
72 changes: 72 additions & 0 deletions components/companyhub/actions/create-deal/create-deal.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import companyhub from "../../companyhub.app.mjs";

export default {
key: "companyhub-create-deal",
name: "Create Deal",
description: "Creates a new deal. [See the documentation](https://companyhub.com/docs/api-documentation)",
version: "0.0.1",
type: "action",
props: {
companyhub,
name: {
type: "string",
label: "Deal Name",
description: "The name of the deal",
},
stage: {
type: "string",
label: "Deal Stage",
description: "The stage of the deal",
options: [
"Prospecting",
"Qualification",
"Discussion",
"Proposal",
"Review",
"Closed Won",
"Closed Lost",
],
},
companyId: {
propDefinition: [
companyhub,
"companyId",
],
},
contactId: {
propDefinition: [
companyhub,
"contactId",
],
},
amount: {
type: "string",
label: "Amount",
description: "The amount of the deal",
optional: true,
},
closeDate: {
type: "string",
label: "Expected Close Date",
description: "The expected close date of the deal in ISO-8601 format. E.g. `2025-03-14T00:00:00`",
optional: true,
},
},
async run({ $ }) {
const response = await this.companyhub.createDeal({
$,
data: {
Name: this.name,
Company: this.companyId,
Contact: this.contactId,
Stage: this.stage,
Amount: this.amount,
CloseDate: this.closeDate,
},
});
if (response.Success) {
$.export("$summary", `Successfully created deal with ID: ${response.Id}`);
}
return response;
},
};
Loading
Loading