Skip to content

Add HubSpot conversation threads with internal notes support #17607

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "hubspot-add-contact-to-list",
name: "Add Contact to List",
description: "Adds a contact to a specific static list. [See the documentation](https://legacydocs.hubspot.com/docs/methods/lists/add_contact_to_list)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
hubspot,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import hubspot from "../../hubspot.app.mjs";

export default {
key: "hubspot-add-conversation-comment",
name: "Add Conversation Comment (Internal Note)",
description: "Add an internal comment to a HubSpot conversation thread. Internal comments are only visible to team members. [See the documentation](https://developers.hubspot.com/docs/api/conversations/threads)",
version: "0.0.1",
type: "action",
props: {
hubspot,
threadId: {
propDefinition: [
hubspot,
"threadId",
],
},
text: {
type: "string",
label: "Comment Text",
description: "The plain text content of the internal comment",
},
richText: {
type: "string",
label: "Rich Text",
description: "The rich text/HTML content of the internal comment",
optional: true,
},
},
async run({ $ }) {
if (!this.text?.trim()) {
throw new Error("Comment text cannot be empty");
}

const response = await this.hubspot.addConversationComment({
threadId: this.threadId,
data: {
text: this.text,
richText: this.richText || this.text,
type: "COMMENT",
},
$,
});

$.export("$summary", `Successfully added internal comment to conversation thread ${this.threadId}`);
return response;
},
};

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "hubspot-batch-create-or-update-contact",
name: "Batch Create or Update Contact",
description: "Create or update a batch of contacts by its ID or email. [See the documentation](https://developers.hubspot.com/docs/api/crm/contacts)",
version: "0.0.14",
version: "0.0.15",
type: "action",
props: {
hubspot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "hubspot-create-associations",
name: "Create Associations",
description: "Create associations between objects. [See the documentation](https://developers.hubspot.com/docs/api/crm/associations#endpoint?spec=POST-/crm/v3/associations/{fromObjectType}/{toObjectType}/batch/create)",
version: "1.0.3",
version: "1.0.4",
type: "action",
props: {
hubspot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "hubspot-create-communication",
name: "Create Communication",
description: "Create a WhatsApp, LinkedIn, or SMS message. [See the documentation](https://developers.hubspot.com/beta-docs/reference/api/crm/engagements/communications/v3#post-%2Fcrm%2Fv3%2Fobjects%2Fcommunications)",
version: "0.0.10",
version: "0.0.11",
type: "action",
props: {
...appProp.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-company",
name: "Create Company",
description: "Create a company in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/companies#endpoint?spec=POST-/crm/v3/objects/companies)",
version: "0.0.21",
version: "0.0.22",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-custom-object",
name: "Create Custom Object",
description: "Create a new custom object in Hubspot. [See the documentation](https://developers.hubspot.com/beta-docs/guides/api/crm/objects/custom-objects#create-a-custom-object)",
version: "1.0.3",
version: "1.0.4",
type: "action",
props: {
...appProp.props,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/create-deal/create-deal.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-deal",
name: "Create Deal",
description: "Create a deal in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/deals#endpoint?spec=POST-/crm/v3/objects/deals)",
version: "0.0.21",
version: "0.0.22",
type: "action",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "hubspot-create-engagement",
name: "Create Engagement",
description: "Create a new engagement for a contact. [See the documentation](https://developers.hubspot.com/docs/api/crm/engagements)",
version: "0.0.20",
version: "0.0.21",
type: "action",
props: {
...common.props,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/create-lead/create-lead.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "hubspot-create-lead",
name: "Create Lead",
description: "Create a lead in Hubspot. [See the documentation](https://developers.hubspot.com/beta-docs/guides/api/crm/objects/leads#create-leads)",
version: "0.0.9",
version: "0.0.10",
type: "action",
props: {
...appProp.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
key: "hubspot-create-meeting",
name: "Create Meeting",
description: "Creates a new meeting with optional associations to other objects. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/engagements/meetings#post-%2Fcrm%2Fv3%2Fobjects%2Fmeetings)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-or-update-contact",
name: "Create or Update Contact",
description: "Create or update a contact in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/contacts#endpoint?spec=POST-/crm/v3/objects/contacts)",
version: "0.0.19",
version: "0.0.20",
type: "action",
props: {
...common.props,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/create-task/create-task.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-create-task",
name: "Create Task",
description: "Create a new task. [See the documentation](https://developers.hubspot.com/docs/api/crm/engagements)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
...common.props,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/create-ticket/create-ticket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-ticket",
name: "Create Ticket",
description: "Create a ticket in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/tickets)",
version: "0.0.12",
version: "0.0.13",
type: "action",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "hubspot-enroll-contact-into-workflow",
name: "Enroll Contact Into Workflow",
description: "Add a contact to a workflow. Note: The Workflows API currently only supports contact-based workflows and is only available for Marketing Hub Enterprise accounts. [See the documentation](https://legacydocs.hubspot.com/docs/methods/workflows/add_contact)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
hubspot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-get-associated-meetings",
name: "Get Associated Meetings",
description: "Retrieves meetings associated with a specific object (contact, company, or deal) with optional time filtering. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/associations/association-details#get-%2Fcrm%2Fv4%2Fobjects%2F%7Bobjecttype%7D%2F%7Bobjectid%7D%2Fassociations%2F%7Btoobjecttype%7D)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
hubspot,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/get-company/get-company.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-get-company",
name: "Get Company",
description: "Gets a company. [See the documentation](https://developers.hubspot.com/docs/api/crm/companies#endpoint?spec=GET-/crm/v3/objects/companies/{companyId})",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
...common.props,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/get-contact/get-contact.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-get-contact",
name: "Get Contact",
description: "Gets a contact. [See the documentation](https://developers.hubspot.com/docs/api/crm/contacts#endpoint?spec=GET-/crm/v3/objects/contacts/{contactId})",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
...common.props,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/get-deal/get-deal.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-get-deal",
name: "Get Deal",
description: "Gets a deal. [See the documentation](https://developers.hubspot.com/docs/api/crm/deals#endpoint?spec=GET-/crm/v3/objects/deals/{dealId})",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "hubspot-get-file-public-url",
name: "Get File Public URL",
description: "Get a publicly available URL for a file that was uploaded using a Hubspot form. [See the documentation](https://developers.hubspot.com/docs/api/files/files#endpoint?spec=GET-/files/v3/files/{fileId}/signed-url)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
hubspot,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/get-meeting/get-meeting.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-get-meeting",
name: "Get Meeting",
description: "Retrieves a specific meeting by its ID. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/engagements/meetings#get-%2Fcrm%2Fv3%2Fobjects%2Fmeetings%2F%7Bmeetingid%7D)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
...common.props,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/search-crm/search-crm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
key: "hubspot-search-crm",
name: "Search CRM",
description: "Search companies, contacts, deals, feedback submissions, products, tickets, line-items, quotes, leads, or custom objects. [See the documentation](https://developers.hubspot.com/docs/api/crm/search)",
version: "1.0.4",
version: "1.0.5",
type: "action",
props: {
hubspot,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import hubspot from "../../hubspot.app.mjs";

export default {
key: "hubspot-send-conversation-message",
name: "Send Conversation Message",
description: "Send a message to a HubSpot conversation thread. [See the documentation](https://developers.hubspot.com/docs/api/conversations/threads)",
version: "0.0.1",
type: "action",
props: {
hubspot,
threadId: {
propDefinition: [
hubspot,
"threadId",
],
},
text: {
type: "string",
label: "Message Text",
description: "The plain text content of the message",
},
richText: {
type: "string",
label: "Rich Text",
description: "The rich text/HTML content of the message",
optional: true,
},
direction: {
type: "string",
label: "Direction",
description: "The direction of the message",
options: [
{
label: "Outgoing",
value: "OUTGOING",
},
{
label: "Incoming",
value: "INCOMING",
},
],
default: "OUTGOING",
},
},
async run({ $ }) {
if (!this.text?.trim()) {
throw new Error("Message text cannot be empty");
}

const response = await this.hubspot.sendConversationMessage({
threadId: this.threadId,
data: {
text: this.text,
richText: this.richText || this.text,
direction: this.direction,
type: "MESSAGE",
},
$,
});

$.export("$summary", `Successfully sent message to conversation thread ${this.threadId}`);
return response;
},
};

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-update-company",
name: "Update Company",
description: "Update a company in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/companies)",
version: "0.0.17",
version: "0.0.18",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-update-contact",
name: "Update Contact",
description: "Update a contact in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/contacts#endpoint?spec=POST-/crm/v3/objects/contacts)",
version: "0.0.18",
version: "0.0.19",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-update-custom-object",
name: "Update Custom Object",
description: "Update a custom object in Hubspot. [See the documentation](https://developers.hubspot.com/beta-docs/guides/api/crm/objects/custom-objects#update-existing-custom-objects)",
version: "1.0.3",
version: "1.0.4",
type: "action",
methods: {
...common.methods,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/update-deal/update-deal.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-update-deal",
name: "Update Deal",
description: "Update a deal in Hubspot. [See the documentation](https://developers.hubspot.com/beta-docs/guides/api/crm/objects/deals#update-deals)",
version: "0.0.8",
version: "0.0.9",
type: "action",
methods: {
...common.methods,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/update-lead/update-lead.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-update-lead",
name: "Update Lead",
description: "Update a lead in Hubspot. [See the documentation](https://developers.hubspot.com/beta-docs/guides/api/crm/objects/leads#update-leads)",
version: "0.0.9",
version: "0.0.10",
type: "action",
methods: {
...common.methods,
Expand Down
1 change: 1 addition & 0 deletions components/hubspot/common/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const API_PATH = {
DEAL: "/deals/v1",
BUSINESS_UNITS: "/business-units/v3",
MARKETINGV3: "/marketing/v3",
CONVERSATIONS: "/conversations/v3",
};

/** Association categories for association types, as defined by the [Hubspot API
Expand Down
Loading
Loading