Skip to content

Conversation

@verhovsky
Copy link
Contributor

@verhovsky verhovsky commented Oct 10, 2025

Closes #18644

The order is list-help-centers.mjs → list-root-categories.mjs → list-articles.mjs or search-articles.mjs → get-article.mjs

A nuance in testing this, when publishing a help article you need to set its visibility to something other than private, otherwise you will not see it in the API.

Summary by CodeRabbit

  • New Features
    • Added Zoho Desk actions: List Help Centers, List Root Categories, List Articles, Search Articles, and Get Article.
    • Added Portal ID selector, Article ID input, and Max Results option for targeting and limiting queries.
    • List and Search actions now stream results and support sorting, filtering, and bounded result counts.
  • Chores
    • Bumped Zoho Desk package version to 0.2.2.

@verhovsky verhovsky requested a review from GTFalcao October 10, 2025 00:11
@vercel
Copy link

vercel bot commented Oct 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Oct 15, 2025 8:01pm

@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:

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 10, 2025

Walkthrough

Adds Zoho Desk Help Center and Knowledge Base support: new actions to list help centers, list/search/get articles, and list root categories; extends the zoho_desk app with portalId/articleId/maxResults props, KB methods and streaming helpers; updates constants and bumps package version.

Changes

Cohort / File(s) Summary
New action: Get Article
components/zoho_desk/actions/get-article/get-article.mjs
Adds "Get Article" action exporting metadata, props (zohoDesk, orgId, portalId, articleId) and a run() that calls this.zohoDesk.getKnowledgeBaseArticle, exports a $summary and returns the article.
New action: List Articles
components/zoho_desk/actions/list-articles/list-articles.mjs
Adds "List Articles" action with props (including portalId, categoryId, sortBy, tag, maxResults) that streams via this.zohoDesk.listKnowledgeBaseArticlesStream, accumulates results, exports $summary and returns articles.
New action: List Help Centers
components/zoho_desk/actions/list-help-centers/list-help-centers.mjs
Adds "List Help Centers" action that calls this.zohoDesk.listHelpCenters({ params: { orgId } }), exports $summary and returns help centers.
New action: List Root Categories
components/zoho_desk/actions/list-root-categories/list-root-categories.mjs
Adds "List Root Categories" action with props (portalId, filters, maxResults) that streams via this.zohoDesk.listKnowledgeBaseRootCategoriesStream, accumulates results, exports $summary and returns categories.
New action: Search Articles
components/zoho_desk/actions/search-articles/search-articles.mjs
Adds "Search Articles" action with props (portalId, searchStr, categoryId, sortBy, searchKeyWordMatch, maxResults) that streams via this.zohoDesk.searchKnowledgeBaseArticlesStream, accumulates results, exports $summary and returns matches.
App enhancements
components/zoho_desk/zoho_desk.app.mjs
Adds portalId, articleId, maxResults propDefinitions; refactors URL construction to use apiPrefix; adds KB public methods and streaming helpers: listHelpCenters, listKnowledgeBaseArticles (+ stream), getKnowledgeBaseArticle, searchKnowledgeBaseArticles (+ stream), listKnowledgeBaseRootCategories (+ stream); uses CORE_API_PATH and PORTAL_API_PATH.
Constants
components/zoho_desk/common/constants.mjs
Renames VERSION_PATHCORE_API_PATH = "/api/v1" and adds PORTAL_API_PATH = "/portal/api"; updates default export.
Package
components/zoho_desk/package.json
Bumps package version from 0.2.10.2.2.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Action as Zoho Desk Action
  participant App as zoho_desk.app
  participant API as Zoho Desk API

  User->>Action: invoke action (orgId, portalId, params/articleId)
  Action->>App: call KB method (listHelpCenters / listKBArticles / getKBArticle / searchKBArticles / listRootCategories)
  App->>API: HTTP request(s) using CORE_API_PATH or PORTAL_API_PATH
  API-->>App: return item(s) or paginated responses
  alt Streaming
    App-->>Action: yield items (async iterator)
    loop accumulate
      Action->>Action: collect items until maxResults or end
    end
  else Single fetch
    App-->>Action: return single entity
  end
  Action->>Action: $.export("$summary", ...)
  Action-->>User: return collected data
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

