Skip to content

Zendesk - View, List, Search Tickets actions #16640

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

Merged
merged 2 commits into from
May 14, 2025
Merged

Zendesk - View, List, Search Tickets actions #16640

merged 2 commits into from
May 14, 2025

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented May 12, 2025

Resolves #16632

Summary by CodeRabbit

  • New Features

    • Introduced actions to retrieve detailed ticket information, list tickets with sorting and limits, and search for tickets in Zendesk.
    • Added new options for sorting and limiting ticket queries.
  • Enhancements

    • Expanded integration capabilities with improved ticket retrieval, sorting, and search functionalities.
  • Chores

    • Updated version numbers for several actions and sources.
    • Upgraded package and dependency versions.

Copy link

vercel bot commented May 12, 2025

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

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) May 12, 2025 6:44pm
pipedream-docs ⬜️ Ignored (Inspect) May 12, 2025 6:44pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) May 12, 2025 6:44pm

Copy link
Contributor

coderabbitai bot commented May 12, 2025

Walkthrough

This update introduces three new Zendesk actions: Get Ticket Info, List Tickets, and Search Tickets. Supporting changes include new helper methods and constants for sorting and pagination, as well as version bumps for several existing actions and sources. The Zendesk app is enhanced with new prop definitions and methods to facilitate ticket retrieval.

Changes

File(s) Change Summary
components/zendesk/actions/get-ticket-info/get-ticket-info.mjs Added new "Get Ticket Info" action to retrieve details for a specific Zendesk ticket.
components/zendesk/actions/list-tickets/list-tickets.mjs Added new "List Tickets" action to fetch a list of Zendesk tickets with sorting and pagination support.
components/zendesk/actions/search-tickets/search-tickets.mjs Added new "Search Tickets" action to search Zendesk tickets with query, sorting, and pagination.
components/zendesk/zendesk.app.mjs Added prop definitions for sorting/limit; added methods for getting ticket info, searching, and paginating.
components/zendesk/common/constants.mjs Added SORT_BY_OPTIONS constant for sortable ticket fields.
components/zendesk/actions/create-ticket/create-ticket.mjs
components/zendesk/actions/delete-ticket/delete-ticket.mjs
components/zendesk/actions/update-ticket/update-ticket.mjs
Bumped version numbers in action metadata only.
components/zendesk/sources/new-ticket/new-ticket.mjs
components/zendesk/sources/ticket-added-to-view/ticket-added-to-view.mjs
components/zendesk/sources/ticket-closed/ticket-closed.mjs
components/zendesk/sources/ticket-pended/ticket-pended.mjs
components/zendesk/sources/ticket-solved/ticket-solved.mjs
components/zendesk/sources/ticket-updated/ticket-updated.mjs
Bumped version numbers in source metadata only.
components/zendesk/package.json Updated package version and upgraded @pipedream/platform dependency version.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Action
    participant ZendeskApp
    participant ZendeskAPI

    User->>Action: Trigger "Get Ticket Info"
    Action->>ZendeskApp: getTicketInfo(ticketId, customSubdomain)
    ZendeskApp->>ZendeskAPI: GET /tickets/{ticketId}
    ZendeskAPI-->>ZendeskApp: Ticket info
    ZendeskApp-->>Action: Ticket info
    Action-->>User: Ticket info result

    User->>Action: Trigger "List Tickets"
    Action->>ZendeskApp: paginate(listTickets, args, "tickets", limit)
    loop For each page
        ZendeskApp->>ZendeskAPI: GET /tickets?page=N
        ZendeskAPI-->>ZendeskApp: Tickets page
    end
    ZendeskApp-->>Action: All tickets
    Action-->>User: Tickets list

    User->>Action: Trigger "Search Tickets"
    Action->>ZendeskApp: paginate(searchTickets, args, "results", limit)
    loop For each page
        ZendeskApp->>ZendeskAPI: GET /search?query=...
        ZendeskAPI-->>ZendeskApp: Search results page
    end
    ZendeskApp-->>Action: All search results
    Action-->>User: Tickets search results
Loading

Assessment against linked issues

