-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Closed
seynadio
wants to merge
2
commits into
PipedreamHQ:master
from
seynadio:hubspot-conversation-internal-notes
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
components/hubspot/actions/add-conversation-comment/add-conversation-comment.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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({ $ }) { | ||
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; | ||
}, | ||
}; |
60 changes: 60 additions & 0 deletions
60
components/hubspot/actions/send-conversation-message/send-conversation-message.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
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({ $ }) { | ||
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; | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
components/hubspot/sources/new-conversation-comment/new-conversation-comment.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
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: "Filter comments from a specific conversation thread", | ||
optional: true, | ||
}, | ||
}, | ||
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 matchesThread = !this.threadId || comment.threadId === this.threadId; | ||
const isComment = comment.type === "COMMENT"; | ||
|
||
return isAfterTimestamp && matchesThread && isComment; | ||
}, | ||
async getParams() { | ||
return { | ||
params: { | ||
limit: 100, | ||
}, | ||
}; | ||
}, | ||
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"); | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
Would you like me to help implement the complete polling logic or create a webhook-based alternative?
📝 Committable suggestion
🤖 Prompt for AI Agents