I hop through portals, whiskers twitch and bright,
Fetching articles by day and searching by night.
Streams of pages spill like carrots in a row,
Help centers and categories in a cheerful show.
A rabbit cheers—KB features ready to go! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description does not follow the repository’s required template because it lacks the “## WHY” section and does not explain the rationale behind the changes. Update the pull request description to include the “## WHY” section according to the template and provide the motivation for introducing these help center and knowledge base actions.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed The title refers to the addition of new help center actions which is part of the changeset but omits the equally important knowledge base actions, making it only partially related to the full scope of the pull request.
Linked Issues Check ✅ Passed The pull request fulfills the linked issue’s requirements by implementing all requested actions—list help centers, list root categories, list articles, get article, and search articles—as specified in issue #18644.
Out of Scope Changes Check ✅ Passed All modifications directly support the implementation of the help center and knowledge base actions and there are no unrelated or out-of-scope changes in this pull request.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1bf3627 and 419d4b9.

📒 Files selected for processing (1)
  • components/zoho_desk/zoho_desk.app.mjs (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/zoho_desk/zoho_desk.app.mjs (1)
components/zoho_desk/actions/list-help-centers/list-help-centers.mjs (1)
  • helpCenters (26-31)
⏰ 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). (5)
  • GitHub Check: Ensure component commits modify component versions
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
🔇 Additional comments (4)
components/zoho_desk/zoho_desk.app.mjs (4)

24-46: LGTM! Clean propDefinition for portal selection.

The implementation correctly guards against missing orgId, uses the new listHelpCenters method, and provides a sensible fallback for missing names.


140-143: Clean refactor to support multiple API paths.

The change from versionPath to apiPrefix is well-coordinated with the makeRequest method update, enabling both core API and portal API endpoints.


158-182: LGTM! Backward-compatible API path refactor.

The default value for apiPrefix ensures existing methods continue using the core API path while new knowledge base methods can specify the portal API path.


302-381: LGTM! Well-structured knowledge base API methods.

All seven methods follow consistent patterns:

  • Non-streaming methods correctly use PORTAL_API_PATH for knowledge base endpoints
  • Streaming methods properly delegate to getResourcesStream with appropriate resource functions
  • Implementation aligns with the PR's stated action sequence (list help centers → list root categories → list/search articles → get article)

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (2)
components/zoho_desk/zoho_desk.app.mjs (2)

24-46: Consider adding error handling in the async options.

The portalId prop's async options function calls listHelpCenters without error handling. If the API call fails, the error could bubble up and cause issues for users trying to configure the component.

Consider wrapping the API call in a try-catch block:

     async options({ orgId }) {
       if (!orgId) {
         return [];
       }
+      try {
         const { data: helpCenters = [] } =
           await this.listHelpCenters({
             params: {
               orgId,
             },
           });
         return helpCenters.map(({
           portalId: value,
           name: label,
         }) => ({
           value,
           label: label || value,
         }));
+      } catch (error) {
+        console.error("Error fetching help centers:", error);
+        return [];
+      }
     },

126-130: Consider enhancing articleId with async options.

While the simple string approach works, adding async options (similar to contactId and ticketId props) would improve user experience by allowing users to select from available articles rather than manually entering IDs.

This would require additional context (e.g., orgId and portalId) to fetch available articles, so it can be implemented as a future enhancement if needed.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17ae289 and 2af7bf0.

