Skip to content

Commit 7135567

Browse files
authored
Zendesk - View, List, Search Tickets actions (#16640)
* new components * pnpm-lock.yaml
1 parent 4dc1346 commit 7135567

16 files changed

Lines changed: 277 additions & 13 deletions

File tree

components/zendesk/actions/create-ticket/create-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "Create Ticket",
66
description: "Creates a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#create-ticket).",
77
type: "action",
8-
version: "0.1.2",
8+
version: "0.1.3",
99
props: {
1010
app,
1111
ticketCommentBody: {

components/zendesk/actions/delete-ticket/delete-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "Delete Ticket",
66
description: "Deletes a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#delete-ticket).",
77
type: "action",
8-
version: "0.1.2",
8+
version: "0.1.3",
99
props: {
1010
app,
1111
ticketId: {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import app from "../../zendesk.app.mjs";
2+
3+
export default {
4+
key: "zendesk-get-ticket-info",
5+
name: "Get Ticket Info",
6+
description: "Retrieves information about a specific ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#show-ticket).",
7+
type: "action",
8+
version: "0.0.1",
9+
props: {
10+
app,
11+
ticketId: {
12+
propDefinition: [
13+
app,
14+
"ticketId",
15+
],
16+
},
17+
customSubdomain: {
18+
propDefinition: [
19+
app,
20+
"customSubdomain",
21+
],
22+
},
23+
},
24+
async run({ $: step }) {
25+
const {
26+
ticketId,
27+
customSubdomain,
28+
} = this;
29+
30+
const response = await this.app.getTicketInfo({
31+
step,
32+
ticketId,
33+
customSubdomain,
34+
});
35+
36+
step.export("$summary", `Successfully retrieved ticket with ID ${response.ticket.id}`);
37+
38+
return response;
39+
},
40+
};
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import app from "../../zendesk.app.mjs";
2+
3+
export default {
4+
key: "zendesk-list-tickets",
5+
name: "List Tickets",
6+
description: "Retrieves a list of tickets. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets).",
7+
type: "action",
8+
version: "0.0.1",
9+
props: {
10+
app,
11+
sortBy: {
12+
propDefinition: [
13+
app,
14+
"sortBy",
15+
],
16+
},
17+
sortOrder: {
18+
propDefinition: [
19+
app,
20+
"sortOrder",
21+
],
22+
},
23+
limit: {
24+
propDefinition: [
25+
app,
26+
"limit",
27+
],
28+
},
29+
customSubdomain: {
30+
propDefinition: [
31+
app,
32+
"customSubdomain",
33+
],
34+
},
35+
},
36+
async run({ $: step }) {
37+
const {
38+
sortBy,
39+
sortOrder,
40+
limit,
41+
customSubdomain,
42+
} = this;
43+
44+
const results = this.app.paginate({
45+
fn: this.app.listTickets,
46+
args: {
47+
step,
48+
customSubdomain,
49+
params: {
50+
sort_by: sortBy,
51+
sort_order: sortOrder,
52+
},
53+
},
54+
resourceKey: "tickets",
55+
max: limit,
56+
});
57+
58+
const tickets = [];
59+
for await (const ticket of results) {
60+
tickets.push(ticket);
61+
}
62+
63+
step.export("$summary", `Successfully retrieved ${tickets.length} tickets`);
64+
65+
return tickets;
66+
},
67+
};
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import app from "../../zendesk.app.mjs";
2+
3+
export default {
4+
key: "zendesk-search-tickets",
5+
name: "Search Tickets",
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+
type: "action",
8+
version: "0.0.1",
9+
props: {
10+
app,
11+
query: {
12+
type: "string",
13+
label: "Search Query",
14+
description: "The search query to find tickets. You can use Zendesk's search syntax. Example: `type:ticket status:open priority:high`. [See the documentation](https://developer.zendesk.com/documentation/ticketing/using-the-zendesk-api/searching-with-the-zendesk-api/)",
15+
},
16+
sortBy: {
17+
propDefinition: [
18+
app,
19+
"sortBy",
20+
],
21+
},
22+
sortOrder: {
23+
propDefinition: [
24+
app,
25+
"sortOrder",
26+
],
27+
},
28+
limit: {
29+
propDefinition: [
30+
app,
31+
"limit",
32+
],
33+
},
34+
customSubdomain: {
35+
propDefinition: [
36+
app,
37+
"customSubdomain",
38+
],
39+
},
40+
},
41+
async run({ $: step }) {
42+
const {
43+
query,
44+
sortBy,
45+
sortOrder,
46+
limit,
47+
customSubdomain,
48+
} = this;
49+
50+
const results = this.app.paginate({
51+
fn: this.app.searchTickets,
52+
args: {
53+
step,
54+
customSubdomain,
55+
params: {
56+
query,
57+
sort_by: sortBy,
58+
sort_order: sortOrder,
59+
},
60+
},
61+
resourceKey: "results",
62+
max: limit,
63+
});
64+
65+
const tickets = [];
66+
for await (const ticket of results) {
67+
tickets.push(ticket);
68+
}
69+
70+
step.export("$summary", `Successfully found ${tickets.length} tickets matching the search query`);
71+
72+
return tickets;
73+
},
74+
};

components/zendesk/actions/update-ticket/update-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "Update Ticket",
66
description: "Updates a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#update-ticket).",
77
type: "action",
8-
version: "0.1.2",
8+
version: "0.1.3",
99
props: {
1010
app,
1111
ticketId: {

components/zendesk/common/constants.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,19 @@ const TICKET_FIELD_OPTIONS = [
222222
},
223223
];
224224

225+
const SORT_BY_OPTIONS = [
226+
"assignee",
227+
"assignee.name",
228+
"created_at",
229+
"group",
230+
"id",
231+
"requester",
232+
"requester.name",
233+
"status",
234+
"subject",
235+
"updated_at",
236+
];
237+
225238
export default {
226239
SUBDOMAIN_PLACEHOLDER,
227240
BASE_URL,
@@ -242,4 +255,5 @@ export default {
242255
TICKET_PRIORITY_OPTIONS,
243256
TICKET_STATUS_OPTIONS,
244257
TICKET_FIELD_OPTIONS,
258+
SORT_BY_OPTIONS,
245259
};

components/zendesk/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/zendesk",
3-
"version": "0.6.1",
3+
"version": "0.7.0",
44
"description": "Pipedream Zendesk Components",
55
"main": "zendesk.app.mjs",
66
"keywords": [
@@ -14,7 +14,7 @@
1414
"access": "public"
1515
},
1616
"dependencies": {
17-
"@pipedream/platform": "^0.9.0",
17+
"@pipedream/platform": "^3.0.3",
1818
"crypto": "^1.0.1"
1919
}
2020
}

components/zendesk/sources/new-ticket/new-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "zendesk-new-ticket",
77
type: "source",
88
description: "Emit new event when a ticket is created",
9-
version: "0.2.2",
9+
version: "0.2.3",
1010
dedupe: "unique",
1111
methods: {
1212
...common.methods,

components/zendesk/sources/ticket-added-to-view/ticket-added-to-view.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "zendesk-ticket-added-to-view",
66
name: "New Ticket Added to View (Instant)",
77
description: "Emit new event when a ticket is added to the specified view",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
type: "source",
1010
dedupe: "unique",
1111
props: {

0 commit comments

Comments
 (0)