@pipedream/zendesk 0.10.0 → 0.11.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.
Files changed (31) hide show
  1. package/actions/add-ticket-tags/add-ticket-tags.mjs +6 -1
  2. package/actions/create-ticket/create-ticket.mjs +6 -1
  3. package/actions/delete-ticket/delete-ticket.mjs +6 -1
  4. package/actions/get-article/get-article.mjs +43 -0
  5. package/actions/get-macro/get-macro.mjs +32 -0
  6. package/actions/get-ticket-info/get-ticket-info.mjs +6 -1
  7. package/actions/get-user-info/get-user-info.mjs +6 -1
  8. package/actions/list-active-macros/list-active-macros.mjs +77 -0
  9. package/actions/list-articles/list-articles.mjs +105 -0
  10. package/actions/list-locales/list-locales.mjs +6 -1
  11. package/actions/list-macros/list-macros.mjs +6 -1
  12. package/actions/list-ticket-comments/list-ticket-comments.mjs +6 -1
  13. package/actions/list-tickets/list-tickets.mjs +6 -1
  14. package/actions/remove-ticket-tags/remove-ticket-tags.mjs +6 -1
  15. package/actions/search-tickets/search-tickets.mjs +6 -1
  16. package/actions/set-custom-ticket-fields/set-custom-ticket-fields.mjs +8 -3
  17. package/actions/set-ticket-tags/set-ticket-tags.mjs +6 -1
  18. package/actions/update-ticket/update-ticket.mjs +6 -1
  19. package/common/constants.mjs +40 -0
  20. package/package.json +2 -3
  21. package/sources/common/ticket.mjs +14 -3
  22. package/sources/common/webhook.mjs +3 -3
  23. package/sources/locale-updated/locale-updated.mjs +1 -1
  24. package/sources/new-ticket/new-ticket.mjs +1 -1
  25. package/sources/new-ticket-comment-added/new-ticket-comment-added.mjs +3 -3
  26. package/sources/ticket-added-to-view/ticket-added-to-view.mjs +1 -5
  27. package/sources/ticket-closed/ticket-closed.mjs +1 -1
  28. package/sources/ticket-pended/ticket-pended.mjs +1 -1
  29. package/sources/ticket-solved/ticket-solved.mjs +1 -1
  30. package/sources/ticket-updated/ticket-updated.mjs +1 -1
  31. package/zendesk.app.mjs +213 -6
