@pipedream/zendesk 0.7.0 → 0.7.2
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 +48 -0
- package/actions/create-ticket/create-ticket.mjs +1 -1
- package/actions/delete-ticket/delete-ticket.mjs +1 -1
- package/actions/get-ticket-info/get-ticket-info.mjs +1 -1
- package/actions/list-tickets/list-tickets.mjs +1 -1
- package/actions/remove-ticket-tags/remove-ticket-tags.mjs +48 -0
- package/actions/search-tickets/search-tickets.mjs +1 -1
- package/actions/set-ticket-tags/set-ticket-tags.mjs +47 -0
- package/actions/update-ticket/update-ticket.mjs +103 -6
- package/package.json +1 -1
- package/sources/new-ticket/new-ticket.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 +84 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import app from "../../zendesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "zendesk-add-ticket-tags",
|
|
5
|
+
name: "Add Ticket Tags",
|
|
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
|
+
type: "action",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
props: {
|
|
10
|
+
app,
|
|
11
|
+
ticketId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
app,
|
|
14
|
+
"ticketId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
ticketTags: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
app,
|
|
20
|
+
"ticketTags",
|
|
21
|
+
],
|
|
22
|
+
description: "Array of tags to add to the ticket. These will be appended to any existing tags.",
|
|
23
|
+
},
|
|
24
|
+
customSubdomain: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
app,
|
|
27
|
+
"customSubdomain",
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
async run({ $: step }) {
|
|
32
|
+
const {
|
|
33
|
+
ticketId,
|
|
34
|
+
ticketTags,
|
|
35
|
+
customSubdomain,
|
|
36
|
+
} = this;
|
|
37
|
+
|
|
38
|
+
const response = await this.app.addTicketTags({
|
|
39
|
+
step,
|
|
40
|
+
ticketId,
|
|
41
|
+
tags: ticketTags,
|
|
42
|
+
customSubdomain,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
step.export("$summary", `Successfully added ${ticketTags.length} tag(s) to ticket ${ticketId}`);
|
|
46
|
+
return response;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -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.5",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
11
11
|
ticketCommentBody: {
|
|
@@ -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.5",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
11
11
|
ticketId: {
|
|
@@ -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.3",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
11
11
|
ticketId: {
|
|
@@ -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.3",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
11
11
|
sortBy: {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import app from "../../zendesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "zendesk-remove-ticket-tags",
|
|
5
|
+
name: "Remove Ticket Tags",
|
|
6
|
+
description: "Remove specific tags from a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/ticket-management/tags/#remove-tags).",
|
|
7
|
+
type: "action",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
props: {
|
|
10
|
+
app,
|
|
11
|
+
ticketId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
app,
|
|
14
|
+
"ticketId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
ticketTags: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
app,
|
|
20
|
+
"ticketTags",
|
|
21
|
+
],
|
|
22
|
+
description: "Array of tags to remove from the ticket.",
|
|
23
|
+
},
|
|
24
|
+
customSubdomain: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
app,
|
|
27
|
+
"customSubdomain",
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
async run({ $: step }) {
|
|
32
|
+
const {
|
|
33
|
+
ticketId,
|
|
34
|
+
ticketTags,
|
|
35
|
+
customSubdomain,
|
|
36
|
+
} = this;
|
|
37
|
+
|
|
38
|
+
const response = await this.app.removeTicketTags({
|
|
39
|
+
step,
|
|
40
|
+
ticketId,
|
|
41
|
+
tags: ticketTags,
|
|
42
|
+
customSubdomain,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
step.export("$summary", `Successfully removed ${ticketTags.length} tag(s) from ticket ${ticketId}`);
|
|
46
|
+
return response;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -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.3",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
11
11
|
query: {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import app from "../../zendesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "zendesk-set-ticket-tags",
|
|
5
|
+
name: "Set Ticket Tags",
|
|
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
|
+
type: "action",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
props: {
|
|
10
|
+
app,
|
|
11
|
+
ticketId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
app,
|
|
14
|
+
"ticketId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
ticketTags: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
app,
|
|
20
|
+
"ticketTags",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
customSubdomain: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
app,
|
|
26
|
+
"customSubdomain",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $: step }) {
|
|
31
|
+
const {
|
|
32
|
+
ticketId,
|
|
33
|
+
ticketTags,
|
|
34
|
+
customSubdomain,
|
|
35
|
+
} = this;
|
|
36
|
+
|
|
37
|
+
const response = await this.app.setTicketTags({
|
|
38
|
+
step,
|
|
39
|
+
ticketId,
|
|
40
|
+
tags: ticketTags,
|
|
41
|
+
customSubdomain,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
step.export("$summary", `Successfully set ${ticketTags.length} tag(s) on ticket ${ticketId}`);
|
|
45
|
+
return response;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -3,9 +3,9 @@ import app from "../../zendesk.app.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
key: "zendesk-update-ticket",
|
|
5
5
|
name: "Update Ticket",
|
|
6
|
-
description: "Updates a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#update-ticket).",
|
|
6
|
+
description: "Updates a ticket and optionally manages tags. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#update-ticket).",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.5",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
11
11
|
ticketId: {
|
|
@@ -20,6 +20,12 @@ export default {
|
|
|
20
20
|
"ticketCommentBody",
|
|
21
21
|
],
|
|
22
22
|
},
|
|
23
|
+
ticketCommentBodyIsHTML: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
app,
|
|
26
|
+
"ticketCommentBodyIsHTML",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
23
29
|
ticketPriority: {
|
|
24
30
|
propDefinition: [
|
|
25
31
|
app,
|
|
@@ -38,12 +44,45 @@ export default {
|
|
|
38
44
|
"ticketStatus",
|
|
39
45
|
],
|
|
40
46
|
},
|
|
47
|
+
ticketCommentPublic: {
|
|
48
|
+
propDefinition: [
|
|
49
|
+
app,
|
|
50
|
+
"ticketCommentPublic",
|
|
51
|
+
],
|
|
52
|
+
},
|
|
41
53
|
customSubdomain: {
|
|
42
54
|
propDefinition: [
|
|
43
55
|
app,
|
|
44
56
|
"customSubdomain",
|
|
45
57
|
],
|
|
46
58
|
},
|
|
59
|
+
ticketTags: {
|
|
60
|
+
propDefinition: [
|
|
61
|
+
app,
|
|
62
|
+
"ticketTags",
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
tagAction: {
|
|
66
|
+
type: "string",
|
|
67
|
+
label: "Tag Action",
|
|
68
|
+
description: "How to handle the tags: set (replace all existing tags), add (append to existing tags), or remove (remove specified tags)",
|
|
69
|
+
options: [
|
|
70
|
+
{
|
|
71
|
+
label: "Set Tags (Replace All)",
|
|
72
|
+
value: "set",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: "Add Tags (Append)",
|
|
76
|
+
value: "add",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: "Remove Tags",
|
|
80
|
+
value: "remove",
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
optional: true,
|
|
84
|
+
default: "set",
|
|
85
|
+
},
|
|
47
86
|
},
|
|
48
87
|
methods: {
|
|
49
88
|
updateTicket({
|
|
@@ -59,21 +98,33 @@ export default {
|
|
|
59
98
|
const {
|
|
60
99
|
ticketId,
|
|
61
100
|
ticketCommentBody,
|
|
101
|
+
ticketCommentBodyIsHTML,
|
|
62
102
|
ticketPriority,
|
|
63
103
|
ticketSubject,
|
|
64
104
|
ticketStatus,
|
|
105
|
+
ticketCommentPublic,
|
|
65
106
|
customSubdomain,
|
|
107
|
+
ticketTags,
|
|
108
|
+
tagAction,
|
|
66
109
|
} = this;
|
|
67
110
|
|
|
111
|
+
const ticketComment = ticketCommentBodyIsHTML
|
|
112
|
+
? {
|
|
113
|
+
html_body: ticketCommentBody,
|
|
114
|
+
}
|
|
115
|
+
: {
|
|
116
|
+
body: ticketCommentBody,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
ticketComment.public = ticketCommentPublic;
|
|
120
|
+
|
|
68
121
|
const response = await this.updateTicket({
|
|
69
122
|
step,
|
|
70
123
|
ticketId,
|
|
71
124
|
customSubdomain,
|
|
72
125
|
data: {
|
|
73
126
|
ticket: {
|
|
74
|
-
comment:
|
|
75
|
-
body: ticketCommentBody,
|
|
76
|
-
},
|
|
127
|
+
comment: ticketComment,
|
|
77
128
|
priority: ticketPriority,
|
|
78
129
|
subject: ticketSubject,
|
|
79
130
|
status: ticketStatus,
|
|
@@ -81,8 +132,54 @@ export default {
|
|
|
81
132
|
},
|
|
82
133
|
});
|
|
83
134
|
|
|
84
|
-
|
|
135
|
+
// Handle tag operations if tags are provided
|
|
136
|
+
if (ticketTags && ticketTags.length > 0) {
|
|
137
|
+
let tagResponse;
|
|
138
|
+
|
|
139
|
+
switch (tagAction) {
|
|
140
|
+
case "add":
|
|
141
|
+
tagResponse = await this.app.addTicketTags({
|
|
142
|
+
step,
|
|
143
|
+
ticketId,
|
|
144
|
+
tags: ticketTags,
|
|
145
|
+
customSubdomain,
|
|
146
|
+
});
|
|
147
|
+
break;
|
|
148
|
+
case "remove":
|
|
149
|
+
tagResponse = await this.app.removeTicketTags({
|
|
150
|
+
step,
|
|
151
|
+
ticketId,
|
|
152
|
+
tags: ticketTags,
|
|
153
|
+
customSubdomain,
|
|
154
|
+
});
|
|
155
|
+
break;
|
|
156
|
+
case "set":
|
|
157
|
+
default:
|
|
158
|
+
tagResponse = await this.app.setTicketTags({
|
|
159
|
+
step,
|
|
160
|
+
ticketId,
|
|
161
|
+
tags: ticketTags,
|
|
162
|
+
customSubdomain,
|
|
163
|
+
});
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
85
166
|
|
|
167
|
+
// Include tag information in summary
|
|
168
|
+
const tagSummary = `and ${tagAction === "set"
|
|
169
|
+
? "set"
|
|
170
|
+
: tagAction === "add"
|
|
171
|
+
? "added"
|
|
172
|
+
: "removed"} ${ticketTags.length} tag(s)`;
|
|
173
|
+
step.export("$summary", `Successfully updated ticket with ID ${response.ticket.id} ${tagSummary}`);
|
|
174
|
+
// Include tag response in the return data
|
|
175
|
+
return {
|
|
176
|
+
ticket: response,
|
|
177
|
+
tags: tagResponse,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
step.export("$summary", `Successfully updated ticket with ID ${response.ticket.id}`);
|
|
86
182
|
return response;
|
|
87
183
|
},
|
|
88
184
|
};
|
|
185
|
+
|
package/package.json
CHANGED
|
@@ -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.5",
|
|
9
9
|
type: "source",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
props: {
|
package/zendesk.app.mjs
CHANGED
|
@@ -9,6 +9,7 @@ export default {
|
|
|
9
9
|
type: "string",
|
|
10
10
|
label: "Trigger Category ID",
|
|
11
11
|
description: "The ID of the trigger category. [See the docs here](https://developer.zendesk.com/api-reference/ticketing/business-rules/trigger_categories/#list-trigger-categories)",
|
|
12
|
+
optional: true,
|
|
12
13
|
async options({ prevContext }) {
|
|
13
14
|
const { afterCursor } = prevContext;
|
|
14
15
|
|
|
@@ -124,6 +125,13 @@ export default {
|
|
|
124
125
|
label: "Comment body",
|
|
125
126
|
description: "The body of the comment.",
|
|
126
127
|
},
|
|
128
|
+
ticketCommentBodyIsHTML: {
|
|
129
|
+
type: "boolean",
|
|
130
|
+
label: "Comment body is HTML",
|
|
131
|
+
description: "Whether the comment body is HTML. Default is `false`, which expects Markdown",
|
|
132
|
+
default: false,
|
|
133
|
+
optional: true,
|
|
134
|
+
},
|
|
127
135
|
ticketPriority: {
|
|
128
136
|
type: "string",
|
|
129
137
|
label: "Ticket Priority",
|
|
@@ -144,6 +152,13 @@ export default {
|
|
|
144
152
|
optional: true,
|
|
145
153
|
options: Object.values(constants.TICKET_STATUS_OPTIONS),
|
|
146
154
|
},
|
|
155
|
+
ticketCommentPublic: {
|
|
156
|
+
type: "boolean",
|
|
157
|
+
label: "Comment Public",
|
|
158
|
+
description: "Whether the comment is public. Default is `true`",
|
|
159
|
+
default: true,
|
|
160
|
+
optional: true,
|
|
161
|
+
},
|
|
147
162
|
sortBy: {
|
|
148
163
|
type: "string",
|
|
149
164
|
label: "Sort By",
|
|
@@ -174,6 +189,12 @@ export default {
|
|
|
174
189
|
description: "For Enterprise Zendesk accounts: optionally specify the subdomain to use. This will override the subdomain that was provided when connecting your Zendesk account to Pipedream. For example, if you Zendesk URL is https://examplehelp.zendesk.com, your subdomain is `examplehelp`",
|
|
175
190
|
optional: true,
|
|
176
191
|
},
|
|
192
|
+
ticketTags: {
|
|
193
|
+
type: "string[]",
|
|
194
|
+
label: "Tags",
|
|
195
|
+
description: "Array of tags to apply to the ticket. These will replace any existing tags on the ticket.",
|
|
196
|
+
optional: true,
|
|
197
|
+
},
|
|
177
198
|
},
|
|
178
199
|
methods: {
|
|
179
200
|
getUrl(path, customSubdomain) {
|
|
@@ -300,5 +321,68 @@ export default {
|
|
|
300
321
|
args.params.page += 1;
|
|
301
322
|
}
|
|
302
323
|
},
|
|
324
|
+
/**
|
|
325
|
+
* Set tags on a ticket (replaces all existing tags)
|
|
326
|
+
* @param {object} args - Arguments object
|
|
327
|
+
* @param {string} args.ticketId - The ticket ID
|
|
328
|
+
* @param {string[]} args.tags - Array of tags to set
|
|
329
|
+
* @param {string} args.customSubdomain - Optional custom subdomain
|
|
330
|
+
* @returns {Promise<object>} API response
|
|
331
|
+
*/
|
|
332
|
+
setTicketTags({
|
|
333
|
+
ticketId, tags, customSubdomain, ...args
|
|
334
|
+
}) {
|
|
335
|
+
return this.makeRequest({
|
|
336
|
+
method: "POST",
|
|
337
|
+
path: `/tickets/${ticketId}/tags.json`,
|
|
338
|
+
customSubdomain,
|
|
339
|
+
data: {
|
|
340
|
+
tags,
|
|
341
|
+
},
|
|
342
|
+
...args,
|
|
343
|
+
});
|
|
344
|
+
},
|
|
345
|
+
/**
|
|
346
|
+
* Add tags to a ticket (appends to existing tags)
|
|
347
|
+
* @param {object} args - Arguments object
|
|
348
|
+
* @param {string} args.ticketId - The ticket ID
|
|
349
|
+
* @param {string[]} args.tags - Array of tags to add
|
|
350
|
+
* @param {string} args.customSubdomain - Optional custom subdomain
|
|
351
|
+
* @returns {Promise<object>} API response
|
|
352
|
+
*/
|
|
353
|
+
addTicketTags({
|
|
354
|
+
ticketId, tags, customSubdomain, ...args
|
|
355
|
+
}) {
|
|
356
|
+
return this.makeRequest({
|
|
357
|
+
method: "PUT",
|
|
358
|
+
path: `/tickets/${ticketId}/tags.json`,
|
|
359
|
+
customSubdomain,
|
|
360
|
+
data: {
|
|
361
|
+
tags,
|
|
362
|
+
},
|
|
363
|
+
...args,
|
|
364
|
+
});
|
|
365
|
+
},
|
|
366
|
+
/**
|
|
367
|
+
* Remove specific tags from a ticket
|
|
368
|
+
* @param {object} args - Arguments object
|
|
369
|
+
* @param {string} args.ticketId - The ticket ID
|
|
370
|
+
* @param {string[]} args.tags - Array of tags to remove
|
|
371
|
+
* @param {string} args.customSubdomain - Optional custom subdomain
|
|
372
|
+
* @returns {Promise<object>} API response
|
|
373
|
+
*/
|
|
374
|
+
removeTicketTags({
|
|
375
|
+
ticketId, tags, customSubdomain, ...args
|
|
376
|
+
}) {
|
|
377
|
+
return this.makeRequest({
|
|
378
|
+
method: "DELETE",
|
|
379
|
+
path: `/tickets/${ticketId}/tags.json`,
|
|
380
|
+
customSubdomain,
|
|
381
|
+
data: {
|
|
382
|
+
tags,
|
|
383
|
+
},
|
|
384
|
+
...args,
|
|
385
|
+
});
|
|
386
|
+
},
|
|
303
387
|
},
|
|
304
388
|
};
|