diff --git a/components/zendesk/actions/get-article/get-article.mjs b/components/zendesk/actions/get-article/get-article.mjs new file mode 100644 index 0000000000000..7d6065454056a --- /dev/null +++ b/components/zendesk/actions/get-article/get-article.mjs @@ -0,0 +1,79 @@ +import app from "../../zendesk.app.mjs"; + +export default { + key: "zendesk-get-article", + name: "Get Article", + description: "Retrieves the full content and metadata of a specific help center article by ID. [See the documentation](https://developer.zendesk.com/api-reference/help_center/help-center-api/articles/#show-article).", + type: "action", + version: "0.1.0", + props: { + app, + articleId: { + type: "integer", + label: "Article ID", + description: "The unique ID of the article to retrieve", + }, + locale: { + type: "string", + label: "Locale", + description: "The locale for the article (e.g., 'en-us')", + default: "en-us", + optional: true, + }, + includeTranslations: { + type: "boolean", + label: "Include Translations", + description: "Whether to include article translations in the response", + default: false, + optional: true, + }, + customSubdomain: { + propDefinition: [ + app, + "customSubdomain", + ], + }, + }, + methods: { + getArticle(args = {}) { + const { + articleId, + customSubdomain, + params, + ...otherArgs + } = args; + + return this.app.makeRequest({ + path: `/help_center/articles/${articleId}`, + customSubdomain, + params, + ...otherArgs, + }); + }, + }, + async run({ $: step }) { + const { + articleId, + locale, + includeTranslations, + customSubdomain, + } = this; + + const params = {}; + + if (includeTranslations) { + params.include = "translations"; + } + + const response = await this.getArticle({ + step, + articleId, + customSubdomain, + params, + }); + + step.export("$summary", `Successfully retrieved article: "${response.article?.title || 'Unknown'}"`); + return response; + }, +}; +// This code defines a Zendesk action to retrieve a specific help center article by its ID. \ No newline at end of file diff --git a/components/zendesk/actions/list-articles-in-section/list-articles-in-section.mjs b/components/zendesk/actions/list-articles-in-section/list-articles-in-section.mjs new file mode 100644 index 0000000000000..3a932a5786a7b --- /dev/null +++ b/components/zendesk/actions/list-articles-in-section/list-articles-in-section.mjs @@ -0,0 +1,100 @@ +import app from "../../zendesk.app.mjs"; + +export default { + key: "zendesk-list-articles-in-section", + name: "List Articles in Section", + description: "Lists all articles within a specific help center section. Useful after identifying relevant sections. [See the documentation](https://developer.zendesk.com/api-reference/help_center/help-center-api/articles/#list-articles).", + type: "action", + version: "0.1.0", + props: { + app, + sectionId: { + type: "integer", + label: "Section ID", + description: "The unique ID of the section to list articles from", + }, + locale: { + type: "string", + label: "Locale", + description: "The locale for the articles (e.g., 'en-us')", + default: "en-us", + optional: true, + }, + sortBy: { + type: "string", + label: "Sort By", + description: "Sort articles by specified field", + options: [ + "position", + "title", + "created_at", + "updated_at", + "edited_at", + ], + default: "position", + optional: true, + }, + sortOrder: { + type: "string", + label: "Sort Order", + description: "Order of the results", + options: [ + "asc", + "desc", + ], + default: "asc", + optional: true, + }, + customSubdomain: { + propDefinition: [ + app, + "customSubdomain", + ], + }, + }, + methods: { + listArticlesInSection(args = {}) { + const { + sectionId, + customSubdomain, + params, + ...otherArgs + } = args; + + return this.app.makeRequest({ + path: `/help_center/sections/${sectionId}/articles`, + customSubdomain, + params, + ...otherArgs, + }); + }, + }, + async run({ $: step }) { + const { + sectionId, + locale, + sortBy, + sortOrder, + customSubdomain, + } = this; + + const params = {}; + + if (sortBy) { + params.sort_by = sortBy; + } + if (sortOrder) { + params.sort_order = sortOrder; + } + + const response = await this.listArticlesInSection({ + step, + sectionId, + customSubdomain, + params, + }); + + step.export("$summary", `Successfully retrieved ${response.articles?.length || 0} articles from section ${sectionId}`); + return response; + }, +}; \ No newline at end of file diff --git a/components/zendesk/actions/list-help-center-sections/list-help-center-sections.mjs b/components/zendesk/actions/list-help-center-sections/list-help-center-sections.mjs new file mode 100644 index 0000000000000..7574b8a21af09 --- /dev/null +++ b/components/zendesk/actions/list-help-center-sections/list-help-center-sections.mjs @@ -0,0 +1,91 @@ +import app from "../../zendesk.app.mjs"; + +export default { + key: "zendesk-list-help-center-sections", + name: "List Help Center Sections", + description: "Lists all sections in the help center to understand content organization. Useful for browsing articles by topic area. [See the documentation](https://developer.zendesk.com/api-reference/help_center/help-center-api/sections/#list-sections).", + type: "action", + version: "0.1.0", + props: { + app, + locale: { + type: "string", + label: "Locale", + description: "The locale for the sections (e.g., 'en-us')", + default: "en-us", + optional: true, + }, + sortBy: { + type: "string", + label: "Sort By", + description: "Sort sections by specified field", + options: [ + "position", + "name", + "created_at", + "updated_at", + ], + default: "position", + optional: true, + }, + sortOrder: { + type: "string", + label: "Sort Order", + description: "Order of the results", + options: [ + "asc", + "desc", + ], + default: "asc", + optional: true, + }, + customSubdomain: { + propDefinition: [ + app, + "customSubdomain", + ], + }, + }, + methods: { + listSections(args = {}) { + const { + customSubdomain, + params, + ...otherArgs + } = args; + + return this.app.makeRequest({ + path: `/help_center/sections`, + customSubdomain, + params, + ...otherArgs, + }); + }, + }, + async run({ $: step }) { + const { + locale, + sortBy, + sortOrder, + customSubdomain, + } = this; + + const params = {}; + + if (sortBy) { + params.sort_by = sortBy; + } + if (sortOrder) { + params.sort_order = sortOrder; + } + + const response = await this.listSections({ + step, + customSubdomain, + params, + }); + + step.export("$summary", `Successfully retrieved ${response.sections?.length || 0} help center sections`); + return response; + }, +}; diff --git a/components/zendesk/actions/search-articles/search-articles.mjs b/components/zendesk/actions/search-articles/search-articles.mjs new file mode 100644 index 0000000000000..5ea414d8f4f7e --- /dev/null +++ b/components/zendesk/actions/search-articles/search-articles.mjs @@ -0,0 +1,110 @@ +import app from "../../zendesk.app.mjs"; + +export default { + key: "zendesk-search-articles", + name: "Search Articles", + description: "Searches for help center knowledge base articles using Zendesk's Help Center API. Can search by keywords, filter by labels, and sort results. [See the documentation](https://developer.zendesk.com/api-reference/help_center/help-center-api/articles/#list-articles).", + type: "action", + version: "0.1.0", + props: { + app, + searchQuery: { + type: "string", + label: "Search Query", + description: "Keywords to search for in article titles and content", + optional: true, + }, + labelNames: { + type: "string", + label: "Label Names", + description: "Comma-separated list of label names to filter by (e.g., 'photos,camera')", + optional: true, + }, + sortBy: { + type: "string", + label: "Sort By", + description: "Sort articles by specified field", + options: [ + "position", + "title", + "created_at", + "updated_at", + "edited_at", + ], + default: "position", + optional: true, + }, + sortOrder: { + type: "string", + label: "Sort Order", + description: "Order of the results", + options: [ + "asc", + "desc", + ], + default: "asc", + optional: true, + }, + locale: { + type: "string", + label: "Locale", + description: "The locale for the articles (e.g., 'en-us')", + default: "en-us", + optional: true, + }, + customSubdomain: { + propDefinition: [ + app, + "customSubdomain", + ], + }, + }, + methods: { + searchArticles(args = {}) { + const { + customSubdomain, + params, + ...otherArgs + } = args; + + return this.app.makeRequest({ + path: `/help_center/articles`, + customSubdomain, + params, + ...otherArgs, + }); + }, + }, + async run({ $: step }) { + const { + searchQuery, + labelNames, + sortBy, + sortOrder, + locale, + customSubdomain, + } = this; + + const params = {}; + + if (labelNames) { + params.label_names = labelNames; + } + if (sortBy) { + params.sort_by = sortBy; + } + if (sortOrder) { + params.sort_order = sortOrder; + } + + const response = await this.searchArticles({ + step, + customSubdomain, + params, + }); + + step.export("$summary", `Successfully found ${response.articles?.length || 0} articles`); + return response; + }, +}; +// This code defines a Pipedream action that allows users to search for articles in Zendesk's Help Center. \ No newline at end of file