-
Notifications
You must be signed in to change notification settings - Fork 5.5k
19164 action zendesk helpcenter #19280
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?
Conversation
- Bump version of @pipedream/zendesk to 0.11.0 - Add new actions: Get Article, Get Macro, List Active Macros, and List Articles - Update existing action versions: Add Ticket Tags (0.0.7), Create Ticket (0.1.11), Delete Ticket (0.1.11), Get Ticket Info (0.0.9), Get User Info (0.0.6), List Locales (0.0.6), List Macros (0.0.6), List Ticket Comments (0.0.6), List Tickets (0.0.9), Remove Ticket Tags (0.0.7), Set Custom Ticket Fields (0.0.4), Set Ticket Tags (0.0.7), Update Ticket (0.2.4), and others. - Introduce new constants for ACCESS_OPTIONS and INCLUDE_OPTIONS in common/constants.mjs. - Enhance locale handling in existing actions and sources.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds locale-aware Help Center and macro support to the Zendesk component: new actions for Get Article, List Articles, Get Macro, List Active Macros; new locale- and resource-aware propDefinitions and methods in the app; new constants; and many version bumps across actions and sources. (≤50 words) Changes
Sequence Diagram(s)sequenceDiagram
participant Action as Get Article (action)
participant App as zendesk.app.mjs
participant API as Zendesk API
Action->>App: run({ $, locale, articleId })
App->>App: prepareLocalePath(locale)
Note over App: Build locale-prefixed path if locale provided
App->>API: GET /help_center/{locale}/articles/{articleId}
API-->>App: article data
App-->>Action: return article
Action->>Action: export $summary
sequenceDiagram
participant Action as List Articles (action)
participant App as zendesk.app.mjs
participant API as Zendesk API
Note over Action: Validate props (userId vs category/section)
alt userId provided
Action->>App: listArticles({ userId, locale: null, ... })
else no userId
Action->>App: listArticles({ categoryId?, sectionId?, locale, ... })
end
App->>App: paginate(listArticles, params)
loop pages
App->>API: GET /help_center/{locale}/articles?... (page)
API-->>App: articles page
end
App-->>Action: return combined articles
Action->>Action: export $summary with count
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (3)📚 Learning: 2024-10-08T16:42:59.225ZApplied to files:
📚 Learning: 2024-12-12T19:23:09.039ZApplied to files:
📚 Learning: 2025-09-15T22:01:11.472ZApplied to files:
🧬 Code graph analysis (1)components/zendesk/zendesk.app.mjs (4)
🔇 Additional comments (12)
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. 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: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
components/zendesk/common/constants.mjs (1)
81-81: Critical syntax error: Missing closing braces.Line 81 has a pre-existing syntax error with an unclosed template literal. The value should be
"{{satisfaction.current_comment}}"instead of"{{satisfaction.current_comment".Apply this diff to fix the syntax error:
{ label: "Satisfaction Current Comment", - value: "{{satisfaction.current_comment", + value: "{{satisfaction.current_comment}}", },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (29)
components/zendesk/actions/add-ticket-tags/add-ticket-tags.mjs(1 hunks)components/zendesk/actions/create-ticket/create-ticket.mjs(1 hunks)components/zendesk/actions/delete-ticket/delete-ticket.mjs(1 hunks)components/zendesk/actions/get-article/get-article.mjs(1 hunks)components/zendesk/actions/get-macro/get-macro.mjs(1 hunks)components/zendesk/actions/get-ticket-info/get-ticket-info.mjs(1 hunks)components/zendesk/actions/get-user-info/get-user-info.mjs(1 hunks)components/zendesk/actions/list-active-macros/list-active-macros.mjs(1 hunks)components/zendesk/actions/list-articles/list-articles.mjs(1 hunks)components/zendesk/actions/list-locales/list-locales.mjs(1 hunks)components/zendesk/actions/list-macros/list-macros.mjs(1 hunks)components/zendesk/actions/list-ticket-comments/list-ticket-comments.mjs(1 hunks)components/zendesk/actions/list-tickets/list-tickets.mjs(1 hunks)components/zendesk/actions/remove-ticket-tags/remove-ticket-tags.mjs(1 hunks)components/zendesk/actions/search-tickets/search-tickets.mjs(1 hunks)components/zendesk/actions/set-custom-ticket-fields/set-custom-ticket-fields.mjs(1 hunks)components/zendesk/actions/set-ticket-tags/set-ticket-tags.mjs(1 hunks)components/zendesk/actions/update-ticket/update-ticket.mjs(1 hunks)components/zendesk/common/constants.mjs(2 hunks)components/zendesk/package.json(1 hunks)components/zendesk/sources/locale-updated/locale-updated.mjs(1 hunks)components/zendesk/sources/new-ticket-comment-added/new-ticket-comment-added.mjs(1 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(5 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
Applied to files:
components/zendesk/zendesk.app.mjs
📚 Learning: 2025-09-15T22:01:11.472Z
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.
Applied to files:
components/zendesk/zendesk.app.mjs
🧬 Code graph analysis (2)
components/zendesk/actions/list-active-macros/list-active-macros.mjs (1)
components/zendesk/zendesk.app.mjs (10)
constants(51-61)constants(83-93)constants(115-123)constants(146-154)constants(215-223)constants(245-254)constants(276-284)constants(304-311)constants(415-424)constants(448-452)
components/zendesk/zendesk.app.mjs (4)
components/zendesk/sources/common/webhook.mjs (1)
constants(232-235)components/asana/asana.app.mjs (1)
sections(205-210)components/zendesk/actions/list-articles/list-articles.mjs (1)
articles(94-94)components/zendesk/actions/list-macros/list-macros.mjs (1)
macros(93-93)
⏰ 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: Verify TypeScript components
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
- GitHub Check: pnpm publish
🔇 Additional comments (44)
components/zendesk/sources/new-ticket-comment-added/new-ticket-comment-added.mjs (1)
10-10: Version bump aligns with package updates.The version increment from 0.1.1 to 0.1.2 is consistent with the broader Zendesk package versioning strategy outlined in the PR. No functional changes detected.
components/zendesk/actions/get-ticket-info/get-ticket-info.mjs (1)
8-8: LGTM! Version bump aligns with package release.The version increment from 0.0.8 to 0.0.9 is appropriate and aligns with the broader package version update from 0.10.1 to 0.11.0 mentioned in the PR context. No functional changes were made, so there's no risk of introducing issues.
components/zendesk/actions/add-ticket-tags/add-ticket-tags.mjs (1)
8-8: LGTM: Version bump aligns with package release.The version increment from 0.0.6 to 0.0.7 is appropriate for this coordinated release.
components/zendesk/actions/create-ticket/create-ticket.mjs (1)
8-8: LGTM: Version bump aligns with package release.The version increment is consistent with the coordinated release across Zendesk actions.
components/zendesk/actions/set-ticket-tags/set-ticket-tags.mjs (1)
8-8: LGTM: Version bump aligns with package release.The version increment is consistent with other tag-related actions in this release.
components/zendesk/actions/search-tickets/search-tickets.mjs (1)
8-8: LGTM: Version bump aligns with package release.The version increment is appropriate for this coordinated release.
components/zendesk/sources/ticket-closed/ticket-closed.mjs (1)
9-9: LGTM: Version bump aligns with package release.The version increment is consistent with other source components in this release.
components/zendesk/common/constants.mjs (1)
297-298: LGTM: New constants properly exported.The new
ACCESS_OPTIONSandINCLUDE_OPTIONSconstants are correctly added to the default export and will support the new macro filtering capabilities.components/zendesk/package.json (1)
3-3: Version bump is appropriate, but verify new action files are included.The minor version bump from 0.10.1 to 0.11.0 is semantically correct for adding new features (Help Center actions). However, the AI summary and PR objectives mention new action files (
get-article,list-articles,get-macro,list-active-macros) that are not included in this review set.Please confirm that the following files exist and are part of this PR:
components/zendesk/actions/get-article/get-article.mjscomponents/zendesk/actions/list-articles/list-articles.mjscomponents/zendesk/actions/get-macro/get-macro.mjscomponents/zendesk/actions/list-active-macros/list-active-macros.mjsThese files implement the core PR objectives but are not present in the review set.
components/zendesk/sources/new-ticket/new-ticket.mjs (1)
9-9: LGTM: Version bump aligns with package release.The version increment is consistent with other source components in this release.
components/zendesk/sources/ticket-updated/ticket-updated.mjs (1)
9-9: LGTM! Version bump is appropriate.The version increment from 0.2.9 to 0.2.10 aligns with the package-wide version update with no functional changes.
components/zendesk/actions/delete-ticket/delete-ticket.mjs (1)
8-8: LGTM! Version bump is appropriate.The version increment from 0.1.10 to 0.1.11 aligns with the package-wide version update with no functional changes.
components/zendesk/sources/locale-updated/locale-updated.mjs (1)
9-9: LGTM! Version bump is appropriate.The version increment from 0.0.4 to 0.0.5 aligns with the package-wide version update with no functional changes.
components/zendesk/actions/list-locales/list-locales.mjs (1)
7-7: LGTM! Version bump is appropriate.The version increment from 0.0.5 to 0.0.6 aligns with the package-wide version update with no functional changes.
components/zendesk/actions/set-custom-ticket-fields/set-custom-ticket-fields.mjs (2)
2-3: LGTM! Import order change has no functional impact.The reordering of imports is a cosmetic change that doesn't affect behavior.
10-10: LGTM! Version bump is appropriate.The version increment from 0.0.3 to 0.0.4 aligns with the package-wide version update with no functional changes.
components/zendesk/sources/ticket-added-to-view/ticket-added-to-view.mjs (1)
8-8: LGTM! Version bump is appropriate.The version increment from 0.0.9 to 0.0.10 aligns with the package-wide version update with no functional changes.
components/zendesk/sources/ticket-solved/ticket-solved.mjs (1)
9-9: LGTM! Version bump is appropriate.The version increment from 0.2.9 to 0.2.10 aligns with the package-wide version update with no functional changes.
components/zendesk/actions/get-user-info/get-user-info.mjs (1)
7-7: LGTM! Version bump is appropriate.The version increment from 0.0.5 to 0.0.6 aligns with the package-wide version update with no functional changes.
components/zendesk/sources/ticket-pended/ticket-pended.mjs (1)
9-9: LGTM!Version bump is consistent with the package version update to 0.11.0.
components/zendesk/actions/list-macros/list-macros.mjs (1)
7-7: LGTM!Version bump aligns with the package version update.
components/zendesk/actions/list-tickets/list-tickets.mjs (1)
8-8: LGTM!Version bump is consistent with the package version update.
components/zendesk/actions/list-ticket-comments/list-ticket-comments.mjs (1)
7-7: LGTM!Version bump aligns with the package version update.
components/zendesk/actions/remove-ticket-tags/remove-ticket-tags.mjs (1)
8-8: LGTM!Version bump is consistent with the package version update.
components/zendesk/actions/update-ticket/update-ticket.mjs (1)
8-8: LGTM!Version bump aligns with the package version update.
components/zendesk/actions/get-macro/get-macro.mjs (1)
1-32: LGTM!Clean and well-structured action implementation. The action follows the established patterns used by other Zendesk actions in this codebase:
- Correct annotations for a read-only operation
- Proper use of propDefinition for
macroId- Appropriate summary export
- Documentation link is accurate
components/zendesk/zendesk.app.mjs (10)
198-206: LGTM!The locale prop definition correctly fetches and maps available locales.
207-236: LGTM!The articleCategoryId prop follows the established pagination pattern and correctly passes locale for locale-aware category fetching.
237-267: LGTM!The sectionId prop correctly cascades locale and categoryId dependencies for filtered section options.
268-297: LGTM!The articleId prop correctly implements locale-aware article fetching with pagination.
298-325: LGTM!The macroId prop correctly implements macro fetching with pagination.
663-668: LGTM!The
listActiveMacrosmethod follows the established pattern for list methods.
681-687: LGTM!The
prepareLocalePathhelper correctly constructs locale-aware Help Center API paths.
688-698: LGTM!The
listArticleCategoriesmethod correctly uses locale-aware path construction.
712-733: LGTM, but note implicit priority.The method correctly constructs locale-aware article paths. The implicit priority (userId > sectionId > categoryId) is handled, though the action layer enforces mutual exclusivity for userId which prevents unexpected behavior.
746-753: LGTM!The
getMacromethod correctly implements the macro retrieval endpoint.components/zendesk/actions/list-articles/list-articles.mjs (4)
1-14: LGTM!Action metadata and imports are properly configured with appropriate read-only annotations.
15-62: LGTM!Props are correctly configured with proper dependencies and
reloadPropstrigger for dynamic visibility.
63-73: LGTM!The
additionalPropsmethod correctly manages prop visibility based on userId selection, improving UX by hiding irrelevant filters.
74-104: LGTM!The run method correctly validates incompatible parameters, handles locale appropriately for userId queries, and properly paginates results with a well-formatted summary.
components/zendesk/actions/list-active-macros/list-active-macros.mjs (2)
1-14: LGTM!Action metadata and imports are properly configured.
15-58: LGTM!Props are correctly configured using constants and prop definitions from the app.
components/zendesk/actions/get-article/get-article.mjs (2)
14-32: LGTM!Props are correctly configured with locale dependency for article ID options.
33-42: LGTM!The run method correctly retrieves and returns the article with an appropriate summary.
- Simplified URL construction in makeRequest by removing unnecessary locale handling. - Corrected typo in the description of the Get Article action.
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: 2
♻️ Duplicate comments (2)
components/zendesk/zendesk.app.mjs (2)
465-476: Unusedlocaleparameter causes confusion and potential URL bugs.The
localeparameter added tomakeRequestis not used by any Help Center methods (they useprepareLocalePathinstead). Additionally, the URL construction${locale ? locale : ""}${path}would produce malformed URLs if used (e.g.,"en-us/tickets/123"missing the leading/).Remove the unused
localeparameter:makeRequest({ - step = this, url, path, locale = "", headers, customSubdomain, ...args + step = this, url, path, headers, customSubdomain, ...args }) { return axios(step, { headers: this.getHeaders(headers), - url: url ?? this.getUrl(`${locale - ? locale - : ""}${path}`, customSubdomain), + url: url ?? this.getUrl(path, customSubdomain), timeout: constants.DEFAULT_TIMEOUT, ...args, }); },
699-711: Bug: Double slashes in path construction.The path template produces malformed URLs with double slashes:
- When
categoryIdis provided://categories/{id}/sections- When
categoryIdis null://sectionsApply this diff to fix:
listSections({ locale, categoryId, ...args } = {}) { return this.makeRequest({ path: this.prepareLocalePath({ locale, - path: `/${categoryId - ? `/categories/${categoryId}` - : ""}/sections`, + path: categoryId + ? `/categories/${categoryId}/sections` + : "/sections", }), ...args, }); },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
components/zendesk/zendesk.app.mjs(5 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
Applied to files:
components/zendesk/zendesk.app.mjs
📚 Learning: 2025-09-15T22:01:11.472Z
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.
Applied to files:
components/zendesk/zendesk.app.mjs
🧬 Code graph analysis (1)
components/zendesk/zendesk.app.mjs (4)
components/zendesk/sources/common/webhook.mjs (1)
constants(232-235)components/asana/asana.app.mjs (1)
sections(205-210)components/zendesk/actions/list-articles/list-articles.mjs (1)
articles(94-94)components/zendesk/actions/list-macros/list-macros.mjs (1)
macros(93-93)
⏰ 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: pnpm publish
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (4)
components/zendesk/zendesk.app.mjs (4)
1-5: LGTM!Import consolidation is clean and follows the existing patterns in the codebase.
663-668: LGTM!The
listActiveMacrosmethod follows the established pattern and correctly targets the/macros/activeendpoint.
681-697: LGTM!The
prepareLocalePathhelper andlistArticleCategoriesmethod are well-implemented with proper locale handling.
734-752: LGTM!The
getArticleandgetMacromethods are correctly implemented. The previously flaggedhelpCenter: trueparameter has been removed.
| options: articles.map(({ | ||
| id: value, name: label, | ||
| }) => ({ | ||
| value, | ||
| label, | ||
| })), |
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.
🧩 Analysis chain
Script executed:
#!/bin/bash
# Search for article-related code in the zendesk app
rg -n "article" components/zendesk/zendesk.app.mjs -i -C 5Repository: PipedreamHQ/pipedream
<shell_result>
Repository: PipedreamHQ/pipedream
Exit code: 0
stdout:
181- label: "Fields",
182- description: "Ticket fields to be included in the incoming webhook payload",
183- withLabel: true,
184- optional: true,
185- async options() {
186: // placehoders reference - https://support.zendesk.com/hc/en-us/articles/4408886858138
187- const { ticket_fields: customFields } = await this.listTicketFields();
188- const fields = customFields.reverse().map(({
189- id, title,
190- }) => ({
191- label: title,
--
196- },
197- },
198- locale: {
199- type: "string",
200- label: "Locale",
201: description: "The locale of the article",
202- async options() {
203- const { locales } = await this.listLocales();
204- return locales.map((locale) => locale.locale);
205- },
206- },
207: articleCategoryId: {
208- type: "string",
209: label: "Article Category ID",
210: description: "The ID of the article category",
211- async options({
212- locale, prevContext,
213- }) {
214- const { afterCursor } = prevContext;
215- const {
216- categories, meta,
217: } = await this.listArticleCategories({
218- locale,
219- params: {
220- [constants.PAGE_SIZE_PARAM]: constants.DEFAULT_LIMIT,
221- [constants.PAGE_AFTER_PARAM]: afterCursor,
222- },
--
263- label,
264- })),
265- };
266- },
267- },
268: articleId: {
269- type: "string",
270: label: "Article ID",
271: description: "The ID of the article. You can use the List Articles action to get the ID of the article.",
272- async options({
273- locale, prevContext,
274- }) {
275- const { afterCursor } = prevContext;
276- const {
277: articles, meta,
278: } = await this.listArticles({
279- locale,
280- params: {
281- [constants.PAGE_SIZE_PARAM]: constants.DEFAULT_LIMIT,
282- [constants.PAGE_AFTER_PARAM]: afterCursor,
283- },
284- });
285- return {
286- context: {
287- afterCursor: meta.after_cursor,
288- },
289: options: articles.map(({
290- id: value, name: label,
291- }) => ({
292- value,
293- label,
294- })),
--
681- }) {
682- return `/help_center${locale
683- ? `/${locale}`
684- : ""}${path}`;
685- },
686: listArticleCategories({
687- locale, ...args
688- } = {}) {
689- return this.makeRequest({
690- path: this.prepareLocalePath({
691- locale,
--
705- : ""}/sections`,
706- }),
707- ...args,
708- });
709- },
710: listArticles({
711- locale, categoryId, sectionId, userId, ...args
712- } = {}) {
713- let path = "";
714- if (categoryId) {
715- path = `/categories/${categoryId}`;
--
722- }
723-
724- return this.makeRequest({
725- path: this.prepareLocalePath({
726- locale,
727: path: `${path}/articles`,
728- }),
729- ...args,
730- });
731- },
732: getArticle({
733: articleId, locale, ...args
734- } = {}) {
735- return this.makeRequest({
736- path: this.prepareLocalePath({
737- locale,
738: path: `/articles/${articleId}`,
739- }),
740- ...args,
741- });
742- },
743- getMacro({
</shell_result>
Zendesk Help Center API article response structure fields
<web_search_result>
Common fields returned in a Help Center Article JSON (Show Article / List Articles endpoints) include — for each article object:
- id. [1]
- title. [1]
- body (article HTML). [1][2]
- author_id. [1]
- locale / source_locale. [1][2]
- created_at, updated_at, edited_at. [1]
- draft (boolean). [1]
- promoted (boolean). [1]
- position. [1]
- comments_disabled (boolean). [1]
- permission_group_id. [1]
- user_segment_id. [1]
- content_tag_ids (or label_names / tags). [1]
- section_id / category_id (when sideloaded or in list contexts). [1]
- attachments / guide_medias (sideloaded objects or attachment metadata). [1][3]
- translations (embedded when requested). [2]
For full, authoritative field lists, examples, and endpoint details see the Zendesk Help Center API docs. [1][2][3]
Sources: Zendesk Developer Docs — Articles, Help Center Search, Guide Medias. [1] https://developer.zendesk.com/api-reference/help_center/help-center-api/articles/ [2] https://developer.zendesk.com/api-reference/help_center/help-center-api/help_center_search/ [3] https://developer.zendesk.com/api-reference/help_center/help-center-api/guide_medias/
</web_search_result>
Article property should be title, not name—dropdown labels will be undefined with current code.
The Zendesk Help Center API documentation confirms that articles have a title field, not name. The current mapping will result in undefined labels in the dropdown.
Apply this fix:
options: articles.map(({
- id: value, name: label,
+ id: value, title: label,
}) => ({
value,
label,
})),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| options: articles.map(({ | |
| id: value, name: label, | |
| }) => ({ | |
| value, | |
| label, | |
| })), | |
| options: articles.map(({ | |
| id: value, title: label, | |
| }) => ({ | |
| value, | |
| label, | |
| })), |
🤖 Prompt for AI Agents
In components/zendesk/zendesk.app.mjs around lines 289 to 294, the mapping
destructures article objects using `name` for the label which is incorrect per
the Zendesk Help Center API; change the destructuring to use `title` (e.g.,
articles.map(({ id: value, title: label }) => ({ value, label }))) so dropdown
labels are populated from the article title.
| listArticles({ | ||
| locale, categoryId, sectionId, userId, ...args | ||
| } = {}) { | ||
| let path = ""; | ||
| if (categoryId) { | ||
| path = `/categories/${categoryId}`; | ||
| } | ||
| if (sectionId) { | ||
| path = `/sections/${sectionId}`; | ||
| } | ||
| if (userId) { | ||
| path = `/users/${userId}`; | ||
| } | ||
|
|
||
| return this.makeRequest({ | ||
| path: this.prepareLocalePath({ | ||
| locale, | ||
| path: `${path}/articles`, | ||
| }), | ||
| ...args, | ||
| }); | ||
| }, |
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.
🧹 Nitpick | 🔵 Trivial
Filter priority may cause unexpected behavior.
When multiple filters (categoryId, sectionId, userId) are provided, later ones silently overwrite earlier ones. For example, if both categoryId and sectionId are passed, sectionId takes precedence with no warning.
Consider either:
- Document the precedence behavior, or
- Throw an error if conflicting filters are provided:
listArticles({
locale, categoryId, sectionId, userId, ...args
} = {}) {
+ const filters = [categoryId, sectionId, userId].filter(Boolean);
+ if (filters.length > 1) {
+ throw new Error("Only one of categoryId, sectionId, or userId can be specified");
+ }
let path = "";
if (categoryId) {
path = `/categories/${categoryId}`;
}
- if (sectionId) {
+ else if (sectionId) {
path = `/sections/${sectionId}`;
}
- if (userId) {
+ else if (userId) {
path = `/users/${userId}`;
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| listArticles({ | |
| locale, categoryId, sectionId, userId, ...args | |
| } = {}) { | |
| let path = ""; | |
| if (categoryId) { | |
| path = `/categories/${categoryId}`; | |
| } | |
| if (sectionId) { | |
| path = `/sections/${sectionId}`; | |
| } | |
| if (userId) { | |
| path = `/users/${userId}`; | |
| } | |
| return this.makeRequest({ | |
| path: this.prepareLocalePath({ | |
| locale, | |
| path: `${path}/articles`, | |
| }), | |
| ...args, | |
| }); | |
| }, | |
| listArticles({ | |
| locale, categoryId, sectionId, userId, ...args | |
| } = {}) { | |
| const filters = [categoryId, sectionId, userId].filter(Boolean); | |
| if (filters.length > 1) { | |
| throw new Error("Only one of categoryId, sectionId, or userId can be specified"); | |
| } | |
| let path = ""; | |
| if (categoryId) { | |
| path = `/categories/${categoryId}`; | |
| } | |
| else if (sectionId) { | |
| path = `/sections/${sectionId}`; | |
| } | |
| else if (userId) { | |
| path = `/users/${userId}`; | |
| } | |
| return this.makeRequest({ | |
| path: this.prepareLocalePath({ | |
| locale, | |
| path: `${path}/articles`, | |
| }), | |
| ...args, | |
| }); | |
| }, |
🤖 Prompt for AI Agents
In components/zendesk/zendesk.app.mjs around lines 712–733, the code silently
overwrites path when multiple filters (categoryId, sectionId, userId) are
provided; either enforce a single-filter rule or make precedence explicit. Fix
by validating inputs at the top of listArticles: count how many of categoryId,
sectionId, userId are non-null and if more than one is present throw a
descriptive error (e.g., "Provide exactly one of categoryId, sectionId, or
userId") so callers fail fast; alternatively, if you prefer a precedence rule,
replace the three independent ifs with an explicit if/else-if chain (and
document the chosen precedence in the method JSDoc) so only the highest-priority
filter is applied.
jcortes
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.
Hi @luancazarine lgtm! Ready for QA!
Resolves #19164 and #19165
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.