-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughThis 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
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
Assessment against linked issues
Poem
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
components/zendesk/actions/create-ticket/create-ticket.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/zendesk/actions/delete-ticket/delete-ticket.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/zendesk/actions/get-ticket-info/get-ticket-info.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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
🧹 Nitpick comments (3)
components/zendesk/zendesk.app.mjs (3)
272-302
: Consider adding error handling to the pagination methodThe
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 parameterThe
getTicketInfo
method should validate thatticketId
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 parametersThe
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
⛔ 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 ofSORT_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 functionalityThe
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 implementationThe
sortOrder
propDefinition is well structured with clear labels and correctly offers the standard "asc" and "desc" options.
164-170
: LGTM: Well-defined limit propertyThe
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 implementationThe
getTicketInfo
method follows the established pattern in the codebase for API method implementations and correctly uses the makeRequest utility.
216-221
: LGTM: Straightforward search implementationThe
searchTickets
method provides a clean wrapper for the Zendesk search API endpoint.
272-285
:❓ Verification inconclusive
Verify pagination parameter compatibility
The
paginate
method usesper_page
andpage
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 5Length 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
andper_page
query parameters. If any endpoints require different pagination parameters (for example, cursor-based pagination), consider making the parameter names configurable in thepaginate
method.• File:
components/zendesk/zendesk.app.mjs
, lines 272–285
• Method:async *paginate({ fn, args, resourceKey, max })
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.
LGTM!
Resolves #16632
Summary by CodeRabbit
New Features
Enhancements
Chores