Objective Addressed Explanation
Add "Get Ticket Info" action for Zendesk (#16632)
Add "List Tickets" action for Zendesk (#16632)
Add "Search Tickets" action for Zendesk (#16632)

Poem

A bunny hopped through code so bright,
New ticket actions leapt into sight!
Search, list, and view—what a treat,
Zendesk magic now complete.
With sorting, paging, all in tow,
This fluffy coder’s proud to show:
🐇✨ Tickets found, tickets new—
All thanks to this code review!

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/zendesk/actions/create-ticket/create-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 packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/zendesk/actions/delete-ticket/delete-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 packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/zendesk/actions/get-ticket-info/get-ticket-info.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 packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

  • 11 others

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.

✨ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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
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: 3

🧹 Nitpick comments (3)
components/zendesk/zendesk.app.mjs (3)

272-302: Consider adding error handling to the pagination method

The paginate method is well-implemented as an async generator for handling paginated responses. However, it lacks error handling for API call failures.

Consider adding try/catch blocks to handle potential API errors gracefully:

async *paginate({
  fn, args, resourceKey, max,
}) {
  args = {
    ...args,
    params: {
      ...args?.params,
      per_page: constants.DEFAULT_LIMIT,
      page: 1,
    },
  };
  let hasMore = true;
  let count = 0;
  while (hasMore) {
+   try {
      const response = await fn(args);
      const items = resourceKey
        ? response[resourceKey]
        : response;
      if (!items?.length) {
        return;
      }
      for (const item of items) {
        yield item;
        if (max && ++count >= max) {
          return;
        }
      }
      hasMore = !!response.next_page;
      args.params.page += 1;
+   } catch (error) {
+     console.error("Pagination error:", error);
+     throw error; // Or handle it according to your application's needs
+   }
  }
},

208-210: Add validation for required ticketId parameter

The getTicketInfo method should validate that ticketId is provided before making the API request.

getTicketInfo({
  ticketId, ...args
} = {}) {
+  if (!ticketId) {
+    throw new Error("ticketId is required");
+  }
  return this.makeRequest({
    path: `/tickets/${ticketId}`,
    ...args,
  });
},

216-221: Consider adding documentation for search parameters

The searchTickets method would benefit from documentation that explains what parameters are expected or supported.

/**
+ * Search for tickets in Zendesk
+ * @param {Object} args - The search arguments
+ * @param {Object} args.params - The query parameters
+ * @param {string} args.params.query - The search query string (e.g., "status:open")
+ * @param {string} args.customSubdomain - Optional custom subdomain
+ * @returns {Promise<Object>} The search results
+ */
searchTickets(args = {}) {
  return this.makeRequest({
    path: "/search",
    ...args,
  });
},
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2c752f6 and 7d4365e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (15)
  • components/zendesk/actions/create-ticket/create-ticket.mjs (1 hunks)
  • components/zendesk/actions/delete-ticket/delete-ticket.mjs (1 hunks)
  • components/zendesk/actions/get-ticket-info/get-ticket-info.mjs (1 hunks)
  • components/zendesk/actions/list-tickets/list-tickets.mjs (1 hunks)
  • components/zendesk/actions/search-tickets/search-tickets.mjs (1 hunks)
  • components/zendesk/actions/update-ticket/update-ticket.mjs (1 hunks)
  • components/zendesk/common/constants.mjs (2 hunks)
  • components/zendesk/package.json (2 hunks)
  • components/zendesk/sources/new-ticket/new-ticket.mjs (1 hunks)
  • components/zendesk/sources/ticket-added-to-view/ticket-added-to-view.mjs (1 hunks)
  • components/zendesk/sources/ticket-closed/ticket-closed.mjs (1 hunks)
  • components/zendesk/sources/ticket-pended/ticket-pended.mjs (1 hunks)
  • components/zendesk/sources/ticket-solved/ticket-solved.mjs (1 hunks)
  • components/zendesk/sources/ticket-updated/ticket-updated.mjs (1 hunks)
  • components/zendesk/zendesk.app.mjs (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (19)
components/zendesk/actions/update-ticket/update-ticket.mjs (1)

8-8: Version bump to 0.1.3
Updated the action version from 0.1.2 to 0.1.3 to align with the coordinated Zendesk release. No functional changes detected.

components/zendesk/sources/ticket-updated/ticket-updated.mjs (1)

9-9: Version bump to 0.2.3
Incremented the source component version from 0.2.2 to 0.2.3 for consistency with the overall Zendesk package update. No logic modifications.

components/zendesk/actions/delete-ticket/delete-ticket.mjs (1)

8-8: Version bump to 0.1.3
Bumped the delete-ticket action from 0.1.2 to 0.1.3, matching the update in other Zendesk action modules. Implementation unchanged.

components/zendesk/sources/ticket-added-to-view/ticket-added-to-view.mjs (1)

8-8: Version bump to 0.0.3
Updated the source version from 0.0.2 to 0.0.3 to maintain parity with other Zendesk sources. No code logic changed.

components/zendesk/sources/ticket-closed/ticket-closed.mjs (1)

9-9: Version bump to 0.2.3
Incremented version from 0.2.2 to 0.2.3 in line with the coordinated component release. No functional adjustments.

components/zendesk/sources/ticket-solved/ticket-solved.mjs (1)

9-9: Source version updated to 0.2.3
This version bump aligns with the coordinated update across all Zendesk source components and has no functional impact.

components/zendesk/actions/create-ticket/create-ticket.mjs (1)

8-8: Action version bumped to 0.1.3
The version increment correctly reflects the latest release; no other logic was modified.

components/zendesk/sources/new-ticket/new-ticket.mjs (1)

9-9: Source version updated to 0.2.3
Consistent with other Zendesk sources, this bump has no side effects.

components/zendesk/sources/ticket-pended/ticket-pended.mjs (1)

9-9: Source version updated to 0.2.3
Matches the coordinated version bump strategy for Zendesk sources.

components/zendesk/package.json (2)

3-3: Package version updated to 0.7.0
This bump reflects the introduction of new ticket actions and app enhancements.


17-17: Dependency @pipedream/platform bumped to ^3.0.3
Ensures compatibility with the newly added pagination and ticket-retrieval methods in the Zendesk app.

components/zendesk/common/constants.mjs (2)

225-236: The addition of SORT_BY_OPTIONS looks good!

This array of sorting options aligns with Zendesk's API field names and will provide good flexibility for the new ticket actions. The constant follows the established naming convention (all uppercase for constants).


258-258: LGTM: Properly exported the new constant.

The new SORT_BY_OPTIONS constant is correctly added to the default exports object.

components/zendesk/zendesk.app.mjs (6)

147-153: LGTM: Good addition for sorting functionality

The sortBy propDefinition is well defined with appropriate labeling and description. It correctly references constants.SORT_BY_OPTIONS for the available sorting fields.


154-163: LGTM: Standard sort order implementation

The sortOrder propDefinition is well structured with clear labels and correctly offers the standard "asc" and "desc" options.


164-170: LGTM: Well-defined limit property

The limit propDefinition is appropriately implemented with a reasonable default value of 100, which helps prevent excessive data fetching while still providing flexibility.


208-215: LGTM: Clean ticket info retrieval implementation

The getTicketInfo method follows the established pattern in the codebase for API method implementations and correctly uses the makeRequest utility.


216-221: LGTM: Straightforward search implementation

The searchTickets method provides a clean wrapper for the Zendesk search API endpoint.


272-285:

❓ Verification inconclusive

Verify pagination parameter compatibility

The paginate method uses per_page and page parameters which assumes these are the parameter names expected by all Zendesk API endpoints that support pagination.

Please verify that all Zendesk endpoints that will use this pagination method support these specific parameter names. If some endpoints use different parameter names for pagination, consider making the parameter names configurable.


🏁 Script executed:

#!/bin/bash
# Check Zendesk API documentation for pagination parameters
echo "Checking for Zendesk API pagination documentation..."
curl -s "https://developer.zendesk.com/api-reference/ticketing/introduction/pagination/" | grep -i "per_page\|page" -A 5 -B 5

Length of output: 32547


Verify pagination parameter compatibility

I attempted to retrieve the Zendesk pagination docs at the provided URL but received a 404 response. Please confirm that all endpoints using this helper support the page and per_page query parameters. If any endpoints require different pagination parameters (for example, cursor-based pagination), consider making the parameter names configurable in the paginate method.

• File: components/zendesk/zendesk.app.mjs, lines 272–285
• Method: async *paginate({ fn, args, resourceKey, max })

Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

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

LGTM!

@michelle0927 michelle0927 merged commit 7135567 into master May 14, 2025
11 checks passed
@michelle0927 michelle0927 deleted the issue-16632 branch May 14, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ACTION] View, List, Search Tickets actions for Zendesk
2 participants