Skip to content

Hubspot - Conversations support #17601

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

Conversation

seynadio
Copy link

@seynadio seynadio commented Jul 14, 2025

WHY

  • Add conversation API methods to HubSpot app (getConversationThread, getConversationMessages, sendConversationMessage, addConversationComment) │
  • Add threadId prop definition for conversation threads - Create send-conversation-message action for regular messages - Create add-conversation-comment action for internal notes (COMMENT type) - Add webhook sources for conversation messages and internal comments - Update package version to 1.2.5 - Support HubSpot Conversations API v3 endpoints

Summary by CodeRabbit

  • New Features

    • Added support for adding internal notes to Freshdesk tickets.
    • Introduced actions to add internal comments and send messages in HubSpot conversation threads.
    • Added new source components to emit events for new internal comments and messages in HubSpot conversations, with optional filtering.
    • Enhanced HubSpot integration with new methods for managing conversation threads, messages, and comments.
  • Chores

    • Updated HubSpot package version to 1.2.5.

seynadio added 2 commits July 14, 2025 10:42
- Add conversation API methods to HubSpot app (getConversationThread, getConversationMessages, sendConversationMessage, addConversationComment)
- Add threadId prop definition for conversation threads
- Create send-conversation-message action for regular messages
- Create add-conversation-comment action for internal notes (COMMENT type)
- Add webhook sources for conversation messages and internal comments
- Update package version to 1.2.5
- Support HubSpot Conversations API v3 endpoints
Copy link
Contributor

coderabbitai bot commented Jul 14, 2025

Walkthrough

The changes introduce new capabilities for both Freshdesk and HubSpot integrations. Freshdesk's update-ticket action now supports adding internal notes. For HubSpot, new actions and sources allow sending messages, adding internal comments to conversation threads, and emitting events for new messages or internal notes. Supporting API methods and property definitions were added to the HubSpot app module.

Changes

File(s) Change Summary
components/freshdesk/actions/update-ticket/update-ticket.mjs Added support for adding internal notes to tickets via new optional props and conditional logic in the run method.
components/hubspot/actions/add-conversation-comment/add-conversation-comment.mjs New action to add internal comments (notes) to HubSpot conversation threads.
components/hubspot/actions/send-conversation-message/send-conversation-message.mjs New action to send messages to HubSpot conversation threads.
components/hubspot/sources/new-conversation-comment/new-conversation-comment.mjs
components/hubspot/sources/new-conversation-message/new-conversation-message.mjs
New source components to emit events for new internal comments and messages in HubSpot conversation threads, with filtering options.
components/hubspot/hubspot.app.mjs Added prop definition for thread ID and methods for getting threads, messages, sending messages, and adding comments via API.
components/hubspot/package.json Bumped package version from 1.2.4 to 1.2.5.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FreshdeskAction
    participant FreshdeskAPI

    User->>FreshdeskAction: Run update-ticket with internalNote/noteBody
    alt internalNote is true and noteBody provided
        FreshdeskAction->>FreshdeskAPI: POST /tickets/{ticketId}/notes (private note)
        FreshdeskAPI-->>FreshdeskAction: Note creation response
        FreshdeskAction-->>User: Return note response
    else
        FreshdeskAction->>FreshdeskAPI: PUT /tickets/{ticketId} (update fields)
        FreshdeskAPI-->>FreshdeskAction: Ticket update response
        FreshdeskAction-->>User: Return update response
    end
Loading
sequenceDiagram
    participant User
    participant HubSpotAction
    participant HubSpotApp
    participant HubSpotAPI

    User->>HubSpotAction: Add comment/send message to thread
    HubSpotAction->>HubSpotApp: addConversationComment/sendConversationMessage
    HubSpotApp->>HubSpotAPI: POST /conversations/v3/conversations/threads/{threadId}/messages
    HubSpotAPI-->>HubSpotApp: API response
    HubSpotApp-->>HubSpotAction: Return response
    HubSpotAction-->>User: Return result
Loading
sequenceDiagram
    participant HubSpotSource
    participant HubSpotApp
    participant HubSpotAPI
    participant Workflow

    HubSpotSource->>HubSpotApp: getConversationMessages/addConversationComment (polling)
    HubSpotApp->>HubSpotAPI: GET /conversations/v3/conversations/threads/{threadId}/messages
    HubSpotAPI-->>HubSpotApp: Messages/comments data
    HubSpotApp-->>HubSpotSource: Data
    HubSpotSource-->>Workflow: Emit event if new message/comment found