📒 Files selected for processing (2)
  • components/zoho_desk/common/constants.mjs (2 hunks)
  • components/zoho_desk/zoho_desk.app.mjs (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/zoho_desk/common/constants.mjs
🧰 Additional context used
🧬 Code graph analysis (1)
components/zoho_desk/zoho_desk.app.mjs (1)
components/zoho_desk/actions/list-help-centers/list-help-centers.mjs (1)
  • helpCenters (26-31)
⏰ 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: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
🔇 Additional comments (2)
components/zoho_desk/zoho_desk.app.mjs (2)

295-368: LGTM! Well-structured knowledge base methods.

The new help center and knowledge base methods are well-implemented:

  • Consistent use of makeRequest with apiPrefix: constants.PORTAL_API_PATH for portal API endpoints
  • Proper async generator patterns for streaming methods using yield* and getResourcesStream
  • Clear, RESTful path conventions (/helpCenters, /kbArticles, /kbArticles/search, /kbRootCategories)
  • Correct parameter handling and destructuring in stream methods
  • Implementation aligns with how they're consumed in the action files

The code follows the established patterns in the codebase and integrates cleanly with the existing infrastructure.


133-136: Constants definitions verified. CORE_API_PATH and PORTAL_API_PATH are defined in components/zoho_desk/common/constants.mjs with the expected values.

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.

Looks good @verhovsky , thanks for the contribution! Left one comment

Comment on lines 96 to 104
const stream = this.zohoDesk.searchKnowledgeBaseArticlesStream({
params,
});
for await (const article of stream) {
articles.push(article);
if (maxResults && articles.length >= maxResults) {
break;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we have several components using the same pagination method, maybe we should move this logic to a paginate method in the app file. This is a common pattern for apps that have lots of paginated resources using the same standard pagination parameters.

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/zoho_desk/actions/search-articles/search-articles.mjs (1)

97-104: Note: Pagination pattern consistency.

This implementation uses the streaming pattern from getResourcesStream in the app file, which is the correct approach. The for-await-of loop to accumulate results is a simple, readable pattern that's consistent with other actions in the codebase (list-articles, list-root-categories).

The past review comment from GTFalcao about extracting common pagination logic has merit, but the current approach already centralizes the core pagination in getResourcesStream. The remaining accumulation logic is minimal and action-specific.

🧹 Nitpick comments (2)
components/zoho_desk/zoho_desk.app.mjs (1)

295-374: Consider adding JSDoc documentation for the new knowledge base methods.

While the method implementations are correct and follow the existing patterns in the file, adding JSDoc comments would improve maintainability and help other developers understand the expected parameters, return types, and usage. This aligns with the Pipedream component guidelines mentioned in the PR comments.

Example:

/**
 * Lists all help centers for the organization
 * @param {Object} args - Request arguments
 * @param {Object} args.params - Query parameters
 * @param {string} args.params.orgId - Organization ID
 * @returns {Promise<Object>} Response with data array of help centers
 */
listHelpCenters(args = {}) {
  // ...
}

Note: Since existing methods in this file don't use JSDoc either, this is a broader file-level improvement opportunity rather than a requirement for these specific additions.

Based on coding guidelines

components/zoho_desk/actions/search-articles/search-articles.mjs (1)

89-95: Consider filtering undefined parameter values.

The params object includes all properties regardless of whether they have values. While the API likely ignores undefined values, filtering them out would make the request cleaner and reduce payload size slightly.

Example refactor:

 const params = {
   portalId,
   searchStr,
-  categoryId,
-  sortBy,
-  searchKeyWordMatch,
+  ...(categoryId && { categoryId }),
+  ...(sortBy && { sortBy }),
+  ...(searchKeyWordMatch && { searchKeyWordMatch }),
 };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between afeb950 and b1e0ec2.

📒 Files selected for processing (4)
  • components/zoho_desk/actions/list-articles/list-articles.mjs (1 hunks)
  • components/zoho_desk/actions/list-root-categories/list-root-categories.mjs (1 hunks)
  • components/zoho_desk/actions/search-articles/search-articles.mjs (1 hunks)
  • components/zoho_desk/zoho_desk.app.mjs (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/zoho_desk/actions/list-root-categories/list-root-categories.mjs
  • components/zoho_desk/actions/list-articles/list-articles.mjs
🧰 Additional context used
🧬 Code graph analysis (2)
components/zoho_desk/zoho_desk.app.mjs (1)
components/zoho_desk/actions/list-help-centers/list-help-centers.mjs (1)
  • helpCenters (26-31)
components/zoho_desk/actions/search-articles/search-articles.mjs (2)
components/zoho_desk/actions/list-articles/list-articles.mjs (3)
  • params (75-80)
  • stream (83-86)
  • articles (82-82)
components/zoho_desk/actions/list-root-categories/list-root-categories.mjs (2)
  • params (85-92)
  • stream (94-97)
⏰ 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: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
🔇 Additional comments (4)
components/zoho_desk/zoho_desk.app.mjs (3)

24-46: Well-implemented propDefinition with defensive checks.

The portalId propDefinition correctly handles the dependency on orgId by returning an empty array when orgId is not provided. The label fallback (label: label || value) ensures a value is always displayed even if the help center name is missing.


133-175: LGTM! Dual API path support implemented correctly.

The refactoring from versionPath to apiPrefix cleanly supports both core API endpoints (/api/v1/) and portal API endpoints (/portal/api/). The default value of constants.CORE_API_PATH maintains backward compatibility with existing methods.


309-374: LGTM! Streaming methods follow a consistent pattern.

The three async generator methods (listKnowledgeBaseArticlesStream, searchKnowledgeBaseArticlesStream, listKnowledgeBaseRootCategoriesStream) correctly delegate to the existing getResourcesStream helper, maintaining a clean and consistent approach to paginated results.

components/zoho_desk/actions/search-articles/search-articles.mjs (1)

1-78: LGTM! Well-structured action with comprehensive properties.

The action metadata and props are well-defined:

  • Clear descriptions for all properties
  • Appropriate use of optional for non-required fields
  • Good UX with labeled options for sortBy and searchKeyWordMatch
  • Proper dependency chain: portalId depends on orgId
  • Sensible defaults for sortBy and maxResults

@verhovsky verhovsky requested a review from GTFalcao October 15, 2025 19:28
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: 2

🧹 Nitpick comments (1)
components/zoho_desk/zoho_desk.app.mjs (1)

24-46: Consider adding error handling to portalId options.

If listHelpCenters fails (network error, auth issue, etc.), the async options function will throw and the user will see a cryptic error. Consider wrapping the call in try-catch and returning an empty array or a helpful error message.

Example:

 async options({ orgId }) {
   if (!orgId) {
     return [];
   }
+  try {
     const { data: helpCenters = [] } =
       await this.listHelpCenters({
         params: {
           orgId,
         },
       });
     return helpCenters.map(({
       portalId: value,
       name: label,
     }) => ({
       value,
       label: label || value,
     }));
+  } catch (error) {
+    console.error("Failed to load help centers:", error);
+    return [];
+  }
 },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b1e0ec2 and 1bf3627.

📒 Files selected for processing (4)
  • components/zoho_desk/actions/list-articles/list-articles.mjs (1 hunks)
  • components/zoho_desk/actions/list-root-categories/list-root-categories.mjs (1 hunks)
  • components/zoho_desk/actions/search-articles/search-articles.mjs (1 hunks)
  • components/zoho_desk/zoho_desk.app.mjs (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/zoho_desk/actions/search-articles/search-articles.mjs
🧰 Additional context used
🧬 Code graph analysis (3)
components/zoho_desk/actions/list-root-categories/list-root-categories.mjs (2)
components/zoho_desk/actions/list-articles/list-articles.mjs (2)
  • params (72-77)
  • stream (80-83)
components/zoho_desk/actions/search-articles/search-articles.mjs (2)
  • params (86-92)
  • stream (94-97)
components/zoho_desk/actions/list-articles/list-articles.mjs (3)
components/zoho_desk/actions/list-root-categories/list-root-categories.mjs (2)
  • params (82-89)
  • stream (91-94)
components/zoho_desk/actions/search-articles/search-articles.mjs (3)
  • params (86-92)
  • articles (98-98)
  • stream (94-97)
components/zoho_desk/actions/get-article/get-article.mjs (1)
  • article (44-49)
components/zoho_desk/zoho_desk.app.mjs (1)
components/zoho_desk/actions/list-help-centers/list-help-centers.mjs (1)
  • helpCenters (26-31)
🪛 GitHub Actions: Pull Request Checks
components/zoho_desk/zoho_desk.app.mjs

[error] 134-134: ESLint: Strings must use doublequote (quotes). Command: 'pnpm exec eslint ...' to fix.

🪛 GitHub Check: Lint Code Base
components/zoho_desk/zoho_desk.app.mjs

[failure] 134-134:
Strings must use doublequote

⏰ 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: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (4)
components/zoho_desk/zoho_desk.app.mjs (2)

140-142: LGTM: API prefix approach cleanly handles dual endpoint patterns.

The apiPrefix parameter elegantly addresses the different base paths (/api/v1/ vs /portal/api/) mentioned in the past review comment. The default to CORE_API_PATH ensures backward compatibility with existing methods while allowing KB methods to use PORTAL_API_PATH.

Also applies to: 158-182


302-381: LGTM: Consistent streaming pattern across all KB methods.

The three streaming methods (listKnowledgeBaseArticlesStream, searchKnowledgeBaseArticlesStream, listKnowledgeBaseRootCategoriesStream) follow a consistent pattern by delegating to getResourcesStream with the appropriate resourceFn. This ensures predictable pagination behavior across all KB endpoints.

components/zoho_desk/actions/list-root-categories/list-root-categories.mjs (1)

71-105: LGTM: Standard streaming action pattern.

The implementation correctly:

  • Streams results using the KB API
  • Accumulates into an array for return
  • Exports a summary with proper pluralization ("category" vs "categories")
  • Follows the pattern established by other actions in this PR
components/zoho_desk/actions/list-articles/list-articles.mjs (1)

63-93: LGTM: Consistent with the established action pattern.

The implementation follows the same streaming-to-array pattern as list-root-categories and correctly handles pluralization in the summary export.

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!

@verhovsky verhovsky merged commit affd372 into PipedreamHQ:master Oct 15, 2025
8 of 10 checks passed
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] Help Center & Knowledge Base Actions for Zoho Desk

3 participants