Skip to content

Commit 5cf8f2a

Browse files
seynadioAfstklaclaudemichelle0927
authored
Add ticket tag management to Zendesk integration (#17609)
* Add ticket tag management to Zendesk integration - Add ticketTags prop definition to Zendesk app with JSDoc documentation - Add tag management methods: setTicketTags, addTicketTags, removeTicketTags - Enhance update-ticket action with tag support: * Add ticketTags and tagAction props * Support set/add/remove tag operations * Update summary and response format with tag operation details - Add dedicated tag management actions: * set-ticket-tags: Replace all existing tags * add-ticket-tags: Append to existing tags * remove-ticket-tags: Remove specific tags - Follow Zendesk Tags API specification (/tickets/{id}/tags.json) - Support custom subdomain for Enterprise accounts * Fix swapped HTTP methods for Zendesk ticket tag operations - addTicketTags now correctly uses PUT to append tags - setTicketTags now correctly uses POST to replace all tags - Aligns with Zendesk API specification where PUT adds and POST sets 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Update component versions and fix linting errors - Bump versions for all affected Zendesk components - Add required newlines at end of files - Fix multiline ternary operator formatting - Remove trailing spaces 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * whitespace and versions * versions, eslint * versions --------- Co-authored-by: Job Nijenhuis <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Michelle Bergeron <[email protected]>
1 parent 610723c commit 5cf8f2a

File tree

17 files changed

+302
-15
lines changed

17 files changed

+302
-15
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
};

components/zendesk/actions/create-ticket/create-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "Create Ticket",
66
description: "Creates a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#create-ticket).",
77
type: "action",
8-
version: "0.1.4",
8+
version: "0.1.5",
99
props: {
1010
app,
1111
ticketCommentBody: {

components/zendesk/actions/delete-ticket/delete-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "Delete Ticket",
66
description: "Deletes a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#delete-ticket).",
77
type: "action",
8-
version: "0.1.4",
8+
version: "0.1.5",
99
props: {
1010
app,
1111
ticketId: {

components/zendesk/actions/get-ticket-info/get-ticket-info.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "Get Ticket Info",
66
description: "Retrieves information about a specific ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#show-ticket).",
77
type: "action",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
props: {
1010
app,
1111
ticketId: {

components/zendesk/actions/list-tickets/list-tickets.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "List Tickets",
66
description: "Retrieves a list of tickets. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets).",
77
type: "action",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
props: {
1010
app,
1111
sortBy: {
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
};

components/zendesk/actions/search-tickets/search-tickets.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "Search Tickets",
66
description: "Searches for tickets using Zendesk's search API. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#search-tickets).",
77
type: "action",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
props: {
1010
app,
1111
query: {
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
};

components/zendesk/actions/update-ticket/update-ticket.mjs

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import app from "../../zendesk.app.mjs";
33
export default {
44
key: "zendesk-update-ticket",
55
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).",
77
type: "action",
8-
version: "0.1.4",
8+
version: "0.1.5",
99
props: {
1010
app,
1111
ticketId: {
@@ -56,6 +56,33 @@ export default {
5656
"customSubdomain",
5757
],
5858
},
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+
},
5986
},
6087
methods: {
6188
updateTicket({
@@ -77,6 +104,8 @@ export default {
77104
ticketStatus,
78105
ticketCommentPublic,
79106
customSubdomain,
107+
ticketTags,
108+
tagAction,
80109
} = this;
81110

82111
const ticketComment = ticketCommentBodyIsHTML
@@ -103,8 +132,54 @@ export default {
103132
},
104133
});
105134

106-
step.export("$summary", `Successfully updated ticket with ID ${response.ticket.id}`);
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+
}
107166

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}`);
108182
return response;
109183
},
110184
};
185+

components/zendesk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/zendesk",
3-
"version": "0.7.1",
3+
"version": "0.7.2",
44
"description": "Pipedream Zendesk Components",
55
"main": "zendesk.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)