Loading

Poem

A hop, a skip, a note to send,
Freshdesk tickets now extend—
Internal whispers, hidden tight,
HubSpot threads now chat at night.
New actions, sources, all align,
Rabbits code and intertwine!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/hubspot/actions/add-conversation-comment/add-conversation-comment.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)

components/freshdesk/actions/update-ticket/update-ticket.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)

components/hubspot/actions/send-conversation-message/send-conversation-message.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)

  • 3 others
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@adolfo-pd adolfo-pd added the User submitted Submitted by a user label Jul 14, 2025
Copy link

vercel bot commented Jul 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
pipedream-docs ⬜️ Ignored (Inspect) Jul 14, 2025 9:41am
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jul 14, 2025 9:41am

@pipedream-component-development
Copy link
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@pipedream-component-development
Copy link
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

Copy link

vercel bot commented Jul 14, 2025

@seynadio is attempting to deploy a commit to the Pipedreamers Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e21d334 and af3da57.

📒 Files selected for processing (7)
  • components/freshdesk/actions/update-ticket/update-ticket.mjs (3 hunks)
  • components/hubspot/actions/add-conversation-comment/add-conversation-comment.mjs (1 hunks)
  • components/hubspot/actions/send-conversation-message/send-conversation-message.mjs (1 hunks)
  • components/hubspot/hubspot.app.mjs (2 hunks)
  • components/hubspot/package.json (1 hunks)
  • components/hubspot/sources/new-conversation-comment/new-conversation-comment.mjs (1 hunks)
  • components/hubspot/sources/new-conversation-message/new-conversation-message.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
