@pipedream/zendesk 0.10.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/add-ticket-tags/add-ticket-tags.mjs +1 -1
- package/actions/create-ticket/create-ticket.mjs +1 -1
- package/actions/delete-ticket/delete-ticket.mjs +1 -1
- package/actions/get-article/get-article.mjs +43 -0
- package/actions/get-macro/get-macro.mjs +32 -0
- package/actions/get-ticket-info/get-ticket-info.mjs +1 -1
- package/actions/get-user-info/get-user-info.mjs +1 -1
- package/actions/list-active-macros/list-active-macros.mjs +77 -0
- package/actions/list-articles/list-articles.mjs +105 -0
- package/actions/list-locales/list-locales.mjs +1 -1
- package/actions/list-macros/list-macros.mjs +1 -1
- package/actions/list-ticket-comments/list-ticket-comments.mjs +1 -1
- package/actions/list-tickets/list-tickets.mjs +1 -1
- package/actions/remove-ticket-tags/remove-ticket-tags.mjs +1 -1
- package/actions/search-macros/search-macros.mjs +49 -0
- package/actions/search-tickets/search-tickets.mjs +1 -1
- package/actions/set-custom-ticket-fields/set-custom-ticket-fields.mjs +3 -3
- package/actions/set-ticket-tags/set-ticket-tags.mjs +1 -1
- package/actions/update-ticket/update-ticket.mjs +1 -1
- package/common/constants.mjs +40 -0
- package/package.json +2 -2
- package/sources/locale-updated/locale-updated.mjs +1 -1
- package/sources/new-ticket/new-ticket.mjs +1 -1
- package/sources/new-ticket-comment-added/new-ticket-comment-added.mjs +1 -1
- package/sources/ticket-added-to-view/ticket-added-to-view.mjs +1 -1
- package/sources/ticket-closed/ticket-closed.mjs +1 -1
- package/sources/ticket-pended/ticket-pended.mjs +1 -1
- package/sources/ticket-solved/ticket-solved.mjs +1 -1
- package/sources/ticket-updated/ticket-updated.mjs +1 -1
- package/zendesk.app.mjs +218 -6
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Add Ticket Tags",
|
|
6
6
|
description: "Add tags to a ticket (appends to existing tags). [See the documentation](https://developer.zendesk.com/api-reference/ticketing/ticket-management/tags/#add-tags).",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.8",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Create Ticket",
|
|
6
6
|
description: "Creates a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#create-ticket).",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.12",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Delete Ticket",
|
|
6
6
|
description: "Deletes a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#delete-ticket).",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.12",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: true,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import zendesk from "../../zendesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "zendesk-get-article",
|
|
5
|
+
name: "Get Article",
|
|
6
|
+
description: "Retrieves an article by its ID. [See the documentation](https://developer.zendesk.com/api-reference/help_center/help-center-api/articles/#show-article).",
|
|
7
|
+
type: "action",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
readOnlyHint: true,
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
zendesk,
|
|
16
|
+
locale: {
|
|
17
|
+
propDefinition: [
|
|
18
|
+
zendesk,
|
|
19
|
+
"locale",
|
|
20
|
+
],
|
|
21
|
+
optional: true,
|
|
22
|
+
},
|
|
23
|
+
articleId: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
zendesk,
|
|
26
|
+
"articleId",
|
|
27
|
+
({ locale }) => ({
|
|
28
|
+
locale,
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
async run({ $ }) {
|
|
34
|
+
const article = await this.zendesk.getArticle({
|
|
35
|
+
$,
|
|
36
|
+
locale: this.locale,
|
|
37
|
+
articleId: this.articleId,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
$.export("$summary", `Successfully retrieved article ${this.articleId}`);
|
|
41
|
+
return article;
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import zendesk from "../../zendesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "zendesk-get-macro",
|
|
5
|
+
name: "Get Macro",
|
|
6
|
+
description: "Retrieves a macro by its ID. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#show-macro).",
|
|
7
|
+
type: "action",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
readOnlyHint: true,
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
zendesk,
|
|
16
|
+
macroId: {
|
|
17
|
+
propDefinition: [
|
|
18
|
+
zendesk,
|
|
19
|
+
"macroId",
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
async run({ $ }) {
|
|
24
|
+
const macro = await this.zendesk.getMacro({
|
|
25
|
+
$,
|
|
26
|
+
macroId: this.macroId,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
$.export("$summary", `Successfully retrieved macro with ID ${this.macroId}`);
|
|
30
|
+
return macro;
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Get Ticket Info",
|
|
6
6
|
description: "Retrieves information about a specific ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#show-ticket).",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.10",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "zendesk-get-user-info",
|
|
5
5
|
name: "Get User Info",
|
|
6
6
|
description: "Retrieves information about a specific user. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/users/users/#show-user).",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.7",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import constants from "../../common/constants.mjs";
|
|
2
|
+
import zendesk from "../../zendesk.app.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "zendesk-list-active-macros",
|
|
6
|
+
name: "List Active Macros",
|
|
7
|
+
description: "Lists all active shared and personal macros available to the current user. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#list-active-macros).",
|
|
8
|
+
type: "action",
|
|
9
|
+
version: "0.0.2",
|
|
10
|
+
annotations: {
|
|
11
|
+
destructiveHint: false,
|
|
12
|
+
openWorldHint: true,
|
|
13
|
+
readOnlyHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
zendesk,
|
|
17
|
+
access: {
|
|
18
|
+
type: "string",
|
|
19
|
+
label: "Access",
|
|
20
|
+
description: "Filter macros by access. The \"agents\" value returns all personal macros for the account's agents and is only available to admins.",
|
|
21
|
+
options: constants.ACCESS_OPTIONS,
|
|
22
|
+
optional: true,
|
|
23
|
+
},
|
|
24
|
+
categoryId: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
zendesk,
|
|
27
|
+
"macroCategory",
|
|
28
|
+
],
|
|
29
|
+
optional: true,
|
|
30
|
+
},
|
|
31
|
+
groupId: {
|
|
32
|
+
propDefinition: [
|
|
33
|
+
zendesk,
|
|
34
|
+
"groupId",
|
|
35
|
+
],
|
|
36
|
+
optional: true,
|
|
37
|
+
},
|
|
38
|
+
include: {
|
|
39
|
+
type: "string",
|
|
40
|
+
label: "Include",
|
|
41
|
+
description: "Additional fields to include in the response",
|
|
42
|
+
options: constants.INCLUDE_OPTIONS,
|
|
43
|
+
optional: true,
|
|
44
|
+
},
|
|
45
|
+
sortBy: {
|
|
46
|
+
type: "string",
|
|
47
|
+
label: "Sort By",
|
|
48
|
+
description: "The field to sort the results by",
|
|
49
|
+
options: constants.SORT_BY_OPTIONS,
|
|
50
|
+
optional: true,
|
|
51
|
+
},
|
|
52
|
+
sortOrder: {
|
|
53
|
+
propDefinition: [
|
|
54
|
+
zendesk,
|
|
55
|
+
"sortOrder",
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
async run({ $ }) {
|
|
60
|
+
const { macros } = await this.zendesk.listActiveMacros({
|
|
61
|
+
$,
|
|
62
|
+
params: {
|
|
63
|
+
access: this.access,
|
|
64
|
+
category: this.categoryId,
|
|
65
|
+
group_id: this.groupId,
|
|
66
|
+
include: this.include,
|
|
67
|
+
sort_by: this.sortBy,
|
|
68
|
+
sort_order: this.sortOrder,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
$.export("$summary", `Successfully retrieved ${macros.length} macro${macros.length === 1
|
|
73
|
+
? ""
|
|
74
|
+
: "s"}`);
|
|
75
|
+
return macros;
|
|
76
|
+
},
|
|
77
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
2
|
+
import zendesk from "../../zendesk.app.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "zendesk-list-articles",
|
|
6
|
+
name: "List Articles",
|
|
7
|
+
description: "Retrieves a list of articles. [See the documentation](https://developer.zendesk.com/api-reference/help_center/help-center-api/articles/#list-articles).",
|
|
8
|
+
type: "action",
|
|
9
|
+
version: "0.0.2",
|
|
10
|
+
annotations: {
|
|
11
|
+
destructiveHint: false,
|
|
12
|
+
openWorldHint: true,
|
|
13
|
+
readOnlyHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
zendesk,
|
|
17
|
+
locale: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
zendesk,
|
|
20
|
+
"locale",
|
|
21
|
+
],
|
|
22
|
+
optional: true,
|
|
23
|
+
},
|
|
24
|
+
categoryId: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
zendesk,
|
|
27
|
+
"articleCategoryId",
|
|
28
|
+
({ locale }) => ({
|
|
29
|
+
locale,
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
optional: true,
|
|
33
|
+
},
|
|
34
|
+
sectionId: {
|
|
35
|
+
propDefinition: [
|
|
36
|
+
zendesk,
|
|
37
|
+
"sectionId",
|
|
38
|
+
({
|
|
39
|
+
locale, categoryId,
|
|
40
|
+
}) => ({
|
|
41
|
+
locale,
|
|
42
|
+
categoryId,
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
optional: true,
|
|
46
|
+
},
|
|
47
|
+
userId: {
|
|
48
|
+
propDefinition: [
|
|
49
|
+
zendesk,
|
|
50
|
+
"userId",
|
|
51
|
+
],
|
|
52
|
+
optional: true,
|
|
53
|
+
reloadProps: true,
|
|
54
|
+
},
|
|
55
|
+
limit: {
|
|
56
|
+
propDefinition: [
|
|
57
|
+
zendesk,
|
|
58
|
+
"limit",
|
|
59
|
+
],
|
|
60
|
+
description: "Maximum number of articles to return",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
async additionalProps(props) {
|
|
64
|
+
props.locale.hidden = false;
|
|
65
|
+
props.categoryId.hidden = false;
|
|
66
|
+
props.sectionId.hidden = false;
|
|
67
|
+
if (this.userId) {
|
|
68
|
+
props.locale.hidden = true;
|
|
69
|
+
props.categoryId.hidden = true;
|
|
70
|
+
props.sectionId.hidden = true;
|
|
71
|
+
}
|
|
72
|
+
return {};
|
|
73
|
+
},
|
|
74
|
+
async run({ $ }) {
|
|
75
|
+
if ((this.categoryId && this.userId) || (this.sectionId && this.userId)) {
|
|
76
|
+
throw new ConfigurationError("Providing a User ID, you cannot provide a Category ID or Section ID.");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const results = this.zendesk.paginate({
|
|
80
|
+
fn: this.zendesk.listArticles,
|
|
81
|
+
args: {
|
|
82
|
+
$,
|
|
83
|
+
categoryId: this.categoryId,
|
|
84
|
+
sectionId: this.sectionId,
|
|
85
|
+
userId: this.userId,
|
|
86
|
+
locale: this.userId
|
|
87
|
+
? null
|
|
88
|
+
: this.locale,
|
|
89
|
+
},
|
|
90
|
+
resourceKey: "articles",
|
|
91
|
+
max: this.limit,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const articles = [];
|
|
95
|
+
for await (const article of results) {
|
|
96
|
+
articles.push(article);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
$.export("$summary", `Successfully retrieved ${articles.length} article${articles.length === 1
|
|
100
|
+
? ""
|
|
101
|
+
: "s"}`);
|
|
102
|
+
|
|
103
|
+
return articles;
|
|
104
|
+
},
|
|
105
|
+
};
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "zendesk-list-locales",
|
|
5
5
|
name: "List Locales",
|
|
6
6
|
description: "Retrieves all locales. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/).",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.7",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "zendesk-list-macros",
|
|
5
5
|
name: "List Macros",
|
|
6
6
|
description: "Retrieves all macros. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#list-macros).",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.7",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "zendesk-list-ticket-comments",
|
|
5
5
|
name: "List Ticket Comments",
|
|
6
6
|
description: "Retrieves all comments for a specific ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_comments/#list-comments).",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.7",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "List Tickets",
|
|
6
6
|
description: "Retrieves a list of tickets. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets).",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.10",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Remove Ticket Tags",
|
|
6
6
|
description: "Remove specific tags from a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/ticket-management/tags/#remove-tags).",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.8",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: true,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import zendesk from "../../zendesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "zendesk-search-macros",
|
|
5
|
+
name: "Search Macros",
|
|
6
|
+
description: "Search for macros by name. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#search-macros).",
|
|
7
|
+
type: "action",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
readOnlyHint: true,
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
zendesk,
|
|
16
|
+
query: {
|
|
17
|
+
type: "string",
|
|
18
|
+
label: "Query",
|
|
19
|
+
description: "The query to search for macros",
|
|
20
|
+
},
|
|
21
|
+
page: {
|
|
22
|
+
type: "integer",
|
|
23
|
+
label: "Page",
|
|
24
|
+
description: "The page number to retrieve",
|
|
25
|
+
default: 1,
|
|
26
|
+
optional: true,
|
|
27
|
+
},
|
|
28
|
+
perPage: {
|
|
29
|
+
type: "integer",
|
|
30
|
+
label: "Per Page",
|
|
31
|
+
description: "The number of macros to retrieve per page. Default: 100",
|
|
32
|
+
default: 100,
|
|
33
|
+
optional: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
async run({ $ }) {
|
|
37
|
+
const macros = await this.zendesk.searchMacros({
|
|
38
|
+
$,
|
|
39
|
+
params: {
|
|
40
|
+
query: this.query,
|
|
41
|
+
page: this.page,
|
|
42
|
+
per_page: this.perPage,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
$.export("$summary", "Successfully searched for macros");
|
|
47
|
+
return macros;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Search Tickets",
|
|
6
6
|
description: "Searches for tickets using Zendesk's search API. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#search-tickets).",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.11",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import app from "../../zendesk.app.mjs";
|
|
2
|
-
import { parseObject } from "../../common/utils.mjs";
|
|
3
1
|
import { ConfigurationError } from "@pipedream/platform";
|
|
2
|
+
import { parseObject } from "../../common/utils.mjs";
|
|
3
|
+
import app from "../../zendesk.app.mjs";
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
key: "zendesk-set-custom-ticket-fields",
|
|
7
7
|
name: "Set Custom Ticket Fields",
|
|
8
8
|
description: "Sets one or more custom field values on a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#update-ticket).",
|
|
9
9
|
type: "action",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.5",
|
|
11
11
|
annotations: {
|
|
12
12
|
destructiveHint: false,
|
|
13
13
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Set Ticket Tags",
|
|
6
6
|
description: "Set tags on a ticket (replaces all existing tags). [See the documentation](https://developer.zendesk.com/api-reference/ticketing/ticket-management/tags/#set-tags).",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.8",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: true,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Update Ticket",
|
|
6
6
|
description: "Updates a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#update-ticket).",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.2.
|
|
8
|
+
version: "0.2.5",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: true,
|
|
11
11
|
openWorldHint: true,
|
package/common/constants.mjs
CHANGED
|
@@ -235,6 +235,44 @@ const SORT_BY_OPTIONS = [
|
|
|
235
235
|
"updated_at",
|
|
236
236
|
];
|
|
237
237
|
|
|
238
|
+
const ACCESS_OPTIONS = [
|
|
239
|
+
"personal",
|
|
240
|
+
"agents",
|
|
241
|
+
"shared",
|
|
242
|
+
"account",
|
|
243
|
+
];
|
|
244
|
+
|
|
245
|
+
const INCLUDE_OPTIONS = [
|
|
246
|
+
{
|
|
247
|
+
label: "The app installation that requires each macro, if present",
|
|
248
|
+
value: "app_installation",
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
label: "The macro categories",
|
|
252
|
+
value: "categories",
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
label: "The permissions for each macro",
|
|
256
|
+
value: "permissions",
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
label: "The number of times each macro has been used in the past hour",
|
|
260
|
+
value: "usage_1h",
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
label: "The number of times each macro has been used in the past day",
|
|
264
|
+
value: "usage_24h",
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
label: "The number of times each macro has been used in the past week",
|
|
268
|
+
value: "usage_7d",
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
label: "The number of times each macro has been used in the past thirty days",
|
|
272
|
+
value: "usage_30d",
|
|
273
|
+
},
|
|
274
|
+
];
|
|
275
|
+
|
|
238
276
|
export default {
|
|
239
277
|
SUBDOMAIN_PLACEHOLDER,
|
|
240
278
|
BASE_URL,
|
|
@@ -256,4 +294,6 @@ export default {
|
|
|
256
294
|
TICKET_STATUS_OPTIONS,
|
|
257
295
|
TICKET_FIELD_OPTIONS,
|
|
258
296
|
SORT_BY_OPTIONS,
|
|
297
|
+
ACCESS_OPTIONS,
|
|
298
|
+
INCLUDE_OPTIONS,
|
|
259
299
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/zendesk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Pipedream Zendesk Components",
|
|
5
5
|
"main": "zendesk.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pipedream/platform": "^3.1.
|
|
17
|
+
"@pipedream/platform": "^3.1.1",
|
|
18
18
|
"path": "^0.12.7"
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "zendesk-ticket-added-to-view",
|
|
6
6
|
name: "New Ticket Added to View (Instant)",
|
|
7
7
|
description: "Emit new event when a ticket is added to the specified view",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.11",
|
|
9
9
|
type: "source",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
props: {
|
package/zendesk.app.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
axios, getFileStreamAndMetadata,
|
|
3
|
+
} from "@pipedream/platform";
|
|
4
4
|
import path from "path";
|
|
5
|
+
import constants from "./common/constants.mjs";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
type: "app",
|
|
@@ -194,6 +195,134 @@ export default {
|
|
|
194
195
|
return fields;
|
|
195
196
|
},
|
|
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
|
+
},
|
|
223
|
+
});
|
|
224
|
+
return {
|
|
225
|
+
context: {
|
|
226
|
+
afterCursor: meta.after_cursor,
|
|
227
|
+
},
|
|
228
|
+
options: categories.map(({
|
|
229
|
+
id: value, name: label,
|
|
230
|
+
}) => ({
|
|
231
|
+
value,
|
|
232
|
+
label,
|
|
233
|
+
})),
|
|
234
|
+
};
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
sectionId: {
|
|
238
|
+
type: "string",
|
|
239
|
+
label: "Section ID",
|
|
240
|
+
description: "The ID of the section",
|
|
241
|
+
async options({
|
|
242
|
+
locale, categoryId, prevContext,
|
|
243
|
+
}) {
|
|
244
|
+
const { afterCursor } = prevContext;
|
|
245
|
+
const {
|
|
246
|
+
sections, meta,
|
|
247
|
+
} = await this.listSections({
|
|
248
|
+
locale,
|
|
249
|
+
categoryId,
|
|
250
|
+
params: {
|
|
251
|
+
[constants.PAGE_SIZE_PARAM]: constants.DEFAULT_LIMIT,
|
|
252
|
+
[constants.PAGE_AFTER_PARAM]: afterCursor,
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
return {
|
|
256
|
+
context: {
|
|
257
|
+
afterCursor: meta.after_cursor,
|
|
258
|
+
},
|
|
259
|
+
options: sections.map(({
|
|
260
|
+
id: value, name: label,
|
|
261
|
+
}) => ({
|
|
262
|
+
value,
|
|
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
|
+
})),
|
|
295
|
+
};
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
macroId: {
|
|
299
|
+
type: "string",
|
|
300
|
+
label: "Macro ID",
|
|
301
|
+
description: "The ID of the macro",
|
|
302
|
+
async options({ prevContext }) {
|
|
303
|
+
const { afterCursor } = prevContext;
|
|
304
|
+
const {
|
|
305
|
+
macros, meta,
|
|
306
|
+
} = await this.listMacros({
|
|
307
|
+
params: {
|
|
308
|
+
[constants.PAGE_SIZE_PARAM]: constants.DEFAULT_LIMIT,
|
|
309
|
+
[constants.PAGE_AFTER_PARAM]: afterCursor,
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
return {
|
|
314
|
+
context: {
|
|
315
|
+
afterCursor: meta.after_cursor,
|
|
316
|
+
},
|
|
317
|
+
options: macros.map(({
|
|
318
|
+
id: value, title: label,
|
|
319
|
+
}) => ({
|
|
320
|
+
value,
|
|
321
|
+
label,
|
|
322
|
+
})),
|
|
323
|
+
};
|
|
324
|
+
},
|
|
325
|
+
},
|
|
197
326
|
ticketCommentBody: {
|
|
198
327
|
type: "string",
|
|
199
328
|
label: "Comment body",
|
|
@@ -336,13 +465,12 @@ export default {
|
|
|
336
465
|
makeRequest({
|
|
337
466
|
step = this, url, path, headers, customSubdomain, ...args
|
|
338
467
|
}) {
|
|
339
|
-
|
|
468
|
+
return axios(step, {
|
|
340
469
|
headers: this.getHeaders(headers),
|
|
341
470
|
url: url ?? this.getUrl(path, customSubdomain),
|
|
342
471
|
timeout: constants.DEFAULT_TIMEOUT,
|
|
343
472
|
...args,
|
|
344
|
-
};
|
|
345
|
-
return axios(step, config);
|
|
473
|
+
});
|
|
346
474
|
},
|
|
347
475
|
getTicketInfo({
|
|
348
476
|
ticketId, ...args
|
|
@@ -530,6 +658,18 @@ export default {
|
|
|
530
658
|
...args,
|
|
531
659
|
});
|
|
532
660
|
},
|
|
661
|
+
listActiveMacros(args = {}) {
|
|
662
|
+
return this.makeRequest({
|
|
663
|
+
path: "/macros/active",
|
|
664
|
+
...args,
|
|
665
|
+
});
|
|
666
|
+
},
|
|
667
|
+
searchMacros(args = {}) {
|
|
668
|
+
return this.makeRequest({
|
|
669
|
+
path: "/macros/search",
|
|
670
|
+
...args,
|
|
671
|
+
});
|
|
672
|
+
},
|
|
533
673
|
listMacroCategories(args = {}) {
|
|
534
674
|
return this.makeRequest({
|
|
535
675
|
path: "/macros/categories",
|
|
@@ -542,6 +682,78 @@ export default {
|
|
|
542
682
|
...args,
|
|
543
683
|
});
|
|
544
684
|
},
|
|
685
|
+
prepareLocalePath({
|
|
686
|
+
locale = null, path,
|
|
687
|
+
}) {
|
|
688
|
+
return `/help_center${locale
|
|
689
|
+
? `/${locale}`
|
|
690
|
+
: ""}${path}`;
|
|
691
|
+
},
|
|
692
|
+
listArticleCategories({
|
|
693
|
+
locale, ...args
|
|
694
|
+
} = {}) {
|
|
695
|
+
return this.makeRequest({
|
|
696
|
+
path: this.prepareLocalePath({
|
|
697
|
+
locale,
|
|
698
|
+
path: "/categories",
|
|
699
|
+
}),
|
|
700
|
+
...args,
|
|
701
|
+
});
|
|
702
|
+
},
|
|
703
|
+
listSections({
|
|
704
|
+
locale, categoryId, ...args
|
|
705
|
+
} = {}) {
|
|
706
|
+
return this.makeRequest({
|
|
707
|
+
path: this.prepareLocalePath({
|
|
708
|
+
locale,
|
|
709
|
+
path: `/${categoryId
|
|
710
|
+
? `/categories/${categoryId}`
|
|
711
|
+
: ""}/sections`,
|
|
712
|
+
}),
|
|
713
|
+
...args,
|
|
714
|
+
});
|
|
715
|
+
},
|
|
716
|
+
listArticles({
|
|
717
|
+
locale, categoryId, sectionId, userId, ...args
|
|
718
|
+
} = {}) {
|
|
719
|
+
let path = "";
|
|
720
|
+
if (categoryId) {
|
|
721
|
+
path = `/categories/${categoryId}`;
|
|
722
|
+
}
|
|
723
|
+
if (sectionId) {
|
|
724
|
+
path = `/sections/${sectionId}`;
|
|
725
|
+
}
|
|
726
|
+
if (userId) {
|
|
727
|
+
path = `/users/${userId}`;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
return this.makeRequest({
|
|
731
|
+
path: this.prepareLocalePath({
|
|
732
|
+
locale,
|
|
733
|
+
path: `${path}/articles`,
|
|
734
|
+
}),
|
|
735
|
+
...args,
|
|
736
|
+
});
|
|
737
|
+
},
|
|
738
|
+
getArticle({
|
|
739
|
+
articleId, locale, ...args
|
|
740
|
+
} = {}) {
|
|
741
|
+
return this.makeRequest({
|
|
742
|
+
path: this.prepareLocalePath({
|
|
743
|
+
locale,
|
|
744
|
+
path: `/articles/${articleId}`,
|
|
745
|
+
}),
|
|
746
|
+
...args,
|
|
747
|
+
});
|
|
748
|
+
},
|
|
749
|
+
getMacro({
|
|
750
|
+
macroId, ...args
|
|
751
|
+
}) {
|
|
752
|
+
return this.makeRequest({
|
|
753
|
+
path: `/macros/${macroId}`,
|
|
754
|
+
...args,
|
|
755
|
+
});
|
|
756
|
+
},
|
|
545
757
|
async *paginate({
|
|
546
758
|
fn, args, resourceKey, max,
|
|
547
759
|
}) {
|