@pipedream/zendesk 0.6.0 → 0.6.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/create-ticket/create-ticket.mjs +2 -2
- package/actions/delete-ticket/delete-ticket.mjs +2 -2
- package/actions/update-ticket/update-ticket.mjs +2 -2
- package/common/constants.mjs +192 -0
- package/package.json +1 -1
- package/sources/common/ticket.mjs +22 -0
- package/sources/common/webhook.mjs +13 -1
- package/sources/new-ticket/new-ticket.mjs +1 -1
- package/sources/ticket-added-to-view/ticket-added-to-view.mjs +1 -1
- 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 +25 -0
|
@@ -3,9 +3,9 @@ import app from "../../zendesk.app.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
key: "zendesk-create-ticket",
|
|
5
5
|
name: "Create Ticket",
|
|
6
|
-
description: "Creates a ticket. [See the
|
|
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.2",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
11
11
|
ticketCommentBody: {
|
|
@@ -3,9 +3,9 @@ import app from "../../zendesk.app.mjs";
|
|
|
3
3
|
export default {
|
|
4
4
|
key: "zendesk-delete-ticket",
|
|
5
5
|
name: "Delete Ticket",
|
|
6
|
-
description: "Deletes a ticket. [See the
|
|
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.2",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
11
11
|
ticketId: {
|
|
@@ -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
|
|
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.1.
|
|
8
|
+
version: "0.1.2",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
11
11
|
ticketId: {
|
package/common/constants.mjs
CHANGED
|
@@ -31,6 +31,197 @@ const TICKET_STATUS_OPTIONS = {
|
|
|
31
31
|
CLOSED: "closed",
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
const TICKET_FIELD_OPTIONS = [
|
|
35
|
+
{
|
|
36
|
+
label: "Current User Details",
|
|
37
|
+
value: "{{current_user.details}}",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: "Current User Email",
|
|
41
|
+
value: "{{current_user.email}}",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "Current User External ID",
|
|
45
|
+
value: "{{current_user.external_id}}",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: "Current User First Name",
|
|
49
|
+
value: "{{current_user.first_name}}",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: "Current User Language",
|
|
53
|
+
value: "{{current_user.language}}",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: "Current User Name",
|
|
57
|
+
value: "{{current_user.name}}",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: "Current User Notes",
|
|
61
|
+
value: "{{current_user.notes}}",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: "Current User Organization Details",
|
|
65
|
+
value: "{{current_user.organization.details}}",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: "Current User Organization Name",
|
|
69
|
+
value: "{{current_user.organization.name}}",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: "Current User Organization Notes",
|
|
73
|
+
value: "{{current_user.organization.notes}}",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: "Current User Phone",
|
|
77
|
+
value: "{{current_user.phone}}",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: "Satisfaction Current Comment",
|
|
81
|
+
value: "{{satisfaction.current_comment",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: "Satisfaction Current Rating",
|
|
85
|
+
value: "{{satisfaction.current_rating}}",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: "Ticket Account",
|
|
89
|
+
value: "{{ticket.account}}",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
label: "Ticket Assignee Email",
|
|
93
|
+
value: "{{ticket.assignee.email}}",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: "Ticket Assignee First Name",
|
|
97
|
+
value: "{{ticket.assignee.first_name}}",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: "Ticket Assignee Last Name",
|
|
101
|
+
value: "{{ticket.assignee.last_name}}",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
label: "Ticket Name",
|
|
105
|
+
value: "{{ticket.name}}",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
label: "Ticket Brand Name",
|
|
109
|
+
value: "{{ticket.brand.name}}",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: "Ticket CC Names",
|
|
113
|
+
value: "{{ticket.cc_names}}",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: "Ticket CSS",
|
|
117
|
+
value: "{{ticket.css}}",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
label: "Ticket Current Holiday Name",
|
|
121
|
+
value: "{{ticket.current_holiday_name}}",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
label: "Ticket Description",
|
|
125
|
+
value: "{{ticket.description}}",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
label: "Ticket Due Date",
|
|
129
|
+
value: "{{ticket.due_date}}",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
label: "Ticket External ID",
|
|
133
|
+
value: "{{ticket.external_id}}",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: "Ticket Group Name",
|
|
137
|
+
value: "{{ticket.group.name}}",
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
label: "Ticket Latest Comment HTML",
|
|
141
|
+
value: "{{ticket.latest_comment_html}}",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
label: "Ticket Latest Public Comment HTML",
|
|
145
|
+
value: "{{ticket.latest_public_comment_html}}",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
label: "Ticket Organization Details",
|
|
149
|
+
value: "{{ticket.organization.details}}",
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
label: "Ticket Organization External ID",
|
|
153
|
+
value: "{{ticket.organization.external_id}}",
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
label: "Ticket Organization Name",
|
|
157
|
+
value: "{{ticket.organization.name}}",
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
label: "Ticket Organization Notes",
|
|
161
|
+
value: "{{ticket.organization.notes}}",
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
label: "Ticket Priority",
|
|
165
|
+
value: "{{ticket.priority}}",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
label: "Ticket Requester Details",
|
|
169
|
+
value: "{{ticket.requester.details}}",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
label: "Ticket Requester Email",
|
|
173
|
+
value: "{{ticket.requester.email}}",
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
label: "Ticket Requester External ID",
|
|
177
|
+
value: "{{ticket.requester.external_id}}",
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
label: "Ticket Requester First Name",
|
|
181
|
+
value: "{{ticket.requester.first_name}}",
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
label: "Ticket Requester Language",
|
|
185
|
+
value: "{{ticket.requester.language}}",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
label: "Ticket Requester Last Name",
|
|
189
|
+
value: "{{ticket.requester.last_name}}",
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
label: "Ticket Requester Name",
|
|
193
|
+
value: "{{ticket.requester.name}}",
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
label: "Ticket Requester Phone",
|
|
197
|
+
value: "{{ticket.requester.phone}}",
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
label: "Ticket Status",
|
|
201
|
+
value: "{{ticket.status}}",
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
label: "Ticket Tags",
|
|
205
|
+
value: "{{ticket.tags}}",
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
label: "Ticket Title",
|
|
209
|
+
value: "{{ticket.title}}",
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
label: "Ticket Type",
|
|
213
|
+
value: "{{ticket.ticket_type}}",
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
label: "Ticket URL",
|
|
217
|
+
value: "{{ticket.url}}",
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
label: "Ticket Via",
|
|
221
|
+
value: "{{ticket.via}}",
|
|
222
|
+
},
|
|
223
|
+
];
|
|
224
|
+
|
|
34
225
|
export default {
|
|
35
226
|
SUBDOMAIN_PLACEHOLDER,
|
|
36
227
|
BASE_URL,
|
|
@@ -50,4 +241,5 @@ export default {
|
|
|
50
241
|
DEFAULT_TIMEOUT,
|
|
51
242
|
TICKET_PRIORITY_OPTIONS,
|
|
52
243
|
TICKET_STATUS_OPTIONS,
|
|
244
|
+
TICKET_FIELD_OPTIONS,
|
|
53
245
|
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,29 @@ export default {
|
|
|
4
4
|
...common,
|
|
5
5
|
methods: {
|
|
6
6
|
...common.methods,
|
|
7
|
+
convertToCamelCase(str) {
|
|
8
|
+
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(match, index) {
|
|
9
|
+
return index === 0
|
|
10
|
+
? match.toLowerCase()
|
|
11
|
+
: match.toUpperCase();
|
|
12
|
+
}).replace(/\s+/g, "");
|
|
13
|
+
},
|
|
7
14
|
getTriggerPayload() {
|
|
15
|
+
if (this.jsonBody) {
|
|
16
|
+
return JSON.parse(this.jsonBody);
|
|
17
|
+
}
|
|
18
|
+
if (this.fields?.length) {
|
|
19
|
+
const payload = {
|
|
20
|
+
ticketId: "{{ticket.id}}",
|
|
21
|
+
createdAt: "{{ticket.created_at_with_timestamp}}",
|
|
22
|
+
updatedAt: "{{ticket.updated_at_with_timestamp}}",
|
|
23
|
+
};
|
|
24
|
+
for (const field of this.fields) {
|
|
25
|
+
const key = this.convertToCamelCase(field.label);
|
|
26
|
+
payload[key] = field.value;
|
|
27
|
+
}
|
|
28
|
+
return payload;
|
|
29
|
+
}
|
|
8
30
|
return {
|
|
9
31
|
ticketId: "{{ticket.id}}",
|
|
10
32
|
title: "{{ticket.title}}",
|
|
@@ -19,6 +19,18 @@ export default {
|
|
|
19
19
|
"customSubdomain",
|
|
20
20
|
],
|
|
21
21
|
},
|
|
22
|
+
fields: {
|
|
23
|
+
propDefinition: [
|
|
24
|
+
app,
|
|
25
|
+
"fields",
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
jsonBody: {
|
|
29
|
+
type: "string",
|
|
30
|
+
label: "JSON Body",
|
|
31
|
+
description: "Custom JSON Body of the incoming payload. Setting `jsonBody` will overwrite the `fields` prop",
|
|
32
|
+
optional: true,
|
|
33
|
+
},
|
|
22
34
|
},
|
|
23
35
|
hooks: {
|
|
24
36
|
async activate() {
|
|
@@ -234,7 +246,7 @@ export default {
|
|
|
234
246
|
|
|
235
247
|
this.$emit(payload, {
|
|
236
248
|
id,
|
|
237
|
-
summary: payload.title,
|
|
249
|
+
summary: payload.title || payload.ticketId,
|
|
238
250
|
ts,
|
|
239
251
|
});
|
|
240
252
|
},
|
|
@@ -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.2",
|
|
9
9
|
type: "source",
|
|
10
10
|
dedupe: "unique",
|
|
11
11
|
props: {
|
package/zendesk.app.mjs
CHANGED
|
@@ -100,6 +100,25 @@ export default {
|
|
|
100
100
|
};
|
|
101
101
|
},
|
|
102
102
|
},
|
|
103
|
+
fields: {
|
|
104
|
+
type: "string[]",
|
|
105
|
+
label: "Fields",
|
|
106
|
+
description: "Ticket fields to be included in the incoming webhook payload",
|
|
107
|
+
withLabel: true,
|
|
108
|
+
optional: true,
|
|
109
|
+
async options() {
|
|
110
|
+
// placehoders reference - https://support.zendesk.com/hc/en-us/articles/4408886858138
|
|
111
|
+
const { ticket_fields: customFields } = await this.listTicketFields();
|
|
112
|
+
const fields = customFields.reverse().map(({
|
|
113
|
+
id, title,
|
|
114
|
+
}) => ({
|
|
115
|
+
label: title,
|
|
116
|
+
value: `{{ticket.ticket_field_${id}}}`,
|
|
117
|
+
}));
|
|
118
|
+
fields.push(...constants.TICKET_FIELD_OPTIONS);
|
|
119
|
+
return fields;
|
|
120
|
+
},
|
|
121
|
+
},
|
|
103
122
|
ticketCommentBody: {
|
|
104
123
|
type: "string",
|
|
105
124
|
label: "Comment body",
|
|
@@ -206,5 +225,11 @@ export default {
|
|
|
206
225
|
...args,
|
|
207
226
|
});
|
|
208
227
|
},
|
|
228
|
+
listTicketFields(args = {}) {
|
|
229
|
+
return this.makeRequest({
|
|
230
|
+
path: "/ticket_fields",
|
|
231
|
+
...args,
|
|
232
|
+
});
|
|
233
|
+
},
|
|
209
234
|
},
|
|
210
235
|
};
|