diff --git a/components/hubspot/actions/add-contact-to-list/add-contact-to-list.mjs b/components/hubspot/actions/add-contact-to-list/add-contact-to-list.mjs index 1b3001f53db44..d7c3401b730c6 100644 --- a/components/hubspot/actions/add-contact-to-list/add-contact-to-list.mjs +++ b/components/hubspot/actions/add-contact-to-list/add-contact-to-list.mjs @@ -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, diff --git a/components/hubspot/actions/add-conversation-comment/add-conversation-comment.mjs b/components/hubspot/actions/add-conversation-comment/add-conversation-comment.mjs new file mode 100644 index 0000000000000..785d496cea924 --- /dev/null +++ b/components/hubspot/actions/add-conversation-comment/add-conversation-comment.mjs @@ -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; + }, +}; + diff --git a/components/hubspot/actions/batch-create-or-update-contact/batch-create-or-update-contact.mjs b/components/hubspot/actions/batch-create-or-update-contact/batch-create-or-update-contact.mjs index a30d0ac32fc87..72241e603e45f 100644 --- a/components/hubspot/actions/batch-create-or-update-contact/batch-create-or-update-contact.mjs +++ b/components/hubspot/actions/batch-create-or-update-contact/batch-create-or-update-contact.mjs @@ -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, diff --git a/components/hubspot/actions/create-associations/create-associations.mjs b/components/hubspot/actions/create-associations/create-associations.mjs index aae5d7444d36e..d657ee19df368 100644 --- a/components/hubspot/actions/create-associations/create-associations.mjs +++ b/components/hubspot/actions/create-associations/create-associations.mjs @@ -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, diff --git a/components/hubspot/actions/create-communication/create-communication.mjs b/components/hubspot/actions/create-communication/create-communication.mjs index dbda8a1e88c97..bcdc207a462fc 100644 --- a/components/hubspot/actions/create-communication/create-communication.mjs +++ b/components/hubspot/actions/create-communication/create-communication.mjs @@ -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, diff --git a/components/hubspot/actions/create-company/create-company.mjs b/components/hubspot/actions/create-company/create-company.mjs index 6609f59d7fdb1..1f14f84939ccb 100644 --- a/components/hubspot/actions/create-company/create-company.mjs +++ b/components/hubspot/actions/create-company/create-company.mjs @@ -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, diff --git a/components/hubspot/actions/create-custom-object/create-custom-object.mjs b/components/hubspot/actions/create-custom-object/create-custom-object.mjs index 34534cb0345ba..404ce1021f180 100644 --- a/components/hubspot/actions/create-custom-object/create-custom-object.mjs +++ b/components/hubspot/actions/create-custom-object/create-custom-object.mjs @@ -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, diff --git a/components/hubspot/actions/create-deal/create-deal.mjs b/components/hubspot/actions/create-deal/create-deal.mjs index cd136e3aead9b..3b5432119ca27 100644 --- a/components/hubspot/actions/create-deal/create-deal.mjs +++ b/components/hubspot/actions/create-deal/create-deal.mjs @@ -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, diff --git a/components/hubspot/actions/create-engagement/create-engagement.mjs b/components/hubspot/actions/create-engagement/create-engagement.mjs index 2cc80b10eaae9..7b4c6725a1cce 100644 --- a/components/hubspot/actions/create-engagement/create-engagement.mjs +++ b/components/hubspot/actions/create-engagement/create-engagement.mjs @@ -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, diff --git a/components/hubspot/actions/create-lead/create-lead.mjs b/components/hubspot/actions/create-lead/create-lead.mjs index e1ed71cf9e361..803a647f60af6 100644 --- a/components/hubspot/actions/create-lead/create-lead.mjs +++ b/components/hubspot/actions/create-lead/create-lead.mjs @@ -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, diff --git a/components/hubspot/actions/create-meeting/create-meeting.mjs b/components/hubspot/actions/create-meeting/create-meeting.mjs index 7de8e706116f6..82e814e13575d 100644 --- a/components/hubspot/actions/create-meeting/create-meeting.mjs +++ b/components/hubspot/actions/create-meeting/create-meeting.mjs @@ -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, diff --git a/components/hubspot/actions/create-or-update-contact/create-or-update-contact.mjs b/components/hubspot/actions/create-or-update-contact/create-or-update-contact.mjs index 8a1bfafd2ce3b..7c746fa99cdf5 100644 --- a/components/hubspot/actions/create-or-update-contact/create-or-update-contact.mjs +++ b/components/hubspot/actions/create-or-update-contact/create-or-update-contact.mjs @@ -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, diff --git a/components/hubspot/actions/create-task/create-task.mjs b/components/hubspot/actions/create-task/create-task.mjs index 118992a8b585a..306d7c7336a51 100644 --- a/components/hubspot/actions/create-task/create-task.mjs +++ b/components/hubspot/actions/create-task/create-task.mjs @@ -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, diff --git a/components/hubspot/actions/create-ticket/create-ticket.mjs b/components/hubspot/actions/create-ticket/create-ticket.mjs index 18cc6aa3db3a1..0c051233a7f30 100644 --- a/components/hubspot/actions/create-ticket/create-ticket.mjs +++ b/components/hubspot/actions/create-ticket/create-ticket.mjs @@ -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, diff --git a/components/hubspot/actions/enroll-contact-into-workflow/enroll-contact-into-workflow.mjs b/components/hubspot/actions/enroll-contact-into-workflow/enroll-contact-into-workflow.mjs index 5ffca89f93742..4e6d7ca72ac88 100644 --- a/components/hubspot/actions/enroll-contact-into-workflow/enroll-contact-into-workflow.mjs +++ b/components/hubspot/actions/enroll-contact-into-workflow/enroll-contact-into-workflow.mjs @@ -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, diff --git a/components/hubspot/actions/get-associated-meetings/get-associated-meetings.mjs b/components/hubspot/actions/get-associated-meetings/get-associated-meetings.mjs index a67f10cf131eb..9fcdfa18e1b64 100644 --- a/components/hubspot/actions/get-associated-meetings/get-associated-meetings.mjs +++ b/components/hubspot/actions/get-associated-meetings/get-associated-meetings.mjs @@ -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, diff --git a/components/hubspot/actions/get-company/get-company.mjs b/components/hubspot/actions/get-company/get-company.mjs index b5c8dfad731bd..429b0152c4176 100644 --- a/components/hubspot/actions/get-company/get-company.mjs +++ b/components/hubspot/actions/get-company/get-company.mjs @@ -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, diff --git a/components/hubspot/actions/get-contact/get-contact.mjs b/components/hubspot/actions/get-contact/get-contact.mjs index b0fa9d37ac331..3b3e763d57dc9 100644 --- a/components/hubspot/actions/get-contact/get-contact.mjs +++ b/components/hubspot/actions/get-contact/get-contact.mjs @@ -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, diff --git a/components/hubspot/actions/get-deal/get-deal.mjs b/components/hubspot/actions/get-deal/get-deal.mjs index 4de1330f99fb7..de373ad78dc62 100644 --- a/components/hubspot/actions/get-deal/get-deal.mjs +++ b/components/hubspot/actions/get-deal/get-deal.mjs @@ -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, diff --git a/components/hubspot/actions/get-file-public-url/get-file-public-url.mjs b/components/hubspot/actions/get-file-public-url/get-file-public-url.mjs index 8e58fe44b8245..740629ccc28a8 100644 --- a/components/hubspot/actions/get-file-public-url/get-file-public-url.mjs +++ b/components/hubspot/actions/get-file-public-url/get-file-public-url.mjs @@ -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, diff --git a/components/hubspot/actions/get-meeting/get-meeting.mjs b/components/hubspot/actions/get-meeting/get-meeting.mjs index 94700517b62df..b6f5e97d50ba8 100644 --- a/components/hubspot/actions/get-meeting/get-meeting.mjs +++ b/components/hubspot/actions/get-meeting/get-meeting.mjs @@ -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, diff --git a/components/hubspot/actions/search-crm/search-crm.mjs b/components/hubspot/actions/search-crm/search-crm.mjs index 5cbd33258d008..86a79ae6ab742 100644 --- a/components/hubspot/actions/search-crm/search-crm.mjs +++ b/components/hubspot/actions/search-crm/search-crm.mjs @@ -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, diff --git a/components/hubspot/actions/send-conversation-message/send-conversation-message.mjs b/components/hubspot/actions/send-conversation-message/send-conversation-message.mjs new file mode 100644 index 0000000000000..c429bbb2c3b96 --- /dev/null +++ b/components/hubspot/actions/send-conversation-message/send-conversation-message.mjs @@ -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; + }, +}; + diff --git a/components/hubspot/actions/update-company/update-company.mjs b/components/hubspot/actions/update-company/update-company.mjs index 6055b780ebe89..49640f68a42cb 100644 --- a/components/hubspot/actions/update-company/update-company.mjs +++ b/components/hubspot/actions/update-company/update-company.mjs @@ -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, diff --git a/components/hubspot/actions/update-contact/update-contact.mjs b/components/hubspot/actions/update-contact/update-contact.mjs index c76842e97a82e..1687c8d7e795a 100644 --- a/components/hubspot/actions/update-contact/update-contact.mjs +++ b/components/hubspot/actions/update-contact/update-contact.mjs @@ -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, diff --git a/components/hubspot/actions/update-custom-object/update-custom-object.mjs b/components/hubspot/actions/update-custom-object/update-custom-object.mjs index bc4f7d55f8490..b4d651b38892b 100644 --- a/components/hubspot/actions/update-custom-object/update-custom-object.mjs +++ b/components/hubspot/actions/update-custom-object/update-custom-object.mjs @@ -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, diff --git a/components/hubspot/actions/update-deal/update-deal.mjs b/components/hubspot/actions/update-deal/update-deal.mjs index 357518d10c3ca..0fe8caf1f62bc 100644 --- a/components/hubspot/actions/update-deal/update-deal.mjs +++ b/components/hubspot/actions/update-deal/update-deal.mjs @@ -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, diff --git a/components/hubspot/actions/update-lead/update-lead.mjs b/components/hubspot/actions/update-lead/update-lead.mjs index 5fd447d95cbd1..870f3d73ad0cb 100644 --- a/components/hubspot/actions/update-lead/update-lead.mjs +++ b/components/hubspot/actions/update-lead/update-lead.mjs @@ -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, diff --git a/components/hubspot/common/constants.mjs b/components/hubspot/common/constants.mjs index 3301483f693cc..2cf201c24f0f9 100644 --- a/components/hubspot/common/constants.mjs +++ b/components/hubspot/common/constants.mjs @@ -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 diff --git a/components/hubspot/hubspot.app.mjs b/components/hubspot/hubspot.app.mjs index 06299b1ef8b48..d38514780495d 100644 --- a/components/hubspot/hubspot.app.mjs +++ b/components/hubspot/hubspot.app.mjs @@ -124,6 +124,11 @@ export default { : []; }, }, + threadId: { + type: "string", + label: "Thread ID", + description: "HubSpot conversation thread ID", + }, objectIds: { type: "string[]", label: "Object", @@ -1142,5 +1147,67 @@ export default { ...opts, }); }, + /** + * Get conversation thread details + * @param {string} threadId - The ID of the conversation thread + * @param {object} opts - Additional options to pass to the request + * @returns {Promise} The conversation thread object + */ + getConversationThread({ + threadId, ...opts + }) { + return this.makeRequest({ + api: API_PATH.CONVERSATIONS, + endpoint: `/conversations/threads/${threadId}`, + ...opts, + }); + }, + /** + * Get messages from a conversation thread + * @param {string} threadId - The ID of the conversation thread + * @param {object} opts - Additional options to pass to the request + * @returns {Promise} The messages in the conversation thread + */ + getConversationMessages({ + threadId, ...opts + }) { + return this.makeRequest({ + api: API_PATH.CONVERSATIONS, + endpoint: `/conversations/threads/${threadId}/messages`, + ...opts, + }); + }, + /** + * Send a message to a conversation thread + * @param {string} threadId - The ID of the conversation thread + * @param {object} opts - Message data and request options + * @returns {Promise} The sent message object + */ + sendConversationMessage({ + threadId, ...opts + }) { + return this.makeRequest({ + api: API_PATH.CONVERSATIONS, + endpoint: `/conversations/threads/${threadId}/messages`, + method: "POST", + ...opts, + }); + }, + /** + * Add an internal comment to a conversation thread + * @param {string} threadId - The ID of the conversation thread + * @param {object} opts - Comment data and request options + * @returns {Promise} The added comment object + */ + addConversationComment({ + threadId, ...opts + }) { + return this.makeRequest({ + api: API_PATH.CONVERSATIONS, + endpoint: `/conversations/threads/${threadId}/messages`, + method: "POST", + ...opts, + }); + }, }, }; diff --git a/components/hubspot/package.json b/components/hubspot/package.json index 97609a3e714b9..04364b264bb92 100644 --- a/components/hubspot/package.json +++ b/components/hubspot/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/hubspot", - "version": "1.2.4", + "version": "1.2.5", "description": "Pipedream Hubspot Components", "main": "hubspot.app.mjs", "keywords": [ diff --git a/components/hubspot/sources/delete-blog-article/delete-blog-article.mjs b/components/hubspot/sources/delete-blog-article/delete-blog-article.mjs index 945dab8c735af..7a1985e6bc8fb 100644 --- a/components/hubspot/sources/delete-blog-article/delete-blog-article.mjs +++ b/components/hubspot/sources/delete-blog-article/delete-blog-article.mjs @@ -6,7 +6,7 @@ export default { key: "hubspot-delete-blog-article", name: "Deleted Blog Posts", description: "Emit new event for each deleted blog post.", - version: "0.0.23", + version: "0.0.24", dedupe: "unique", type: "source", methods: { diff --git a/components/hubspot/sources/new-company-property-change/new-company-property-change.mjs b/components/hubspot/sources/new-company-property-change/new-company-property-change.mjs index 3dfb8662f41d6..4765b8634fe7b 100644 --- a/components/hubspot/sources/new-company-property-change/new-company-property-change.mjs +++ b/components/hubspot/sources/new-company-property-change/new-company-property-change.mjs @@ -7,7 +7,7 @@ export default { key: "hubspot-new-company-property-change", name: "New Company Property Change", description: "Emit new event when a specified property is provided or updated on a company. [See the documentation](https://developers.hubspot.com/docs/api/crm/companies)", - version: "0.0.16", + version: "0.0.17", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-contact-property-change/new-contact-property-change.mjs b/components/hubspot/sources/new-contact-property-change/new-contact-property-change.mjs index d0e0df4689add..080f874394f6b 100644 --- a/components/hubspot/sources/new-contact-property-change/new-contact-property-change.mjs +++ b/components/hubspot/sources/new-contact-property-change/new-contact-property-change.mjs @@ -7,7 +7,7 @@ export default { key: "hubspot-new-contact-property-change", name: "New Contact Property Change", description: "Emit new event when a specified property is provided or updated on a contact. [See the documentation](https://developers.hubspot.com/docs/api/crm/contacts)", - version: "0.0.18", + version: "0.0.19", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-conversation-comment/new-conversation-comment.mjs b/components/hubspot/sources/new-conversation-comment/new-conversation-comment.mjs new file mode 100644 index 0000000000000..f97a648f396df --- /dev/null +++ b/components/hubspot/sources/new-conversation-comment/new-conversation-comment.mjs @@ -0,0 +1,62 @@ +import common from "../common/common.mjs"; + +export default { + ...common, + key: "hubspot-new-conversation-comment", + name: "New Conversation Comment (Internal Note)", + description: "Emit new event when a new internal comment is added to a HubSpot conversation thread. [See the documentation](https://developers.hubspot.com/docs/api/conversations/threads)", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + threadId: { + propDefinition: [ + common.props.hubspot, + "threadId", + ], + description: "The ID of the conversation thread to monitor for internal comments", + }, + }, + methods: { + ...common.methods, + getTs(comment) { + return Date.parse(comment.createdAt); + }, + generateMeta(comment) { + return { + id: comment.id, + summary: `New Internal Comment: ${comment.text || comment.id}`, + ts: this.getTs(comment), + }; + }, + isRelevant(comment, createdAfter) { + const isAfterTimestamp = this.getTs(comment) > createdAfter; + const isComment = comment.type === "COMMENT"; + + return isAfterTimestamp && isComment; + }, + async getParams() { + return { + params: { + limit: 100, + }, + }; + }, + async processResults(after, params) { + const createdAfter = after || this.getLastCreatedAt(); + + // Get messages from the specified thread + const messages = await this.hubspot.getConversationMessages({ + threadId: this.threadId, + ...params, + }); + + const comments = messages.results?.filter((msg) => + this.isRelevant(msg, createdAfter)) || []; + + this.processEvents(comments); + }, + }, +}; + diff --git a/components/hubspot/sources/new-conversation-message/new-conversation-message.mjs b/components/hubspot/sources/new-conversation-message/new-conversation-message.mjs new file mode 100644 index 0000000000000..1444139515c7a --- /dev/null +++ b/components/hubspot/sources/new-conversation-message/new-conversation-message.mjs @@ -0,0 +1,86 @@ +import common from "../common/common.mjs"; + +export default { + ...common, + key: "hubspot-new-conversation-message", + name: "New Conversation Message", + description: "Emit new event when a new message is added to a HubSpot conversation thread. [See the documentation](https://developers.hubspot.com/docs/api/conversations/threads)", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + threadId: { + propDefinition: [ + common.props.hubspot, + "threadId", + ], + description: "The ID of the conversation thread to monitor for messages", + }, + messageType: { + type: "string", + label: "Message Type", + description: "Filter by message type", + options: [ + { + label: "All Messages", + value: "", + }, + { + label: "Regular Messages", + value: "MESSAGE", + }, + { + label: "Internal Comments", + value: "COMMENT", + }, + ], + default: "", + optional: true, + }, + }, + methods: { + ...common.methods, + getTs(message) { + return Date.parse(message.createdAt); + }, + generateMeta(message) { + const messageType = message.type === "COMMENT" + ? "Internal Comment" + : "Message"; + return { + id: message.id, + summary: `New ${messageType}: ${message.text || message.id}`, + ts: this.getTs(message), + }; + }, + isRelevant(message, createdAfter) { + const isAfterTimestamp = this.getTs(message) > createdAfter; + const matchesType = !this.messageType || message.type === this.messageType; + + return isAfterTimestamp && matchesType; + }, + async getParams() { + return { + params: { + limit: 100, + }, + }; + }, + async processResults(after, params) { + const createdAfter = after || this.getLastCreatedAt(); + + // Get messages from the specified thread + const messages = await this.hubspot.getConversationMessages({ + threadId: this.threadId, + ...params, + }); + + const relevantMessages = messages.results?.filter((msg) => + this.isRelevant(msg, createdAfter)) || []; + + this.processEvents(relevantMessages); + }, + }, +}; + diff --git a/components/hubspot/sources/new-custom-object-property-change/new-custom-object-property-change.mjs b/components/hubspot/sources/new-custom-object-property-change/new-custom-object-property-change.mjs index 86fed846f6826..a349f3ffb1e10 100644 --- a/components/hubspot/sources/new-custom-object-property-change/new-custom-object-property-change.mjs +++ b/components/hubspot/sources/new-custom-object-property-change/new-custom-object-property-change.mjs @@ -6,7 +6,7 @@ export default { key: "hubspot-new-custom-object-property-change", name: "New Custom Object Property Change", description: "Emit new event when a specified property is provided or updated on a custom object.", - version: "0.0.8", + version: "0.0.9", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs b/components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs index b571138f61d5b..a4c0613bad167 100644 --- a/components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs +++ b/components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs @@ -9,7 +9,7 @@ export default { key: "hubspot-new-deal-in-stage", name: "New Deal In Stage", description: "Emit new event for each new deal in a stage.", - version: "0.0.29", + version: "0.0.30", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-deal-property-change/new-deal-property-change.mjs b/components/hubspot/sources/new-deal-property-change/new-deal-property-change.mjs index e8afc75dacfbc..ba3593d0f7604 100644 --- a/components/hubspot/sources/new-deal-property-change/new-deal-property-change.mjs +++ b/components/hubspot/sources/new-deal-property-change/new-deal-property-change.mjs @@ -7,7 +7,7 @@ export default { key: "hubspot-new-deal-property-change", name: "New Deal Property Change", description: "Emit new event when a specified property is provided or updated on a deal. [See the documentation](https://developers.hubspot.com/docs/api/crm/deals)", - version: "0.0.17", + version: "0.0.18", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-email-event/new-email-event.mjs b/components/hubspot/sources/new-email-event/new-email-event.mjs index f5c5fc93908cc..0a9a1ab135377 100644 --- a/components/hubspot/sources/new-email-event/new-email-event.mjs +++ b/components/hubspot/sources/new-email-event/new-email-event.mjs @@ -8,7 +8,7 @@ export default { key: "hubspot-new-email-event", name: "New Email Event", description: "Emit new event for each new Hubspot email event.", - version: "0.0.26", + version: "0.0.27", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-email-subscriptions-timeline/new-email-subscriptions-timeline.mjs b/components/hubspot/sources/new-email-subscriptions-timeline/new-email-subscriptions-timeline.mjs index 67c1b9da052c4..1cc6d1367e3a3 100644 --- a/components/hubspot/sources/new-email-subscriptions-timeline/new-email-subscriptions-timeline.mjs +++ b/components/hubspot/sources/new-email-subscriptions-timeline/new-email-subscriptions-timeline.mjs @@ -6,7 +6,7 @@ export default { key: "hubspot-new-email-subscriptions-timeline", name: "New Email Subscriptions Timeline", description: "Emit new event when a new email timeline subscription is added for the portal.", - version: "0.0.23", + version: "0.0.24", dedupe: "unique", type: "source", methods: { diff --git a/components/hubspot/sources/new-engagement/new-engagement.mjs b/components/hubspot/sources/new-engagement/new-engagement.mjs index 95f0f7e4c4a98..f39ba216154aa 100644 --- a/components/hubspot/sources/new-engagement/new-engagement.mjs +++ b/components/hubspot/sources/new-engagement/new-engagement.mjs @@ -8,7 +8,7 @@ export default { key: "hubspot-new-engagement", name: "New Engagement", description: "Emit new event for each new engagement created. This action returns a maximum of 5000 records at a time, make sure you set a correct time range so you don't miss any events", - version: "0.0.28", + version: "0.0.29", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-event/new-event.mjs b/components/hubspot/sources/new-event/new-event.mjs index 659e4706cec27..7b334b6135f90 100644 --- a/components/hubspot/sources/new-event/new-event.mjs +++ b/components/hubspot/sources/new-event/new-event.mjs @@ -8,7 +8,7 @@ export default { key: "hubspot-new-event", name: "New Events", description: "Emit new event for each new Hubspot event. Note: Only available for Marketing Hub Enterprise, Sales Hub Enterprise, Service Hub Enterprise, or CMS Hub Enterprise accounts", - version: "0.0.27", + version: "0.0.28", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-form-submission/new-form-submission.mjs b/components/hubspot/sources/new-form-submission/new-form-submission.mjs index e81613576f623..4c52f09d8e1ae 100644 --- a/components/hubspot/sources/new-form-submission/new-form-submission.mjs +++ b/components/hubspot/sources/new-form-submission/new-form-submission.mjs @@ -6,7 +6,7 @@ export default { key: "hubspot-new-form-submission", name: "New Form Submission", description: "Emit new event for each new submission of a form.", - version: "0.0.28", + version: "0.0.29", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-note/new-note.mjs b/components/hubspot/sources/new-note/new-note.mjs index 3606d15bea3f2..2539a8a1d4f06 100644 --- a/components/hubspot/sources/new-note/new-note.mjs +++ b/components/hubspot/sources/new-note/new-note.mjs @@ -8,7 +8,7 @@ export default { key: "hubspot-new-note", name: "New Note Created", description: "Emit new event for each new note created. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/engagements/notes#get-%2Fcrm%2Fv3%2Fobjects%2Fnotes)", - version: "1.0.4", + version: "1.0.5", type: "source", dedupe: "unique", methods: { diff --git a/components/hubspot/sources/new-or-updated-blog-article/new-or-updated-blog-article.mjs b/components/hubspot/sources/new-or-updated-blog-article/new-or-updated-blog-article.mjs index 32ed9f68257b3..ba443bc1f4b20 100644 --- a/components/hubspot/sources/new-or-updated-blog-article/new-or-updated-blog-article.mjs +++ b/components/hubspot/sources/new-or-updated-blog-article/new-or-updated-blog-article.mjs @@ -7,7 +7,7 @@ export default { key: "hubspot-new-or-updated-blog-article", name: "New or Updated Blog Post", description: "Emit new event for each new or updated blog post in Hubspot.", - version: "0.0.10", + version: "0.0.11", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-or-updated-company/new-or-updated-company.mjs b/components/hubspot/sources/new-or-updated-company/new-or-updated-company.mjs index 02f68b425c0e0..05ea3d7057644 100644 --- a/components/hubspot/sources/new-or-updated-company/new-or-updated-company.mjs +++ b/components/hubspot/sources/new-or-updated-company/new-or-updated-company.mjs @@ -9,7 +9,7 @@ export default { key: "hubspot-new-or-updated-company", name: "New or Updated Company", description: "Emit new event for each new or updated company in Hubspot.", - version: "0.0.10", + version: "0.0.11", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.mjs b/components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.mjs index 153b5904ac7d1..73d3f558cd046 100644 --- a/components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.mjs +++ b/components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.mjs @@ -9,7 +9,7 @@ export default { key: "hubspot-new-or-updated-contact", name: "New or Updated Contact", description: "Emit new event for each new or updated contact in Hubspot.", - version: "0.0.10", + version: "0.0.11", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-or-updated-crm-object/new-or-updated-crm-object.mjs b/components/hubspot/sources/new-or-updated-crm-object/new-or-updated-crm-object.mjs index 08b897c592faf..0a3312de27a14 100644 --- a/components/hubspot/sources/new-or-updated-crm-object/new-or-updated-crm-object.mjs +++ b/components/hubspot/sources/new-or-updated-crm-object/new-or-updated-crm-object.mjs @@ -7,7 +7,7 @@ export default { key: "hubspot-new-or-updated-crm-object", name: "New or Updated CRM Object", description: "Emit new event each time a CRM Object of the specified object type is updated.", - version: "0.0.23", + version: "0.0.24", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-or-updated-custom-object/new-or-updated-custom-object.mjs b/components/hubspot/sources/new-or-updated-custom-object/new-or-updated-custom-object.mjs index 2ebff11e687f1..16ec178c82f92 100644 --- a/components/hubspot/sources/new-or-updated-custom-object/new-or-updated-custom-object.mjs +++ b/components/hubspot/sources/new-or-updated-custom-object/new-or-updated-custom-object.mjs @@ -7,7 +7,7 @@ export default { key: "hubspot-new-or-updated-custom-object", name: "New or Updated Custom Object", description: "Emit new event each time a Custom Object of the specified schema is updated.", - version: "0.0.12", + version: "0.0.13", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-or-updated-deal/new-or-updated-deal.mjs b/components/hubspot/sources/new-or-updated-deal/new-or-updated-deal.mjs index 74b46dbe0dd58..49ef1eaf9f6a9 100644 --- a/components/hubspot/sources/new-or-updated-deal/new-or-updated-deal.mjs +++ b/components/hubspot/sources/new-or-updated-deal/new-or-updated-deal.mjs @@ -9,7 +9,7 @@ export default { key: "hubspot-new-or-updated-deal", name: "New or Updated Deal", description: "Emit new event for each new or updated deal in Hubspot", - version: "0.0.10", + version: "0.0.11", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-or-updated-line-item/new-or-updated-line-item.mjs b/components/hubspot/sources/new-or-updated-line-item/new-or-updated-line-item.mjs index be574e38ea308..b1326373aa7f2 100644 --- a/components/hubspot/sources/new-or-updated-line-item/new-or-updated-line-item.mjs +++ b/components/hubspot/sources/new-or-updated-line-item/new-or-updated-line-item.mjs @@ -9,7 +9,7 @@ export default { key: "hubspot-new-or-updated-line-item", name: "New or Updated Line Item", description: "Emit new event for each new line item added or updated in Hubspot.", - version: "0.0.10", + version: "0.0.11", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-or-updated-product/new-or-updated-product.mjs b/components/hubspot/sources/new-or-updated-product/new-or-updated-product.mjs index 60625e6f16807..f11d40c9bcb79 100644 --- a/components/hubspot/sources/new-or-updated-product/new-or-updated-product.mjs +++ b/components/hubspot/sources/new-or-updated-product/new-or-updated-product.mjs @@ -9,7 +9,7 @@ export default { key: "hubspot-new-or-updated-product", name: "New or Updated Product", description: "Emit new event for each new or updated product in Hubspot.", - version: "0.0.10", + version: "0.0.11", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-social-media-message/new-social-media-message.mjs b/components/hubspot/sources/new-social-media-message/new-social-media-message.mjs index 3fc749b0985e3..f13f97dd4d979 100644 --- a/components/hubspot/sources/new-social-media-message/new-social-media-message.mjs +++ b/components/hubspot/sources/new-social-media-message/new-social-media-message.mjs @@ -6,7 +6,7 @@ export default { key: "hubspot-new-social-media-message", name: "New Social Media Message", description: "Emit new event when a message is posted from HubSpot to the specified social media channel. Note: Only available for Marketing Hub Enterprise accounts", - version: "0.0.23", + version: "0.0.24", type: "source", dedupe: "unique", props: { diff --git a/components/hubspot/sources/new-task/new-task.mjs b/components/hubspot/sources/new-task/new-task.mjs index d7cdf966cc9f3..fd8d8ca0416fb 100644 --- a/components/hubspot/sources/new-task/new-task.mjs +++ b/components/hubspot/sources/new-task/new-task.mjs @@ -8,7 +8,7 @@ export default { key: "hubspot-new-task", name: "New Task Created", description: "Emit new event for each new task created. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/engagements/tasks#get-%2Fcrm%2Fv3%2Fobjects%2Ftasks)", - version: "1.0.4", + version: "1.0.5", type: "source", dedupe: "unique", methods: { diff --git a/components/hubspot/sources/new-ticket-property-change/new-ticket-property-change.mjs b/components/hubspot/sources/new-ticket-property-change/new-ticket-property-change.mjs index 54c54341c58cf..9ef2177f2f57f 100644 --- a/components/hubspot/sources/new-ticket-property-change/new-ticket-property-change.mjs +++ b/components/hubspot/sources/new-ticket-property-change/new-ticket-property-change.mjs @@ -7,7 +7,7 @@ export default { key: "hubspot-new-ticket-property-change", name: "New Ticket Property Change", description: "Emit new event when a specified property is provided or updated on a ticket. [See the documentation](https://developers.hubspot.com/docs/api/crm/tickets)", - version: "0.0.17", + version: "0.0.18", dedupe: "unique", type: "source", props: { diff --git a/components/hubspot/sources/new-ticket/new-ticket.mjs b/components/hubspot/sources/new-ticket/new-ticket.mjs index 304724eecdff3..1fef11fa38167 100644 --- a/components/hubspot/sources/new-ticket/new-ticket.mjs +++ b/components/hubspot/sources/new-ticket/new-ticket.mjs @@ -9,7 +9,7 @@ export default { key: "hubspot-new-ticket", name: "New Ticket", description: "Emit new event for each new ticket created.", - version: "0.0.23", + version: "0.0.24", dedupe: "unique", type: "source", props: {