Skip to content

Add comprehensive tag management for Freshdesk tickets #17610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seynadio
Copy link

@seynadio seynadio commented Jul 14, 2025

Summary

  • Added ticketTags prop definition to freshdesk.app.mjs with validation
  • Added 3 tag management methods: setTicketTags, addTicketTags, removeTicketTags
  • Created 3 dedicated tag actions: set-ticket-tags, add-ticket-tags, remove-ticket-tags
  • Enhanced update-ticket action with tag support
  • Provides feature parity with Zendesk tag management

Summary by CodeRabbit

  • New Features

    • Added the ability to add, remove, or set tags on Freshdesk tickets through new actions.
    • Enhanced ticket update functionality to allow replacing all existing tags with a new set during ticket updates.
  • Improvements

    • Users can now manage ticket tags more flexibly within the Freshdesk integration, including adding, removing, or replacing tags directly.

- Added ticketTags prop definition to freshdesk.app.mjs
- Added 3 tag management methods: setTicketTags, addTicketTags, removeTicketTags
- Created 3 dedicated tag actions: set-ticket-tags, add-ticket-tags, remove-ticket-tags
- Enhanced update-ticket action with tag support
- Provides feature parity with Zendesk tag management

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

vercel bot commented Jul 14, 2025

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jul 14, 2025 0:10am

Copy link
Contributor

coderabbitai bot commented Jul 14, 2025

Walkthrough

New functionality for managing Freshdesk ticket tags was introduced. This includes app methods to set, add, and remove tags on tickets, along with corresponding action modules for each operation. The update-ticket action now supports setting ticket tags. All changes extend the Freshdesk integration with comprehensive tag management capabilities.

Changes

File(s) Change Summary
components/freshdesk/freshdesk.app.mjs Added ticketTags prop definition; implemented setTicketTags, addTicketTags, and removeTicketTags methods.
components/freshdesk/actions/add-ticket-tags/add-ticket-tags.mjs New action: adds tags to a ticket using addTicketTags method.
components/freshdesk/actions/remove-ticket-tags/remove-ticket-tags.mjs New action: removes tags from a ticket using removeTicketTags method.
components/freshdesk/actions/set-ticket-tags/set-ticket-tags.mjs New action: sets (replaces) all tags on a ticket using setTicketTags method.
components/freshdesk/actions/update-ticket/update-ticket.mjs Added optional tags property to allow setting/replacing ticket tags during update.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ActionModule
    participant FreshdeskApp
    participant FreshdeskAPI

    User->>ActionModule: Trigger (add/remove/set) ticket tags
    ActionModule->>FreshdeskApp: Call corresponding method (addTicketTags/removeTicketTags/setTicketTags)
    FreshdeskApp->>FreshdeskAPI: Fetch current ticket (if needed)
    FreshdeskAPI-->>FreshdeskApp: Return ticket data
    FreshdeskApp->>FreshdeskAPI: Update ticket tags (PUT request)
    FreshdeskAPI-->>FreshdeskApp: Confirm update
    FreshdeskApp-->>ActionModule: Return result
    ActionModule-->>User: Show summary message
Loading

Poem

🐇
Tags hop on, tags hop off,
Freshdesk tickets never scoff.
Add, remove, or set anew—
Rabbits love what code can do!
With every ticket, order grows,
In fields of tags, efficiency shows.
🏷️✨

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/freshdesk/actions/add-ticket-tags/add-ticket-tags.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/set-ticket-tags/set-ticket-tags.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)

  • 2 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.

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.

@adolfo-pd adolfo-pd added the User submitted Submitted by a user label Jul 14, 2025
@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
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: 0

♻️ Duplicate comments (1)
components/freshdesk/actions/set-ticket-tags/set-ticket-tags.mjs (1)

31-33: Consistent validation pattern across tag actions.

The validation follows the same pattern as the other tag actions, which is good for consistency. The same suggestion about shared validation utility applies here as well.

🧹 Nitpick comments (3)
components/freshdesk/freshdesk.app.mjs (1)

119-124: Consider adding client-side validation for tag length constraint.

