-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Send a ticket message action in trengo #19087
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
base: master
Are you sure you want to change the base?
Send a ticket message action in trengo #19087
Conversation
…ion, and protection
…dd-conditional-format-rule.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…validation.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This reverts commit 7c93828.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified. |
|
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:
|
WalkthroughAdds a new "Send A Ticket Message" action and a corresponding Changes
Sequence DiagramsequenceDiagram
actor User
participant Action as Send A Ticket\nMessage Action
participant App as Trengo App
participant API as Trengo API
User->>Action: Trigger with ticketId, message, ...
Action->>App: sendTicketMessage({ ticketId, ...args })
App->>API: POST /tickets/{ticketId}/messages (payload)
API-->>App: Response (message created)
App-->>Action: Return response
Action->>Action: Set summary "Message sent to ticket {ticketId}"
Action-->>User: Return API response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-10-20T01:01:02.970ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (3)
Comment |
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.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
components/trengo/actions/send-a-ticket-message/send-a-ticket-message.mjs(1 hunks)components/trengo/trengo.app.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.
Applied to files:
components/trengo/actions/send-a-ticket-message/send-a-ticket-message.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: pnpm publish
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (2)
components/trengo/actions/send-a-ticket-message/send-a-ticket-message.mjs (2)
1-13: LGTM!The imports and metadata are properly configured. The documentation link is included and the annotations are appropriate for this action.
53-58: Consider filtering out undefined optional fields.The code passes all optional fields even when they are undefined. While most APIs handle this gracefully, it's cleaner to only include fields that have defined values.
Here's an alternative approach:
data: { message: this.message, ...(this.internalNote !== undefined && { internal_note: this.internalNote }), ...(this.subject && { subject: this.subject }), ...(this.attachmentIds && { attachment_ids: this.attachmentIds }), }Or use a helper function to filter out undefined values:
data: Object.fromEntries( Object.entries({ message: this.message, internal_note: this.internalNote, subject: this.subject, attachment_ids: this.attachmentIds, }).filter(([_, v]) => v !== undefined) )⛔ Skipped due to learnings
Learnt from: GTFalcao Repo: PipedreamHQ/pipedream PR: 18362 File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105 Timestamp: 2025-09-15T22:01:11.472Z Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.Learnt from: js07 Repo: PipedreamHQ/pipedream PR: 18744 File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64 Timestamp: 2025-10-20T01:01:02.970Z Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.
components/trengo/actions/send-a-ticket-message/send-a-ticket-message.mjs
Show resolved
Hide resolved
components/trengo/actions/send-a-ticket-message/send-a-ticket-message.mjs
Show resolved
Hide resolved
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.
Actionable comments posted: 1
♻️ Duplicate comments (1)
components/trengo/actions/send-a-ticket-message/send-a-ticket-message.mjs (1)
14-48: Verify API requirements for message and attachmentIds fields.The past review comment about validation remains unresolved. The
messageprop is required whileattachmentIdsis optional. However, theattachmentIdspropDefinition in the app file states "Required ifBodynot set", suggesting the API may support either text OR attachments.Additionally, the similar
send-team-chat-messageaction in this codebase includes explicit validation:if (!this.body && !this.attachmentIds) { throw new ConfigurationError(...) }, but this action lacks such validation.Confirm whether the Trengo API for ticket messages:
- Requires the
messagetext field, OR- Allows sending with only
attachment_ids(no message text), OR- Requires at least one of message or attachment_ids
If option 2 or 3 applies, add validation similar to the team chat action.
Trengo API ticket message endpoint required fields
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
components/trengo/actions/send-a-ticket-message/send-a-ticket-message.mjs(1 hunks)components/trengo/package.json(1 hunks)components/trengo/trengo.app.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.
Applied to files:
components/trengo/actions/send-a-ticket-message/send-a-ticket-message.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: pnpm publish
- GitHub Check: Lint Code Base
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (3)
components/trengo/package.json (1)
3-3: LGTM! Appropriate version bump for new feature.The minor version increment from 0.4.0 to 0.5.0 correctly reflects the addition of new functionality (send ticket message action and corresponding app method) without breaking changes.
components/trengo/actions/send-a-ticket-message/send-a-ticket-message.mjs (2)
3-13: LGTM! Action metadata follows conventions.The action metadata is properly structured with appropriate type, version, key naming (follows the
app-name-slugified-action-namepattern), and includes a documentation link.
49-64: LGTM! Request structure is correct.The run method correctly:
- Uses the
data:wrapper for the POST request body (addressing the past review concern)- Maps prop names to snake_case API fields (
internal_note,attachment_ids)- Provides a clear summary message
- Returns the API response
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.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (6)
components/trengo/sources/new-internal-note/new-internal-note.mjs (1)
19-19: Fix the summary message to match the source purpose.The summary references "ticket label added" but this source emits events for internal notes, not label changes. Update to reflect the actual event type.
- summary: `New ticket label added event: ${event?.body?.message}`, + summary: `New internal note added event: ${event?.body?.message}`,components/trengo/actions/send-a-whatsapp-message-template/send-a-whatsapp-message-template.mjs (3)
78-78: Fix misleading export summary message.The summary message states "The contact has been created," but this action sends a WhatsApp message template, not creates a contact. This will confuse users about what the action actually does.
Apply this diff to correct the summary message:
- $.export("$summary", `The contact has been created. (${resp.name} ID:${resp.id})`); + $.export("$summary", `WhatsApp message template sent. (${resp.name} ID:${resp.id})`);
57-57: Use strict equality operator.Replace loose equality
!=with strict!==to align with JavaScript best practices and avoid type coercion issues.Apply this diff:
- if (this.whatsappTemplateParamsKeys.length != this.whatsappTemplateParamsValues.length) { + if (this.whatsappTemplateParamsKeys.length !== this.whatsappTemplateParamsValues.length) {
4-81: Add JSDoc documentation to the component.Per the Pipedream component guidelines provided in the PR checklist, components should include JSDoc documentation. This improves maintainability and helps other developers understand the component's purpose and usage.
Add a JSDoc comment block before the exported object:
+/** + * Sends a WhatsApp message template through Trengo. + * Either a recipient phone number or ticket ID must be provided. + */ export default {components/trengo/actions/send-a-team-chat-message/send-a-team-chat-message.mjs (1)
53-53: Fix typo in error message: "Attachement" → "Attachment".User-facing error messages should be spelled correctly.
- throw new ConfigurationError("Either `Body` or `Attachement IDs` should be set!"); + throw new ConfigurationError("Either `Body` or `Attachment IDs` should be set!");components/trengo/sources/new-outbound-message/new-outbound-message.mjs (1)
19-19: Fix typo in summary message.The summary contains a typo: "outbund" should be "outbound".
- summary: `New outbund message event: ${event?.body?.message}`, + summary: `New outbound message event: ${event?.body?.message}`,
♻️ Duplicate comments (2)
components/trengo/actions/get-label/get-label.mjs (1)
7-7: Version bump is safe; same versioning question as other actions.This file also bumps from
0.0.1to0.0.2with no functional changes. The same consideration about versioning convention applies here.components/trengo/actions/list-articles/list-articles.mjs (1)
7-7: Version bump from 0.0.4 to 0.0.5 is safe; same versioning question.Consistent with the other actions in this PR, this file receives a patch version bump without functional changes.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (23)
components/trengo/actions/attach-label/attach-label.mjs(1 hunks)components/trengo/actions/create-contact/create-contact.mjs(1 hunks)components/trengo/actions/find-contacts/find-contacts.mjs(1 hunks)components/trengo/actions/get-label/get-label.mjs(1 hunks)components/trengo/actions/get-message/get-message.mjs(1 hunks)components/trengo/actions/list-articles/list-articles.mjs(1 hunks)components/trengo/actions/list-labels/list-labels.mjs(1 hunks)components/trengo/actions/list-messages/list-messages.mjs(1 hunks)components/trengo/actions/list-tickets/list-tickets.mjs(1 hunks)components/trengo/actions/log-a-voice-call/log-a-voice-call.mjs(1 hunks)components/trengo/actions/send-a-message/send-a-message.mjs(1 hunks)components/trengo/actions/send-a-team-chat-message/send-a-team-chat-message.mjs(1 hunks)components/trengo/actions/send-a-whatsapp-message-template/send-a-whatsapp-message-template.mjs(1 hunks)components/trengo/sources/new-inbound-message/new-inbound-message.mjs(1 hunks)components/trengo/sources/new-internal-note/new-internal-note.mjs(1 hunks)components/trengo/sources/new-outbound-message/new-outbound-message.mjs(1 hunks)components/trengo/sources/phone-call-ended/phone-call-ended.mjs(1 hunks)components/trengo/sources/phone-call-missed/phone-call-missed.mjs(1 hunks)components/trengo/sources/phone-call-started/phone-call-started.mjs(1 hunks)components/trengo/sources/ticket-closed/ticket-closed.mjs(1 hunks)components/trengo/sources/ticket-label-added/ticket-label-added.mjs(1 hunks)components/trengo/sources/ticket-reopened/ticket-reopened.mjs(1 hunks)components/trengo/sources/voice-call-recorded/voice-call-recorded.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.
Applied to files:
components/trengo/actions/send-a-message/send-a-message.mjscomponents/trengo/actions/send-a-team-chat-message/send-a-team-chat-message.mjscomponents/trengo/sources/new-inbound-message/new-inbound-message.mjscomponents/trengo/actions/list-messages/list-messages.mjscomponents/trengo/actions/get-message/get-message.mjscomponents/trengo/sources/new-outbound-message/new-outbound-message.mjs
📚 Learning: 2024-10-08T15:33:38.240Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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`.
Applied to files:
components/trengo/actions/send-a-team-chat-message/send-a-team-chat-message.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (20)
components/trengo/actions/list-messages/list-messages.mjs (2)
8-8: Version bump is consistent with the PR pattern.The version update from
0.0.3to0.0.4aligns with the package-wide version increment (trengo package bumped from 0.4.0 to 0.5.0) and the addition of new functionality (send-a-ticket-message action) documented in the PR.
1-49: Action implementation follows best practices.The list-messages action correctly implements pagination via
utils.getResourcesStream, respects themaxResultsconstraint with early termination, and provides a well-formatted summary. Props are properly defined withticketIdsourced from app propDefinitions and optionalmaxResultswith sensible defaults. Annotations appropriately reflect the read-only, non-destructive nature of the operation.components/trengo/sources/new-internal-note/new-internal-note.mjs (1)
7-7: Version bump is appropriate.The increment from 0.0.5 to 0.0.6 aligns with the broader version updates across Trengo components in this PR.
components/trengo/actions/send-a-team-chat-message/send-a-team-chat-message.mjs (1)
7-7: Version bump noted.The version has been incremented from 0.0.6 to 0.0.7 with no logic changes to this file. This is consistent with the PR's broader updates to the Trengo app module and package versioning. The file maintains compliance with Pipedream best practices: props are defined via
propDefinitionfrom the app module, validation logic is sound, and the action properly delegates to the app'ssendTeamChatMessagemethod.components/trengo/actions/list-tickets/list-tickets.mjs (2)
8-8: Version bump appears justified by app client modifications.The patch-level bump (0.0.3 → 0.0.4) aligns with the addition of the
sendTicketMessagemethod to the Trengo app client, which is a dependency change affecting this action. However, I cannot verify the full scope of the PR changes since only this file was provided for review.Please verify that:
- The new
send-a-ticket-messageaction follows Pipedream guidelines (especially the checklist from the component development guidelines: component key format, prop definitions, JSDoc documentation, async options, etc.)- The
sendTicketMessagemethod in the Trengo app client is properly implemented with error handling and documentation- The PR description is completed with proper rationale and implementation details
Can you provide the files for
components/trengo/actions/send-a-ticket-message/send-a-ticket-message.mjsand the updatedcomponents/trengo/trengo.app.mjsfor review?
77-104: File logic remains sound; no issues detected in this component.The
list-ticketsaction properly handles pagination viagetResourcesStream, respects themaxResultslimit, and exports a clear summary. Since this file has no logic changes (only a version bump), the existing implementation quality is not affected by this PR.Minor observation: As noted in the Pipedream component development guidelines, consider adding JSDoc documentation to the
runmethod for future improvements (not blocking for this PR since it's an existing component).components/trengo/actions/get-message/get-message.mjs (1)
7-7: LGTM: Version bump as part of coordinated update.The version increment from "0.0.1" to "0.0.2" is appropriate as part of the broader version migration across the Trengo component in this PR.
components/trengo/sources/phone-call-started/phone-call-started.mjs (1)
7-7: Version bump is appropriate.The patch version increment from "0.0.5" to "0.0.6" aligns with the PR's addition of new functionality to the Trengo package. No functional changes were made to this component.
components/trengo/actions/find-contacts/find-contacts.mjs (1)
7-7: Version bump is consistent across PR changes.The increment to 0.0.7 aligns with multiple other Trengo action components being updated to the same version in this PR (send-a-team-chat-message, log-a-voice-call, send-a-whatsapp-message-template, send-a-message, and create-contact all at 0.0.7), indicating a coordinated update across the app.
components/trengo/sources/voice-call-recorded/voice-call-recorded.mjs (1)
7-7: The original review comment is incorrect and should be dismissed.The verification shows this version bump is part of a systematic, coordinated versioning strategy across the entire Trengo integration: all 25 Trengo components (14 actions + 10 sources) are receiving synchronized version bumps in this PR. This is a standard monorepo convention and not an error. The voice-call-recorded.mjs component has no functional code changes, but the version bump is intentional and consistent with the rest of the release.
Likely an incorrect or invalid review comment.
components/trengo/actions/send-a-message/send-a-message.mjs (1)
6-6: Version bump from 0.0.6 to 0.0.7 is unjustified—revert it.The diff shows only the version number changed; there are no code modifications in
send-a-message.mjsand no changes to the upstreamtrengo.app.mjsmodule. Version bumps should correspond to actual code changes or dependency updates. Removing this version bump or adding meaningful changes to justify it is required.⛔ Skipped due to learnings
Learnt from: js07 Repo: PipedreamHQ/pipedream PR: 18744 File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64 Timestamp: 2025-10-20T01:01:02.970Z Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.components/trengo/sources/ticket-label-added/ticket-label-added.mjs (1)
7-7: The version bump is necessary and justified.The commit "versions" updated all 23 trengo component files, including ticket-label-added.mjs. This is a coordinated release where all components in the trengo library were versioned together. The PR adds the new send-a-ticket-message action, which justifies this systematic version update. Component libraries commonly bump versions across all components as part of a release cycle to maintain consistency and clarity.
Likely an incorrect or invalid review comment.
components/trengo/sources/ticket-reopened/ticket-reopened.mjs (1)
7-7: Version bump is correct and all related changes comply with Pipedream guidelines.All propDefinitions referenced in the new action (
ticketId,message,attachmentIds) are properly defined intrengo.app.mjs. The new action follows Pipedream guidelines: uses propDefinitions for reusable props, includes JSDoc links, implements async/await with proper error handling, and exports summaries. The app methodsendTicketMessageis correctly implemented. Version strategy is consistent: package bumped to 0.5.0 (minor for new action), existing source patched to 0.0.4, new action starts at 0.0.1.components/trengo/actions/log-a-voice-call/log-a-voice-call.mjs (1)
6-6: Version bump is intentional and follows repository convention.This version bump is confirmed to be part of a coordinated, bulk update across existing Trengo actions (commit
f5e21445b versionswas applied uniformly across 13 Trengo action files). This follows the repository's established versioning strategy of bumping all existing component versions together when the package is updated. No action needed.components/trengo/sources/new-inbound-message/new-inbound-message.mjs (1)
7-7: LGTM - Version bump is appropriate.The patch version increment aligns with the PR's addition of new Trengo functionality.
components/trengo/sources/phone-call-ended/phone-call-ended.mjs (1)
7-7: LGTM - Version bump is appropriate.Consistent patch version increment with other Trengo sources.
components/trengo/sources/phone-call-missed/phone-call-missed.mjs (1)
7-7: LGTM - Version bump is appropriate.Patch version increment aligns with the broader component update.
components/trengo/actions/create-contact/create-contact.mjs (1)
6-6: LGTM - Version bump is appropriate.The version increment is consistent with the component-wide update pattern.
components/trengo/actions/attach-label/attach-label.mjs (1)
7-7: LGTM - Version bump is appropriate.Patch version increment aligns with the broader Trengo component release.
components/trengo/sources/new-outbound-message/new-outbound-message.mjs (1)
7-7: LGTM - Version bump is appropriate.Patch version increment is consistent with other Trengo sources in this PR.
michelle0927
left a comment
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.
Ready for QA!
|
Hi everyone, all test cases are passed! Ready for release! Test reports
|
WHY
Summary by CodeRabbit
New Features
Chores