@pipedream/zendesk 0.9.0 → 0.10.1
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 +6 -1
- package/actions/create-ticket/create-ticket.mjs +6 -1
- package/actions/delete-ticket/delete-ticket.mjs +6 -1
- package/actions/get-ticket-info/get-ticket-info.mjs +6 -1
- package/actions/get-user-info/get-user-info.mjs +6 -1
- package/actions/list-locales/list-locales.mjs +6 -1
- package/actions/list-macros/list-macros.mjs +6 -1
- package/actions/list-ticket-comments/list-ticket-comments.mjs +6 -1
- package/actions/list-tickets/list-tickets.mjs +6 -1
- package/actions/remove-ticket-tags/remove-ticket-tags.mjs +6 -1
- package/actions/search-tickets/search-tickets.mjs +6 -1
- package/actions/set-custom-ticket-fields/set-custom-ticket-fields.mjs +85 -0
- package/actions/set-ticket-tags/set-ticket-tags.mjs +6 -1
- package/actions/update-ticket/update-ticket.mjs +6 -1
- package/common/utils.mjs +25 -0
- package/package.json +1 -2
- package/sources/common/ticket.mjs +14 -3
- package/sources/common/webhook.mjs +3 -3
- package/sources/locale-updated/locale-updated.mjs +1 -1
- package/sources/new-ticket/new-ticket.mjs +1 -1
- package/sources/new-ticket-comment-added/new-ticket-comment-added.mjs +3 -3
- package/sources/ticket-added-to-view/ticket-added-to-view.mjs +1 -5
- 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 +1 -0
|
@@ -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.
|
|
8
|
+
version: "0.0.6",
|
|
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
|
+
version: "0.1.10",
|
|
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
|
+
version: "0.1.10",
|
|
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: "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.8",
|
|
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.
|
|
7
|
+
version: "0.0.5",
|
|
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-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.
|
|
7
|
+
version: "0.0.5",
|
|
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.
|
|
7
|
+
version: "0.0.5",
|
|
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.
|
|
7
|
+
version: "0.0.5",
|
|
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.
|
|
8
|
+
version: "0.0.8",
|
|
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.
|
|
8
|
+
version: "0.0.6",
|
|
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.
|
|
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
|
query: {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import app from "../../zendesk.app.mjs";
|
|
2
|
+
import { parseObject } from "../../common/utils.mjs";
|
|
3
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
key: "zendesk-set-custom-ticket-fields",
|
|
7
|
+
name: "Set Custom Ticket Fields",
|
|
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
|
+
type: "action",
|
|
10
|
+
version: "0.0.3",
|
|
11
|
+
annotations: {
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
readOnlyHint: false,
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
app,
|
|
18
|
+
ticketId: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
app,
|
|
21
|
+
"ticketId",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
customFields: {
|
|
25
|
+
type: "string[]",
|
|
26
|
+
label: "Custom Fields",
|
|
27
|
+
description: "Array of custom field objects. Each item should be formatted as `{\"id\": \"field_id\", \"value\": \"field_value\"}`. Example: `{\"id\": \"23129751115165\", \"value\": \"ABCDE\"}`",
|
|
28
|
+
},
|
|
29
|
+
customSubdomain: {
|
|
30
|
+
propDefinition: [
|
|
31
|
+
app,
|
|
32
|
+
"customSubdomain",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
updateTicket({
|
|
38
|
+
ticketId, ...args
|
|
39
|
+
} = {}) {
|
|
40
|
+
return this.app.update({
|
|
41
|
+
path: `/tickets/${ticketId}`,
|
|
42
|
+
...args,
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
async run({ $: step }) {
|
|
47
|
+
const {
|
|
48
|
+
ticketId,
|
|
49
|
+
customFields,
|
|
50
|
+
customSubdomain,
|
|
51
|
+
} = this;
|
|
52
|
+
|
|
53
|
+
// Parse custom fields from string array to objects
|
|
54
|
+
const parsedCustomFields = parseObject(customFields);
|
|
55
|
+
|
|
56
|
+
if (!Array.isArray(parsedCustomFields)) {
|
|
57
|
+
throw new ConfigurationError("Custom Fields must be an array of custom field objects");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Validate custom fields structure
|
|
61
|
+
parsedCustomFields.forEach((field, index) => {
|
|
62
|
+
if (!field.id) {
|
|
63
|
+
throw new ConfigurationError(`Custom field at index ${index} is missing required "id" property`);
|
|
64
|
+
}
|
|
65
|
+
if (field.value === undefined) {
|
|
66
|
+
throw new ConfigurationError(`Custom field at index ${index} is missing required "value" property`);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const response = await this.updateTicket({
|
|
71
|
+
step,
|
|
72
|
+
ticketId,
|
|
73
|
+
customSubdomain,
|
|
74
|
+
data: {
|
|
75
|
+
ticket: {
|
|
76
|
+
custom_fields: parsedCustomFields,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
step.export("$summary", `Successfully updated ${parsedCustomFields.length} custom field(s) on ticket ${response.ticket.id}`);
|
|
82
|
+
|
|
83
|
+
return response;
|
|
84
|
+
},
|
|
85
|
+
};
|
|
@@ -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.
|
|
8
|
+
version: "0.0.6",
|
|
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.
|
|
8
|
+
version: "0.2.3",
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: true,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
readOnlyHint: false,
|
|
13
|
+
},
|
|
9
14
|
props: {
|
|
10
15
|
app,
|
|
11
16
|
ticketId: {
|
package/common/utils.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const parseObject = (obj) => {
|
|
2
|
+
if (!obj) {
|
|
3
|
+
return {};
|
|
4
|
+
}
|
|
5
|
+
if (typeof obj === "string") {
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(obj);
|
|
8
|
+
} catch {
|
|
9
|
+
return obj;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (Array.isArray(obj)) {
|
|
13
|
+
return obj.map(parseObject);
|
|
14
|
+
}
|
|
15
|
+
if (typeof obj === "object") {
|
|
16
|
+
return Object.fromEntries(Object.entries(obj).map(([
|
|
17
|
+
key,
|
|
18
|
+
value,
|
|
19
|
+
]) => [
|
|
20
|
+
key,
|
|
21
|
+
parseObject(value),
|
|
22
|
+
]));
|
|
23
|
+
}
|
|
24
|
+
return obj;
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/zendesk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Pipedream Zendesk Components",
|
|
5
5
|
"main": "zendesk.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@pipedream/platform": "^3.1.0",
|
|
18
|
-
"crypto": "^1.0.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
|
|
26
|
-
|
|
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
|
],
|
|
@@ -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.
|
|
10
|
+
version: "0.1.1",
|
|
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
|
+
version: "0.0.9",
|
|
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
|
},
|