@pipedream/zendesk 0.7.1 → 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.
@@ -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.4",
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.4",
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.2",
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.2",
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.2",
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.4",
8
+ version: "0.1.5",
9
9
  props: {
10
10
  app,
11
11
  ticketId: {
@@ -56,6 +56,33 @@ export default {
56
56
  "customSubdomain",
57
57
  ],
58
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
+ },
59
86
  },
60
87
  methods: {
61
88
  updateTicket({
@@ -77,6 +104,8 @@ export default {
77
104
  ticketStatus,
78
105
  ticketCommentPublic,
79
106
  customSubdomain,
107
+ ticketTags,
108
+ tagAction,
80
109
  } = this;
81
110
 
82
111
  const ticketComment = ticketCommentBodyIsHTML
@@ -103,8 +132,54 @@ export default {
103
132
  },
104
133
  });
105
134
 
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
+ }
107
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}`);
108
182
  return response;
109
183
  },
110
184
  };
185
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/zendesk",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Pipedream Zendesk Components",
5
5
  "main": "zendesk.app.mjs",
6
6
  "keywords": [
@@ -6,7 +6,7 @@ export default {
6
6
  key: "zendesk-new-ticket",
7
7
  type: "source",
8
8
  description: "Emit new event when a ticket is created",
9
- version: "0.2.4",
9
+ version: "0.2.5",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -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.4",
8
+ version: "0.0.5",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -6,7 +6,7 @@ export default {
6
6
  key: "zendesk-ticket-closed",
7
7
  type: "source",
8
8
  description: "Emit new event when a ticket has changed to closed status",
9
- version: "0.2.4",
9
+ version: "0.2.5",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "zendesk-ticket-pended",
7
7
  type: "source",
8
8
  description: "Emit new event when a ticket has changed to pending status",
9
- version: "0.2.4",
9
+ version: "0.2.5",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "zendesk-ticket-solved",
7
7
  type: "source",
8
8
  description: "Emit new event when a ticket has changed to solved status",
9
- version: "0.2.4",
9
+ version: "0.2.5",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "zendesk-ticket-updated",
7
7
  type: "source",
8
8
  description: "Emit new event when a ticket has been updated",
9
- version: "0.2.4",
9
+ version: "0.2.5",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
package/zendesk.app.mjs CHANGED
@@ -189,6 +189,12 @@ export default {
189
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`",
190
190
  optional: true,
191
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
+ },
192
198
  },
193
199
  methods: {
194
200
  getUrl(path, customSubdomain) {
@@ -315,5 +321,68 @@ export default {
315
321
  args.params.page += 1;
316
322
  }
317
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
+ },
318
387
  },
319
388
  };