@@ -5,7 +5,12 @@ 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.4",
8
+ version: "0.0.7",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: false,
13
+ },
9
14
  props: {
10
15
  app,
11
16
  ticketId: {
@@ -5,7 +5,12 @@ 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",
8
+ version: "0.1.11",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: false,
13
+ },
9
14
  props: {
10
15
  app,
11
16
  ticketCommentBody: {
@@ -5,7 +5,12 @@ 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",
8
+ version: "0.1.11",
9
+ annotations: {
10
+ destructiveHint: true,
11
+ openWorldHint: true,
12
+ readOnlyHint: false,
13
+ },
9
14
  props: {
10
15
  app,
11
16
  ticketId: {
@@ -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.1",
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.1",
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,12 @@ 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.6",
8
+ version: "0.0.9",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
9
14
  props: {
10
15
  app,
11
16
  ticketId: {
@@ -4,7 +4,12 @@ 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.3",
7
+ version: "0.0.6",
8
+ annotations: {
9
+ destructiveHint: false,
10
+ openWorldHint: true,
11
+ readOnlyHint: true,
12
+ },
8
13
  type: "action",
9
14
  props: {
10
15
  zendesk,
@@ -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.1",
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.1",
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,12 @@ 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.3",
7
+ version: "0.0.6",
8
+ annotations: {
9
+ destructiveHint: false,
10
+ openWorldHint: true,
11
+ readOnlyHint: true,
12
+ },
8
13
  type: "action",
9
14
  props: {
10
15
  zendesk,
@@ -4,7 +4,12 @@ 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.3",
7
+ version: "0.0.6",
8
+ annotations: {
9
+ destructiveHint: false,
10
+ openWorldHint: true,
11
+ readOnlyHint: true,
12
+ },
8
13
  type: "action",
9
14
  props: {
10
15
  zendesk,
@@ -4,7 +4,12 @@ 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.3",
7
+ version: "0.0.6",
8
+ annotations: {
9
+ destructiveHint: false,
10
+ openWorldHint: true,
11
+ readOnlyHint: true,
12
+ },
8
13
  type: "action",
9
14
  props: {
10
15
  zendesk,
@@ -5,7 +5,12 @@ 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.6",
8
+ version: "0.0.9",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
9
14
  props: {
10
15
  app,
11
16
  sortBy: {
@@ -5,7 +5,12 @@ 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.4",
8
+ version: "0.0.7",
9
+ annotations: {
10
+ destructiveHint: true,
11
+ openWorldHint: true,
12
+ readOnlyHint: false,
13
+ },
9
14
  props: {
10
15
  app,
11
16
  ticketId: {
@@ -5,7 +5,12 @@ 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.7",
8
+ version: "0.0.10",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
9
14
  props: {
10
15
  app,
11
16
  query: {
@@ -1,13 +1,18 @@
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.1",
10
+ version: "0.0.4",
11
+ annotations: {
12
+ destructiveHint: false,
13
+ openWorldHint: true,
14
+ readOnlyHint: false,
15
+ },
11
16
  props: {
12
17
  app,
13
18
  ticketId: {
@@ -5,7 +5,12 @@ 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.4",
8
+ version: "0.0.7",
9
+ annotations: {
10
+ destructiveHint: true,
11
+ openWorldHint: true,
12
+ readOnlyHint: false,
13
+ },
9
14
  props: {
10
15
  app,
11
16
  ticketId: {
@@ -5,7 +5,12 @@ 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.1",
8
+ version: "0.2.4",
9
+ annotations: {
10
+ destructiveHint: true,
11
+ openWorldHint: true,
12
+ readOnlyHint: false,
13
+ },
9
14
  props: {
10
15
  app,
11
16
  ticketId: {
@@ -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.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Pipedream Zendesk Components",
5
5
  "main": "zendesk.app.mjs",
6
6
  "keywords": [
@@ -14,8 +14,7 @@
14
14
  "access": "public"
15
15
  },
16
16
  "dependencies": {
17
- "@pipedream/platform": "^3.1.0",
18
- "crypto": "^1.0.1",
17
+ "@pipedream/platform": "^3.1.1",
19
18
  "path": "^0.12.7"
20
19
  }
21
20
  }
@@ -11,7 +11,7 @@ export default {
11
11
  : match.toUpperCase();
12
12
  }).replace(/\s+/g, "");
13
13
  },
14
- getTriggerPayload() {
14
+ async getTriggerPayload() {
15
15
  if (this.jsonBody) {
16
16
  return JSON.parse(this.jsonBody);
17
17
  }
@@ -21,9 +21,20 @@ export default {
21
21
  createdAt: "{{ticket.created_at_with_timestamp}}",
22
22
  updatedAt: "{{ticket.updated_at_with_timestamp}}",
23
23
  };
24
+ const { ticket_fields: customFields } = await this.app.listTicketFields();
24
25
  for (const field of this.fields) {
25
- const key = this.convertToCamelCase(field.label);
26
- payload[key] = field.value;
26
+ const key = this.convertToCamelCase(field?.label || field);
27
+ if (field?.value) {
28
+ payload[key] = field.value;
29
+ } else {
30
+ const fieldId = customFields.find(({ title }) => title === field)?.id;
31
+ if (fieldId) {
32
+ payload[key] = `{{ticket.ticket_field_${fieldId}}}`;
33
+ } else {
34
+ console.warn(`Custom field not found for: ${field}`);
35
+ payload[key] = null;
36
+ }
37
+ }
27
38
  }
28
39
  return payload;
29
40
  }
@@ -57,7 +57,7 @@ export default {
57
57
 
58
58
  const { trigger } = await this.createTrigger({
59
59
  customSubdomain,
60
- data: this.setupTriggerData({
60
+ data: await this.setupTriggerData({
61
61
  webhookId,
62
62
  categoryId,
63
63
  }),
@@ -171,7 +171,7 @@ export default {
171
171
  },
172
172
  };
173
173
  },
174
- setupTriggerData({
174
+ async setupTriggerData({
175
175
  webhookId, categoryId,
176
176
  }) {
177
177
  return {
@@ -184,7 +184,7 @@ export default {
184
184
  field: "notification_webhook",
185
185
  value: [
186
186
  webhookId,
187
- JSON.stringify(this.getTriggerPayload()),
187
+ JSON.stringify(await this.getTriggerPayload()),
188
188
  ],
189
189
  },
190
190
  ],
@@ -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.3",
9
+ version: "0.0.5",
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.8",
9
+ version: "0.2.10",
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.1.0",
10
+ version: "0.1.2",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  app,
@@ -50,8 +50,8 @@ export default {
50
50
  ],
51
51
  };
52
52
  },
53
- getTriggerPayload() {
54
- const payload = common.methods.getTriggerPayload.call(this);
53
+ async getTriggerPayload() {
54
+ const payload = await common.methods.getTriggerPayload.call(this);
55
55
  return {
56
56
  ...payload,
57
57
  ticketComments: "{{ticket.comments}}",
@@ -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",
8
+ version: "0.0.10",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -32,10 +32,6 @@ export default {
32
32
  field: "update_type",
33
33
  value: "Change",
34
34
  },
35
- {
36
- field: "update_type",
37
- value: "Create",
38
- },
39
35
  ],
40
36
  };
41
37
  },
@@ -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.8",
9
+ version: "0.2.10",
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.8",
9
+ version: "0.2.10",
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.8",
9
+ version: "0.2.10",
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.8",
9
+ version: "0.2.10",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
package/zendesk.app.mjs CHANGED
@@ -1,7 +1,8 @@
1
- import { axios } from "@pipedream/platform";
2
- import constants from "./common/constants.mjs";
3
- import { getFileStreamAndMetadata } from "@pipedream/platform";
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",
@@ -87,6 +88,7 @@ export default {
87
88
  params: {
88
89
  [constants.PAGE_SIZE_PARAM]: constants.DEFAULT_LIMIT,
89
90
  [constants.PAGE_AFTER_PARAM]: afterCursor,
91
+ active: true,
90
92
  },
91
93
  });
92
94
 
@@ -193,6 +195,134 @@ export default {
193
195
  return fields;
194
196
  },
195
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
+ },
196
326
  ticketCommentBody: {
197
327
  type: "string",
198
328
  label: "Comment body",
@@ -335,13 +465,12 @@ export default {
335
465
  makeRequest({
336
466
  step = this, url, path, headers, customSubdomain, ...args
337
467
  }) {
338
- const config = {
468
+ return axios(step, {
339
469
  headers: this.getHeaders(headers),
340
470
  url: url ?? this.getUrl(path, customSubdomain),
341
471
  timeout: constants.DEFAULT_TIMEOUT,
342
472
  ...args,
343
- };
344
- return axios(step, config);
473
+ });
345
474
  },
346
475
  getTicketInfo({
347
476
  ticketId, ...args
@@ -529,6 +658,12 @@ export default {
529
658
  ...args,
530
659
  });
531
660
  },
661
+ listActiveMacros(args = {}) {
662
+ return this.makeRequest({
663
+ path: "/macros/active",
664
+ ...args,
665
+ });
666
+ },
532
667
  listMacroCategories(args = {}) {
533
668
  return this.makeRequest({
534
669
  path: "/macros/categories",
@@ -541,6 +676,78 @@ export default {
541
676
  ...args,
542
677
  });
543
678
  },
679
+ prepareLocalePath({
680
+ locale = null, path,
681
+ }) {
682
+ return `/help_center${locale
683
+ ? `/${locale}`
684
+ : ""}${path}`;
685
+ },
686
+ listArticleCategories({
687
+ locale, ...args
688
+ } = {}) {
689
+ return this.makeRequest({
690
+ path: this.prepareLocalePath({
691
+ locale,
692
+ path: "/categories",
693
+ }),
694
+ ...args,
695
+ });
696
+ },
697
+ listSections({
698
+ locale, categoryId, ...args
699
+ } = {}) {
700
+ return this.makeRequest({
701
+ path: this.prepareLocalePath({
702
+ locale,
703
+ path: `/${categoryId
704
+ ? `/categories/${categoryId}`
705
+ : ""}/sections`,
706
+ }),
707
+ ...args,
708
+ });
709
+ },
710
+ listArticles({
711
+ locale, categoryId, sectionId, userId, ...args
712
+ } = {}) {
713
+ let path = "";
714
+ if (categoryId) {
715
+ path = `/categories/${categoryId}`;
716
+ }
717
+ if (sectionId) {
718
+ path = `/sections/${sectionId}`;
719
+ }
720
+ if (userId) {
721
+ path = `/users/${userId}`;
722
+ }
723
+
724
+ return this.makeRequest({
725
+ path: this.prepareLocalePath({
726
+ locale,
727
+ path: `${path}/articles`,
728
+ }),
729
+ ...args,
730
+ });
731
+ },
732
+ getArticle({
733
+ articleId, locale, ...args
734
+ } = {}) {
735
+ return this.makeRequest({
736
+ path: this.prepareLocalePath({
737
+ locale,
738
+ path: `/articles/${articleId}`,
739
+ }),
740
+ ...args,
741
+ });
742
+ },
743
+ getMacro({
744
+ macroId, ...args
745
+ }) {
746
+ return this.makeRequest({
747
+ path: `/macros/${macroId}`,
748
+ ...args,
749
+ });
750
+ },
544
751
  async *paginate({
545
752
  fn, args, resourceKey, max,
546
753
  }) {