The property description mentions "32 characters or less" but there's no validation to enforce this constraint. Consider adding validation to prevent API errors.

 ticketTags: {
   type: "string[]",
   label: "Tags",
   description: "Array of tags to apply to the ticket. Each tag must be 32 characters or less.",
   optional: true,
+  validate: (tags) => {
+    if (!Array.isArray(tags)) return true;
+    const invalidTags = tags.filter(tag => typeof tag !== 'string' || tag.length > 32);
+    if (invalidTags.length > 0) {
+      throw new Error(`Invalid tags: ${invalidTags.join(', ')}. Each tag must be a string of 32 characters or less.`);
+    }
+    return true;
+  },
 },
components/freshdesk/actions/remove-ticket-tags/remove-ticket-tags.mjs (1)

31-33: Consider enhancing validation for better user experience.

The validation checks for empty arrays but doesn't validate individual tag values. Consider adding validation for empty strings or invalid characters.

 if (!ticketTags || ticketTags.length === 0) {
   throw new Error("At least one tag must be provided");
 }
+
+// Validate individual tags
+const invalidTags = ticketTags.filter(tag => !tag || typeof tag !== 'string' || tag.trim().length === 0);
+if (invalidTags.length > 0) {
+  throw new Error("All tags must be non-empty strings");
+}
components/freshdesk/actions/add-ticket-tags/add-ticket-tags.mjs (1)

31-33: Consider consistent validation across all tag actions.

The validation logic is identical to the remove action, which is good for consistency. However, consider extracting this validation into a shared utility function to reduce code duplication.

In a shared utility file:

export function validateTags(tags, operationName) {
  if (!tags || tags.length === 0) {
    throw new Error(`At least one tag must be provided for ${operationName}`);
  }
  
  const invalidTags = tags.filter(tag => !tag || typeof tag !== 'string' || tag.trim().length === 0);
  if (invalidTags.length > 0) {
    throw new Error("All tags must be non-empty strings");
  }
}
📜 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 e292f3f.

📒 Files selected for processing (5)
  • components/freshdesk/actions/add-ticket-tags/add-ticket-tags.mjs (1 hunks)
  • components/freshdesk/actions/remove-ticket-tags/remove-ticket-tags.mjs (1 hunks)
  • components/freshdesk/actions/set-ticket-tags/set-ticket-tags.mjs (1 hunks)
  • components/freshdesk/actions/update-ticket/update-ticket.mjs (1 hunks)
  • components/freshdesk/freshdesk.app.mjs (2 hunks)
🔇 Additional comments (7)
components/freshdesk/freshdesk.app.mjs (3)

275-293: Well-implemented method with proper documentation.

The setTicketTags method correctly replaces all existing tags on a ticket with the provided array. The JSDoc documentation is clear and the implementation is straightforward.


301-317: Excellent implementation with proper duplicate handling.

The addTicketTags method correctly fetches current tags and merges them with new tags using Set for deduplication. The logic is sound and handles edge cases properly.


325-342: Solid implementation with efficient filtering.

The removeTicketTags method efficiently filters out specified tags using Set for optimal lookup performance. The implementation correctly handles the case where some tags to remove may not exist.

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

93-99: Clean integration of tag management into update action.

The tags property is properly integrated using the ticketTags prop definition from the app. The description clearly communicates that this will replace all existing tags, which is consistent with the underlying API behavior.

components/freshdesk/actions/remove-ticket-tags/remove-ticket-tags.mjs (1)

35-42: Well-structured action with clear feedback.

The action properly calls the app method and provides clear feedback via the summary message. The implementation is consistent with other actions in the codebase.

components/freshdesk/actions/add-ticket-tags/add-ticket-tags.mjs (1)

35-42: Consistent implementation with appropriate feedback.

The action correctly calls the app's addTicketTags method and provides clear user feedback. The implementation maintains consistency with other tag actions.

components/freshdesk/actions/set-ticket-tags/set-ticket-tags.mjs (1)

35-42: Clean implementation completing the tag management suite.

The action properly implements the set/replace functionality and provides clear feedback. Combined with the add and remove actions, this completes a comprehensive tag management system for Freshdesk tickets.

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