components/hubspot/package.json (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
components/hubspot/actions/send-conversation-message/send-conversation-message.mjs (3)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
components/hubspot/sources/new-conversation-message/new-conversation-message.mjs (4)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In `components/the_magic_drip/sources/common.mjs`, when processing items in `getAndProcessData`, `savedIds` is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.
components/hubspot/sources/new-conversation-comment/new-conversation-comment.mjs (4)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In `components/the_magic_drip/sources/common.mjs`, when processing items in `getAndProcessData`, `savedIds` is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
components/hubspot/hubspot.app.mjs (3)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
🔇 Additional comments (14)
components/hubspot/package.json (1)

3-3: LGTM: Appropriate version bump

The version increment from 1.2.4 to 1.2.5 correctly reflects the addition of new conversation features while maintaining backward compatibility.

components/freshdesk/actions/update-ticket/update-ticket.mjs (4)

8-8: LGTM: Appropriate version bump

The version increment correctly reflects the addition of new internal note functionality.


74-86: LGTM: Well-structured internal note properties

The new properties are properly defined with appropriate types, labels, and descriptions. The boolean default for internalNote and optional nature of both properties provide good user experience.


120-133: Consider design limitation: exclusive operation mode

The current implementation uses an early return when adding internal notes, which means users cannot both add an internal note AND update ticket fields in a single action execution. This might be a limitation depending on use case requirements.

Consider whether this exclusive behavior is intentional or if users might need to perform both operations simultaneously.


121-132: LGTM: Correct API implementation and summary formatting

The internal note API call follows the established pattern, correctly sets the note as private, and uses proper summary message formatting as per the learning guidelines.

components/hubspot/actions/send-conversation-message/send-conversation-message.mjs (1)

1-60: LGTM — sendConversationMessage method verified

  • Confirmed that sendConversationMessage is implemented in components/hubspot/hubspot.app.mjs.
  • No further changes required; action structure and summary formatting are correct.
components/hubspot/actions/add-conversation-comment/add-conversation-comment.mjs (1)

1-43: Approve HubSpot Add Conversation Comment action (method verified)

I’ve confirmed that the addConversationComment method exists in components/hubspot/hubspot.app.mjs and matches the expected signature and API call structure. The action implementation is consistent and ready to merge.

components/hubspot/sources/new-conversation-message/new-conversation-message.mjs (3)

5-6: LGTM: Appropriate source naming convention

The source name "New Conversation Message" correctly follows the convention where sources emitting events for new items should start with "New" as per the learning guidelines.


13-41: LGTM: Well-designed filtering properties

The threadId and messageType properties provide excellent filtering capabilities:

  • Optional threadId for specific conversation filtering
  • messageType options are comprehensive (All, Regular Messages, Internal Comments)
  • Proper default values and descriptions

45-62: LGTM: Solid helper methods implementation

The helper methods are well-implemented:

  • getTs() properly parses timestamps
  • generateMeta() creates appropriate metadata with correct message type labeling
  • isRelevant() implements comprehensive filtering logic
components/hubspot/hubspot.app.mjs (2)

127-131: LGTM: Clean property definition for conversation thread ID.

The threadId property definition is correctly implemented with appropriate type, label, and description.


1150-1207: Ignore missing api parameter for conversation endpoints

The HubSpot client’s makeRequest helper falls back to using the base URL plus whatever you put in endpoint (e.g. /conversations/v3/...), so you don’t need to supply an api key here—and in fact there is no API_PATH.CONVERSATIONS_V3 defined in components/hubspot/common/constants.mjs. The existing methods correctly call:

  • GET https://api.hubapi.com/conversations/v3/conversations/threads/{threadId}
  • GET https://api.hubapi.com/conversations/v3/conversations/threads/{threadId}/messages
  • POST https://api.hubapi.com/conversations/v3/conversations/threads/{threadId}/messages

As for sendConversationMessage vs. addConversationComment, they both POST to the same endpoint by design; you distinguish a regular message from an internal comment via the request payload (e.g. an isInternal flag), not via separate routes.

Likely an incorrect or invalid review comment.

components/hubspot/sources/new-conversation-comment/new-conversation-comment.mjs (2)

1-21: LGTM: Well-structured component setup with appropriate props.

The component correctly extends the common base and includes the necessary threadId prop for filtering specific conversation threads.


22-47: LGTM: Helper methods are correctly implemented.

The getTs, generateMeta, and isRelevant methods properly handle comment processing with appropriate filtering logic for timestamp, thread ID, and comment type.

Comment on lines +70 to +83
async processResults(after, params) {
// Note: This is a placeholder implementation
// In a real implementation, you would need to:
// 1. List conversation threads
// 2. For each thread, get messages
// 3. Filter based on timestamp and props
// 4. Process events

// For now, we'll use a webhook-based approach
// This source would need to be enhanced with actual API calls
// to poll for new messages if HubSpot doesn't provide webhooks

console.log("Conversation message polling not yet implemented - use webhooks instead");
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Implement proper processResults functionality

The processResults method is incomplete with just placeholder comments and a console.log statement. This needs to be implemented properly:

  1. Remove the console.log statement (inappropriate for production)
  2. Implement actual API calls to fetch conversation messages
  3. Either implement polling logic or properly set up webhook handling
-    async processResults(after, params) {
-      // Note: This is a placeholder implementation
-      // In a real implementation, you would need to:
-      // 1. List conversation threads
-      // 2. For each thread, get messages
-      // 3. Filter based on timestamp and props
-      // 4. Process events
-      
-      // For now, we'll use a webhook-based approach
-      // This source would need to be enhanced with actual API calls
-      // to poll for new messages if HubSpot doesn't provide webhooks
-      
-      console.log("Conversation message polling not yet implemented - use webhooks instead");
-    },
+    async processResults(after, params) {
+      // TODO: Implement actual message fetching logic
+      // This would typically involve:
+      // 1. Fetching conversation threads (with threadId filter if specified)
+      // 2. Getting messages from each thread
+      // 3. Filtering messages based on timestamp and messageType
+      // 4. Emitting events for relevant messages
+      
+      throw new Error("Polling implementation not yet complete - this source requires webhook configuration");
+    },

Would you like me to help implement the proper polling logic or webhook setup for this source?

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async processResults(after, params) {
// Note: This is a placeholder implementation
// In a real implementation, you would need to:
// 1. List conversation threads
// 2. For each thread, get messages
// 3. Filter based on timestamp and props
// 4. Process events
// For now, we'll use a webhook-based approach
// This source would need to be enhanced with actual API calls
// to poll for new messages if HubSpot doesn't provide webhooks
console.log("Conversation message polling not yet implemented - use webhooks instead");
},
async processResults(after, params) {
// TODO: Implement actual message fetching logic
// This would typically involve:
// 1. Fetching conversation threads (with threadId filter if specified)
// 2. Getting messages from each thread
// 3. Filtering messages based on timestamp and messageType
// 4. Emitting events for relevant messages
throw new Error("Polling implementation not yet complete - this source requires webhook configuration");
},
🤖 Prompt for AI Agents
In
components/hubspot/sources/new-conversation-message/new-conversation-message.mjs
around lines 70 to 83, the processResults method currently only contains
placeholder comments and a console.log statement. Remove the console.log and
replace it with actual API calls to list conversation threads and fetch messages
for each thread. Implement filtering based on timestamps and relevant
properties, then process the resulting events. Depending on the design, either
add polling logic to regularly fetch new messages or integrate webhook handling
to receive updates in real time.

Comment on lines +48 to +62
async processResults(after, params) {
// Note: This is a placeholder implementation
// In a real implementation, you would need to:
// 1. List conversation threads
// 2. For each thread, get messages
// 3. Filter for COMMENT type messages
// 4. Process events

// For now, we'll use a webhook-based approach
// This source would need to be enhanced with actual API calls
// to poll for new comments if HubSpot doesn't provide webhooks

console.log("Conversation comment polling not yet implemented - use webhooks instead");
},
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Complete the polling implementation or provide webhook alternative.

The processResults method is incomplete with only placeholder comments. This makes the component non-functional for users who expect polling-based event emission.

Consider implementing the actual polling logic using the new HubSpot app methods:

     async processResults(after, params) {
-      // Note: This is a placeholder implementation
-      // In a real implementation, you would need to:
-      // 1. List conversation threads
-      // 2. For each thread, get messages
-      // 3. Filter for COMMENT type messages
-      // 4. Process events
-      
-      // For now, we'll use a webhook-based approach
-      // This source would need to be enhanced with actual API calls
-      // to poll for new comments if HubSpot doesn't provide webhooks
-      
-      console.log("Conversation comment polling not yet implemented - use webhooks instead");
+      try {
+        // If threadId is specified, only check that thread
+        if (this.threadId) {
+          const { results: messages } = await this.hubspot.getConversationMessages({
+            threadId: this.threadId,
+            ...params,
+          });
+          
+          if (messages) {
+            for (const message of messages) {
+              if (this.isRelevant(message, after)) {
+                this.$emit(message, this.generateMeta(message));
+              }
+            }
+          }
+        } else {
+          // Note: This would require a method to list all conversation threads
+          // which may not be efficient for polling
+          console.log("Polling all threads not implemented - consider specifying threadId or use webhooks");
+        }
+      } catch (error) {
+        console.error("Error fetching conversation comments:", error);
+      }
     },

Would you like me to help implement the complete polling logic or create a webhook-based alternative?

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async processResults(after, params) {
// Note: This is a placeholder implementation
// In a real implementation, you would need to:
// 1. List conversation threads
// 2. For each thread, get messages
// 3. Filter for COMMENT type messages
// 4. Process events
// For now, we'll use a webhook-based approach
// This source would need to be enhanced with actual API calls
// to poll for new comments if HubSpot doesn't provide webhooks
console.log("Conversation comment polling not yet implemented - use webhooks instead");
},
},
async processResults(after, params) {
try {
// If threadId is specified, only check that thread
if (this.threadId) {
const { results: messages } = await this.hubspot.getConversationMessages({
threadId: this.threadId,
...params,
});
if (messages) {
for (const message of messages) {
if (this.isRelevant(message, after)) {
this.$emit(message, this.generateMeta(message));
}
}
}
} else {
// Note: This would require a method to list all conversation threads
// which may not be efficient for polling
console.log("Polling all threads not implemented - consider specifying threadId or use webhooks");
}
} catch (error) {
console.error("Error fetching conversation comments:", error);
}
},
🤖 Prompt for AI Agents
In
components/hubspot/sources/new-conversation-comment/new-conversation-comment.mjs
around lines 48 to 62, the processResults method is currently a placeholder
without actual polling or webhook logic, making it non-functional. To fix this,
implement the polling logic by listing conversation threads, retrieving messages
for each thread, filtering for COMMENT type messages, and processing those
events accordingly. Alternatively, if HubSpot supports webhooks, implement a
webhook-based event listener to handle new comments in real-time. Choose one
approach and replace the placeholder with the complete functional code.

@seynadio
Copy link
Author

Closing this PR and replacing with #17607 which has only the HubSpot changes (no accidental Freshdesk changes) and improved implementation with proper polling logic and validation

@seynadio seynadio closed this Jul 14, 2025
@seynadio seynadio deleted the hubspot-conversation-internal-notes branch July 14, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User submitted Submitted by a user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants