@pipedream/zendesk 0.8.2 → 0.9.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.
@@ -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.3",
8
+ version: "0.0.4",
9
9
  props: {
10
10
  app,
11
11
  ticketId: {
@@ -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.7",
8
+ version: "0.1.8",
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.7",
8
+ version: "0.1.8",
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.5",
8
+ version: "0.0.6",
9
9
  props: {
10
10
  app,
11
11
  ticketId: {
@@ -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.2",
7
+ version: "0.0.3",
8
8
  type: "action",
9
9
  props: {
10
10
  zendesk,
@@ -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.2",
7
+ version: "0.0.3",
8
8
  type: "action",
9
9
  props: {
10
10
  zendesk,
@@ -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.2",
7
+ version: "0.0.3",
8
8
  type: "action",
9
9
  props: {
10
10
  zendesk,
@@ -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.2",
7
+ version: "0.0.3",
8
8
  type: "action",
9
9
  props: {
10
10
  zendesk,
@@ -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.5",
8
+ version: "0.0.6",
9
9
  props: {
10
10
  app,
11
11
  sortBy: {
@@ -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.3",
8
+ version: "0.0.4",
9
9
  props: {
10
10
  app,
11
11
  ticketId: {
@@ -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.6",
8
+ version: "0.0.7",
9
9
  props: {
10
10
  app,
11
11
  query: {
@@ -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.3",
8
+ version: "0.0.4",
9
9
  props: {
10
10
  app,
11
11
  ticketId: {
@@ -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.0",
8
+ version: "0.2.1",
9
9
  props: {
10
10
  app,
11
11
  ticketId: {
@@ -89,6 +89,18 @@ export default {
89
89
  optional: true,
90
90
  default: "set",
91
91
  },
92
+ assigneeId: {
93
+ propDefinition: [
94
+ app,
95
+ "assigneeId",
96
+ ],
97
+ },
98
+ assigneeEmail: {
99
+ propDefinition: [
100
+ app,
101
+ "assigneeEmail",
102
+ ],
103
+ },
92
104
  },
93
105
  methods: {
94
106
  updateTicket({
@@ -113,6 +125,8 @@ export default {
113
125
  attachments,
114
126
  ticketTags,
115
127
  tagAction,
128
+ assigneeId,
129
+ assigneeEmail,
116
130
  } = this;
117
131
 
118
132
  const ticketComment = ticketCommentBodyIsHTML
@@ -143,24 +157,47 @@ export default {
143
157
  }
144
158
  }
145
159
 
160
+ // Build ticket data object
161
+ const ticketData = {
162
+ comment: ticketComment,
163
+ priority: ticketPriority,
164
+ subject: ticketSubject,
165
+ status: ticketStatus,
166
+ };
167
+
168
+ // Add assignee fields if provided
169
+ if (assigneeId) {
170
+ ticketData.assignee_id = assigneeId;
171
+ }
172
+ if (assigneeEmail) {
173
+ ticketData.assignee_email = assigneeEmail;
174
+ }
175
+
146
176
  const response = await this.updateTicket({
147
177
  step,
148
178
  ticketId,
149
179
  customSubdomain,
150
180
  data: {
151
- ticket: {
152
- comment: ticketComment,
153
- priority: ticketPriority,
154
- subject: ticketSubject,
155
- status: ticketStatus,
156
- },
181
+ ticket: ticketData,
157
182
  },
158
183
  });
159
184
 
160
185
  const attachmentCount = ticketComment.uploads?.length || 0;
161
- const summary = attachmentCount > 0
162
- ? `Successfully updated ticket with ID ${response.ticket.id} with ${attachmentCount} attachment(s)`
163
- : `Successfully updated ticket with ID ${response.ticket.id}`;
186
+ const assigneeUpdated = assigneeId || assigneeEmail;
187
+
188
+ let summary = `Successfully updated ticket with ID ${response.ticket.id}`;
189
+
190
+ const updates = [];
191
+ if (attachmentCount > 0) {
192
+ updates.push(`${attachmentCount} attachment(s)`);
193
+ }
194
+ if (assigneeUpdated) {
195
+ updates.push("assignee");
196
+ }
197
+
198
+ if (updates.length > 0) {
199
+ summary += ` with ${updates.join(" and ")}`;
200
+ }
164
201
 
165
202
  step.export("$summary", summary);
166
203
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/zendesk",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "Pipedream Zendesk Components",
5
5
  "main": "zendesk.app.mjs",
6
6
  "keywords": [
@@ -6,7 +6,7 @@ export default {
6
6
  name: "Locale Updated",
7
7
  type: "source",
8
8
  description: "Emit new event when a locale has been updated",
9
- version: "0.0.2",
9
+ version: "0.0.3",
10
10
  dedupe: "unique",
11
11
  async run() {
12
12
  const lastTs = this._getLastTs();
@@ -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.7",
9
+ version: "0.2.8",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -7,7 +7,7 @@ export default {
7
7
  key: "zendesk-new-ticket-comment-added",
8
8
  type: "source",
9
9
  description: "Emit new event when a ticket comment has been added",
10
- version: "0.0.2",
10
+ version: "0.1.0",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  app,
@@ -59,9 +59,14 @@ export default {
59
59
  },
60
60
  convertCommentsToJson(raw) {
61
61
  return [
62
- ...raw.matchAll(/#<Comment (.*?)>/g),
62
+ ...raw.matchAll(/#<Comment (.*?)(value: "[^"]*")(.*?)>/g),
63
63
  ].map((match) => {
64
- const fields = match[1]
64
+ const valueField = match[0].match(/(?<=, )value: "([^"]|\\")*[^\\]",/)?.[0];
65
+ const baseMatch = match[0].replace(/^#<Comment /, "");
66
+ const baseMatchWithoutValue = valueField
67
+ ? baseMatch.split(valueField).join("")
68
+ : baseMatch;
69
+ const fields = baseMatchWithoutValue
65
70
  .split(",")
66
71
  .map((part) => part.trim())
67
72
  .map((pair) => {
@@ -81,7 +86,15 @@ export default {
81
86
  cleaned,
82
87
  ];
83
88
  });
84
- return Object.fromEntries(fields);
89
+ return Object.fromEntries(valueField
90
+ ? [
91
+ ...fields,
92
+ [
93
+ "value",
94
+ valueField?.replace(/^value: ?/, ""),
95
+ ],
96
+ ]
97
+ : fields);
85
98
  });
86
99
  },
87
100
  isRelevant(payload) {
@@ -97,10 +110,16 @@ export default {
97
110
  },
98
111
  emitEvent(payload) {
99
112
  payload.ticketComments = this.convertCommentsToJson(payload.ticketComments);
100
- for (const comment of payload.ticketComments) {
113
+ const {
114
+ ticketComments, ...ticketData
115
+ } = payload;
116
+ for (const comment of ticketComments) {
101
117
  const ts = Date.parse(comment.created_at);
102
118
  const id = `${payload.ticketId}-${ts}`;
103
- this.$emit(comment, {
119
+ this.$emit({
120
+ ...comment,
121
+ ticketData,
122
+ }, {
104
123
  id,
105
124
  summary: comment.value,
106
125
  ts,
@@ -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.7",
8
+ version: "0.0.8",
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.7",
9
+ version: "0.2.8",
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.7",
9
+ version: "0.2.8",
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.7",
9
+ version: "0.2.8",
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.7",
9
+ version: "0.2.8",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
package/zendesk.app.mjs CHANGED
@@ -274,6 +274,44 @@ export default {
274
274
  description: "Array of tags to apply to the ticket. These will replace any existing tags on the ticket.",
275
275
  optional: true,
276
276
  },
277
+ assigneeId: {
278
+ type: "string",
279
+ label: "Assignee ID",
280
+ description: "The ID of the agent to assign the ticket to",
281
+ optional: true,
282
+ async options({ prevContext }) {
283
+ const { afterCursor } = prevContext;
284
+
285
+ const {
286
+ users,
287
+ meta,
288
+ } = await this.listUsers({
289
+ params: {
290
+ [constants.PAGE_SIZE_PARAM]: constants.DEFAULT_LIMIT,
291
+ [constants.PAGE_AFTER_PARAM]: afterCursor,
292
+ role: "agent",
293
+ },
294
+ });
295
+
296
+ return {
297
+ context: {
298
+ afterCursor: meta.after_cursor,
299
+ },
300
+ options: users.map(({
301
+ id, name,
302
+ }) => ({
303
+ label: name,
304
+ value: id,
305
+ })),
306
+ };
307
+ },
308
+ },
309
+ assigneeEmail: {
310
+ type: "string",
311
+ label: "Assignee Email",
312
+ description: "The email address of the agent to assign the ticket to",
313
+ optional: true,
314
+ },
277
315
  },
278
316
  methods: {
279
317
  getUrl(path, customSubdomain) {