Skip to content

Commit 90bfe09

Browse files
committed
Add Zendesk Help Center article search and retrieval actions
- search-articles: Search help center articles by keywords and labels - get-article: Retrieve full article content by ID - list-help-center-sections: List all help center sections - list-articles-in-section: List articles within a specific section These actions enable access to Zendesk's Help Center knowledge base for knowledge management and customer support automation workflows.
1 parent 9c33a97 commit 90bfe09

File tree

4 files changed

+380
-0
lines changed

4 files changed

+380
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import app from "../../zendesk.app.mjs";
2+
3+
export default {
4+
key: "zendesk-get-article",
5+
name: "Get Article",
6+
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).",
7+
type: "action",
8+
version: "0.1.0",
9+
props: {
10+
app,
11+
articleId: {
12+
type: "integer",
13+
label: "Article ID",
14+
description: "The unique ID of the article to retrieve",
15+
},
16+
locale: {
17+
type: "string",
18+
label: "Locale",
19+
description: "The locale for the article (e.g., 'en-us')",
20+
default: "en-us",
21+
optional: true,
22+
},
23+
includeTranslations: {
24+
type: "boolean",
25+
label: "Include Translations",
26+
description: "Whether to include article translations in the response",
27+
default: false,
28+
optional: true,
29+
},
30+
customSubdomain: {
31+
propDefinition: [
32+
app,
33+
"customSubdomain",
34+
],
35+
},
36+
},
37+
methods: {
38+
getArticle(args = {}) {
39+
const {
40+
articleId,
41+
customSubdomain,
42+
params,
43+
...otherArgs
44+
} = args;
45+
46+
return this.app.makeRequest({
47+
path: `/help_center/articles/${articleId}`,
48+
customSubdomain,
49+
params,
50+
...otherArgs,
51+
});
52+
},
53+
},
54+
async run({ $: step }) {
55+
const {
56+
articleId,
57+
locale,
58+
includeTranslations,
59+
customSubdomain,
60+
} = this;
61+
62+
const params = {};
63+
64+
if (includeTranslations) {
65+
params.include = "translations";
66+
}
67+
68+
const response = await this.getArticle({
69+
step,
70+
articleId,
71+
customSubdomain,
72+
params,
73+
});
74+
75+
step.export("$summary", `Successfully retrieved article: "${response.article?.title || 'Unknown'}"`);
76+
return response;
77+
},
78+
};
79+
// This code defines a Zendesk action to retrieve a specific help center article by its ID.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import app from "../../zendesk.app.mjs";
2+
3+
export default {
4+
key: "zendesk-list-articles-in-section",
5+
name: "List Articles in Section",
6+
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).",
7+
type: "action",
8+
version: "0.1.0",
9+
props: {
10+
app,
11+
sectionId: {
12+
type: "integer",
13+
label: "Section ID",
14+
description: "The unique ID of the section to list articles from",
15+
},
16+
locale: {
17+
type: "string",
18+
label: "Locale",
19+
description: "The locale for the articles (e.g., 'en-us')",
20+
default: "en-us",
21+
optional: true,
22+
},
23+
sortBy: {
24+
type: "string",
25+
label: "Sort By",
26+
description: "Sort articles by specified field",
27+
options: [
28+
"position",
29+
"title",
30+
"created_at",
31+
"updated_at",
32+
"edited_at",
33+
],
34+
default: "position",
35+
optional: true,
36+
},
37+
sortOrder: {
38+
type: "string",
39+
label: "Sort Order",
40+
description: "Order of the results",
41+
options: [
42+
"asc",
43+
"desc",
44+
],
45+
default: "asc",
46+
optional: true,
47+
},
48+
customSubdomain: {
49+
propDefinition: [
50+
app,
51+
"customSubdomain",
52+
],
53+
},
54+
},
55+
methods: {
56+
listArticlesInSection(args = {}) {
57+
const {
58+
sectionId,
59+
customSubdomain,
60+
params,
61+
...otherArgs
62+
} = args;
63+
64+
return this.app.makeRequest({
65+
path: `/help_center/sections/${sectionId}/articles`,
66+
customSubdomain,
67+
params,
68+
...otherArgs,
69+
});
70+
},
71+
},
72+
async run({ $: step }) {
73+
const {
74+
sectionId,
75+
locale,
76+
sortBy,
77+
sortOrder,
78+
customSubdomain,
79+
} = this;
80+
81+
const params = {};
82+
83+
if (sortBy) {
84+
params.sort_by = sortBy;
85+
}
86+
if (sortOrder) {
87+
params.sort_order = sortOrder;
88+
}
89+
90+
const response = await this.listArticlesInSection({
91+
step,
92+
sectionId,
93+
customSubdomain,
94+
params,
95+
});
96+
97+
step.export("$summary", `Successfully retrieved ${response.articles?.length || 0} articles from section ${sectionId}`);
98+
return response;
99+
},
100+
};
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import app from "../../zendesk.app.mjs";
2+
3+
export default {
4+
key: "zendesk-list-help-center-sections",
5+
name: "List Help Center Sections",
6+
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).",
7+
type: "action",
8+
version: "0.1.0",
9+
props: {
10+
app,
11+
locale: {
12+
type: "string",
13+
label: "Locale",
14+
description: "The locale for the sections (e.g., 'en-us')",
15+
default: "en-us",
16+
optional: true,
17+
},
18+
sortBy: {
19+
type: "string",
20+
label: "Sort By",
21+
description: "Sort sections by specified field",
22+
options: [
23+
"position",
24+
"name",
25+
"created_at",
26+
"updated_at",
27+
],
28+
default: "position",
29+
optional: true,
30+
},
31+
sortOrder: {
32+
type: "string",
33+
label: "Sort Order",
34+
description: "Order of the results",
35+
options: [
36+
"asc",
37+
"desc",
38+
],
39+
default: "asc",
40+
optional: true,
41+
},
42+
customSubdomain: {
43+
propDefinition: [
44+
app,
45+
"customSubdomain",
46+
],
47+
},
48+
},
49+
methods: {
50+
listSections(args = {}) {
51+
const {
52+
customSubdomain,
53+
params,
54+
...otherArgs
55+
} = args;
56+
57+
return this.app.makeRequest({
58+
path: `/help_center/sections`,
59+
customSubdomain,
60+
params,
61+
...otherArgs,
62+
});
63+
},
64+
},
65+
async run({ $: step }) {
66+
const {
67+
locale,
68+
sortBy,
69+
sortOrder,
70+
customSubdomain,
71+
} = this;
72+
73+
const params = {};
74+
75+
if (sortBy) {
76+
params.sort_by = sortBy;
77+
}
78+
if (sortOrder) {
79+
params.sort_order = sortOrder;
80+
}
81+
82+
const response = await this.listSections({
83+
step,
84+
customSubdomain,
85+
params,
86+
});
87+
88+
step.export("$summary", `Successfully retrieved ${response.sections?.length || 0} help center sections`);
89+
return response;
90+
},
91+
};
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import app from "../../zendesk.app.mjs";
2+
3+
export default {
4+
key: "zendesk-search-articles",
5+
name: "Search Articles",
6+
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).",
7+
type: "action",
8+
version: "0.1.0",
9+
props: {
10+
app,
11+
searchQuery: {
12+
type: "string",
13+
label: "Search Query",
14+
description: "Keywords to search for in article titles and content",
15+
optional: true,
16+
},
17+
labelNames: {
18+
type: "string",
19+
label: "Label Names",
20+
description: "Comma-separated list of label names to filter by (e.g., 'photos,camera')",
21+
optional: true,
22+
},
23+
sortBy: {
24+
type: "string",
25+
label: "Sort By",
26+
description: "Sort articles by specified field",
27+
options: [
28+
"position",
29+
"title",
30+
"created_at",
31+
"updated_at",
32+
"edited_at",
33+
],
34+
default: "position",
35+
optional: true,
36+
},
37+
sortOrder: {
38+
type: "string",
39+
label: "Sort Order",
40+
description: "Order of the results",
41+
options: [
42+
"asc",
43+
"desc",
44+
],
45+
default: "asc",
46+
optional: true,
47+
},
48+
locale: {
49+
type: "string",
50+
label: "Locale",
51+
description: "The locale for the articles (e.g., 'en-us')",
52+
default: "en-us",
53+
optional: true,
54+
},
55+
customSubdomain: {
56+
propDefinition: [
57+
app,
58+
"customSubdomain",
59+
],
60+
},
61+
},
62+
methods: {
63+
searchArticles(args = {}) {
64+
const {
65+
customSubdomain,
66+
params,
67+
...otherArgs
68+
} = args;
69+
70+
return this.app.makeRequest({
71+
path: `/help_center/articles`,
72+
customSubdomain,
73+
params,
74+
...otherArgs,
75+
});
76+
},
77+
},
78+
async run({ $: step }) {
79+
const {
80+
searchQuery,
81+
labelNames,
82+
sortBy,
83+
sortOrder,
84+
locale,
85+
customSubdomain,
86+
} = this;
87+
88+
const params = {};
89+
90+
if (labelNames) {
91+
params.label_names = labelNames;
92+
}
93+
if (sortBy) {
94+
params.sort_by = sortBy;
95+
}
96+
if (sortOrder) {
97+
params.sort_order = sortOrder;
98+
}
99+
100+
const response = await this.searchArticles({
101+
step,
102+
customSubdomain,
103+
params,
104+
});
105+
106+
step.export("$summary", `Successfully found ${response.articles?.length || 0} articles`);
107+
return response;
108+
},
109+
};
110+
// This code defines a Pipedream action that allows users to search for articles in Zendesk's Help Center.

0 commit comments

Comments
 (0)