@pipedream/freshdesk 0.1.1 → 0.2.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.
- package/actions/assign-ticket-to-agent/assign-ticket-to-agent.mjs +41 -0
- package/actions/assign-ticket-to-group/assign-ticket-to-group.mjs +42 -0
- package/actions/close-ticket/close-ticket.mjs +33 -0
- package/actions/create-company/create-company.mjs +1 -1
- package/actions/create-contact/create-contact.mjs +1 -1
- package/actions/create-ticket/create-ticket.mjs +1 -1
- package/actions/get-ticket/get-ticket.mjs +1 -1
- package/actions/list-all-tickets/list-all-tickets.mjs +1 -1
- package/actions/set-ticket-priority/set-ticket-priority.mjs +51 -0
- package/actions/set-ticket-status/set-ticket-status.mjs +53 -0
- package/actions/update-ticket/update-ticket.mjs +122 -0
- package/freshdesk.app.mjs +59 -0
- package/package.json +1 -1
- package/sources/new-contact/new-contact.mjs +1 -1
- package/sources/new-ticket/new-ticket.mjs +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import freshdesk from "../../freshdesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "freshdesk-assign-ticket-to-agent",
|
|
5
|
+
name: "Assign Ticket to Agent",
|
|
6
|
+
description: "Assign a Freshdesk ticket to a specific agent. [See the documentation](https://developers.freshdesk.com/api/#update_ticket).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
freshdesk,
|
|
11
|
+
ticketId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
freshdesk,
|
|
14
|
+
"ticketId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
responder_id: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
freshdesk,
|
|
20
|
+
"agentId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
|
|
26
|
+
const ticketName = await this.freshdesk.getTicketName(this.ticketId);
|
|
27
|
+
|
|
28
|
+
const response = await this.freshdesk._makeRequest({
|
|
29
|
+
$,
|
|
30
|
+
method: "PUT",
|
|
31
|
+
url: `/tickets/${this.ticketId}`,
|
|
32
|
+
data: {
|
|
33
|
+
responder_id: this.responder_id,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
$.export("$summary",
|
|
37
|
+
`Ticket "${ticketName}" (ID: ${this.ticketId}) assigned to agent ${this.responder_id}`);
|
|
38
|
+
|
|
39
|
+
return response;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import freshdesk from "../../freshdesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "freshdesk-assign-ticket-to-group",
|
|
5
|
+
name: "Assign Ticket to Group",
|
|
6
|
+
description: "Assign a Freshdesk ticket to a specific group [See the documentation](https://developers.freshdesk.com/api/#update_ticket).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
freshdesk,
|
|
11
|
+
ticketId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
freshdesk,
|
|
14
|
+
"ticketId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
group_id: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
freshdesk,
|
|
20
|
+
"groupId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
|
|
26
|
+
const ticketName = await this.freshdesk.getTicketName(this.ticketId);
|
|
27
|
+
|
|
28
|
+
const response = await this.freshdesk._makeRequest({
|
|
29
|
+
$,
|
|
30
|
+
method: "PUT",
|
|
31
|
+
url: `/tickets/${this.ticketId}`,
|
|
32
|
+
data: {
|
|
33
|
+
group_id: this.group_id,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
$.export("$summary",
|
|
38
|
+
`Ticket "${ticketName}" (ID: ${this.ticketId}) assigned to group ${this.group_id}`);
|
|
39
|
+
|
|
40
|
+
return response;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import freshdesk from "../../freshdesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "freshdesk-close-ticket",
|
|
5
|
+
name: "Close Ticket",
|
|
6
|
+
description: "Set a Freshdesk ticket's status to 'Closed'. [See docs](https://developers.freshdesk.com/api/#update_a_ticket)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
freshdesk,
|
|
11
|
+
ticketId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
freshdesk,
|
|
14
|
+
"ticketId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
async run({ $ }) {
|
|
19
|
+
const CLOSED_STATUS = 5; // Freshdesk status code for 'Closed'
|
|
20
|
+
|
|
21
|
+
const response = await this.freshdesk._makeRequest({
|
|
22
|
+
$,
|
|
23
|
+
method: "PUT",
|
|
24
|
+
url: `/tickets/${this.ticketId}`,
|
|
25
|
+
data: {
|
|
26
|
+
status: CLOSED_STATUS,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
$.export("$summary", `Ticket ${this.ticketId} closed successfully`);
|
|
31
|
+
return response;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "freshdesk-create-company",
|
|
5
5
|
name: "Create a Company",
|
|
6
6
|
description: "Create a company. [See the documentation](https://developers.freshdesk.com/api/#create_company)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.4",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
freshdesk,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "freshdesk-create-contact",
|
|
6
6
|
name: "Create a Contact",
|
|
7
7
|
description: "Create a contact. [See the documentation](https://developers.freshdesk.com/api/#create_contact)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.4",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
freshdesk,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "freshdesk-create-ticket",
|
|
5
5
|
name: "Create a Ticket",
|
|
6
6
|
description: "Create a ticket. [See the documentation](https://developers.freshdesk.com/api/#create_ticket)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.5",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
freshdesk,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "freshdesk-get-ticket",
|
|
5
5
|
name: "Get Ticket Details",
|
|
6
6
|
description: "Get details of a Ticket. [See the documentation](https://developers.freshdesk.com/api/#view_a_ticket)",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.2",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
freshdesk,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "List Tickets",
|
|
6
6
|
description:
|
|
7
7
|
"Fetch up to 100 tickets according to the selected filters. [See the documentation](https://developers.freshdesk.com/api/#list_all_tickets)",
|
|
8
|
-
version: "0.2.
|
|
8
|
+
version: "0.2.2",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
freshdesk,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import freshdesk from "../../freshdesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "freshdesk-set-ticket-priority",
|
|
5
|
+
name: "Set Ticket Priority",
|
|
6
|
+
description: "Update the priority of a ticket in Freshdesk [See the documentation](https://developers.freshdesk.com/api/#update_ticket).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
freshdesk,
|
|
11
|
+
ticketId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
freshdesk,
|
|
14
|
+
"ticketId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
ticketPriority: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
freshdesk,
|
|
20
|
+
"ticketPriority",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
|
|
26
|
+
const ticketName = await this.freshdesk.getTicketName(this.ticketId);
|
|
27
|
+
|
|
28
|
+
const response = await this.freshdesk._makeRequest({
|
|
29
|
+
$,
|
|
30
|
+
method: "PUT",
|
|
31
|
+
url: `/tickets/${this.ticketId}`,
|
|
32
|
+
data: {
|
|
33
|
+
priority: this.ticketPriority,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const priorityLabels = {
|
|
38
|
+
1: "Low",
|
|
39
|
+
2: "Medium",
|
|
40
|
+
3: "High",
|
|
41
|
+
4: "Urgent",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const priorityLabel = priorityLabels[this.ticketPriority] || this.ticketPriority;
|
|
45
|
+
|
|
46
|
+
$.export("$summary",
|
|
47
|
+
`Ticket ${ticketName} (ID: ${this.ticketId}) priority updated to "${priorityLabel}".`);
|
|
48
|
+
|
|
49
|
+
return response;
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import freshdesk from "../../freshdesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "freshdesk-set-ticket-status",
|
|
5
|
+
name: "Set Ticket Status",
|
|
6
|
+
description: "Update the status of a ticket in Freshdesk [See the documentation](https://developers.freshdesk.com/api/#update_ticket).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
freshdesk,
|
|
11
|
+
ticketId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
freshdesk,
|
|
14
|
+
"ticketId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
ticketStatus: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
freshdesk,
|
|
20
|
+
"ticketStatus",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
|
|
26
|
+
const ticketName = await this.freshdesk.getTicketName(this.ticketId);
|
|
27
|
+
|
|
28
|
+
const response = await this.freshdesk._makeRequest({
|
|
29
|
+
$,
|
|
30
|
+
method: "PUT",
|
|
31
|
+
url: `/tickets/${this.ticketId}`,
|
|
32
|
+
data: {
|
|
33
|
+
status: this.ticketStatus,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const statusLabels = {
|
|
38
|
+
2: "Open",
|
|
39
|
+
3: "Pending",
|
|
40
|
+
4: "Resolved",
|
|
41
|
+
5: "Closed",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const statusLabel = statusLabels[this.ticketStatus] || this.ticketStatus;
|
|
45
|
+
|
|
46
|
+
$.export(
|
|
47
|
+
"$summary",
|
|
48
|
+
`Ticket "${ticketName}" (ID: ${this.ticketId}) status updated to "${statusLabel}".`,
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
return response;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import freshdesk from "../../freshdesk.app.mjs";
|
|
2
|
+
import { removeNullEntries } from "../../common/utils.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "freshdesk-update-ticket",
|
|
6
|
+
name: "Update a Ticket",
|
|
7
|
+
description: "Update status, priority, subject, description, agent, group, etc. [See the documentation](https://developers.freshdesk.com/api/#update_ticket).",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
freshdesk,
|
|
12
|
+
ticketId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
freshdesk,
|
|
15
|
+
"ticketId",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
status: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
freshdesk,
|
|
21
|
+
"ticketStatus",
|
|
22
|
+
],
|
|
23
|
+
optional: true,
|
|
24
|
+
},
|
|
25
|
+
priority: {
|
|
26
|
+
propDefinition: [
|
|
27
|
+
freshdesk,
|
|
28
|
+
"ticketPriority",
|
|
29
|
+
],
|
|
30
|
+
optional: true,
|
|
31
|
+
},
|
|
32
|
+
subject: {
|
|
33
|
+
type: "string",
|
|
34
|
+
label: "Subject",
|
|
35
|
+
description: "Ticket subject",
|
|
36
|
+
optional: true,
|
|
37
|
+
},
|
|
38
|
+
description: {
|
|
39
|
+
type: "string",
|
|
40
|
+
label: "Description",
|
|
41
|
+
description: "Detailed ticket description (HTML allowed)",
|
|
42
|
+
optional: true,
|
|
43
|
+
},
|
|
44
|
+
group_id: {
|
|
45
|
+
propDefinition: [
|
|
46
|
+
freshdesk,
|
|
47
|
+
"groupId",
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
responder_id: {
|
|
51
|
+
propDefinition: [
|
|
52
|
+
freshdesk,
|
|
53
|
+
"agentId",
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
email: {
|
|
57
|
+
type: "string",
|
|
58
|
+
label: "Requester Email (replaces requester)",
|
|
59
|
+
description: "Updates the requester. If no contact with this email exists, a new one will be created and assigned to the ticket.",
|
|
60
|
+
optional: true,
|
|
61
|
+
},
|
|
62
|
+
phone: {
|
|
63
|
+
type: "string",
|
|
64
|
+
label: "Requester Phone (replaces requester)",
|
|
65
|
+
description: "If no contact with this phone number exists, a new one will be created. If used without email, 'name' is required.",
|
|
66
|
+
optional: true,
|
|
67
|
+
},
|
|
68
|
+
name: {
|
|
69
|
+
type: "string",
|
|
70
|
+
label: "Requester Name (required with phone if no email)",
|
|
71
|
+
description: "Used when creating a contact with phone but no email.",
|
|
72
|
+
optional: true,
|
|
73
|
+
},
|
|
74
|
+
type: {
|
|
75
|
+
type: "string",
|
|
76
|
+
label: "Type",
|
|
77
|
+
description: "Type of ticket (must match one of the allowed values)",
|
|
78
|
+
optional: true,
|
|
79
|
+
options: [
|
|
80
|
+
"Question",
|
|
81
|
+
"Incident",
|
|
82
|
+
"Problem",
|
|
83
|
+
"Feature Request",
|
|
84
|
+
"Refund",
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
custom_fields: {
|
|
88
|
+
type: "object",
|
|
89
|
+
label: "Custom Fields",
|
|
90
|
+
description: "Custom fields as key-value pairs (make sure types match your config)",
|
|
91
|
+
optional: true,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
async run({ $ }) {
|
|
95
|
+
const {
|
|
96
|
+
freshdesk,
|
|
97
|
+
ticketId,
|
|
98
|
+
...fields
|
|
99
|
+
} = this;
|
|
100
|
+
|
|
101
|
+
const data = removeNullEntries(fields);
|
|
102
|
+
|
|
103
|
+
const ticketName = await freshdesk.getTicketName(ticketId);
|
|
104
|
+
|
|
105
|
+
if (!Object.keys(data).length) {
|
|
106
|
+
throw new Error("Please provide at least one field to update.");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (data.custom_fields) freshdesk.parseIfJSONString(data.custom_fields);
|
|
110
|
+
|
|
111
|
+
const response = await freshdesk._makeRequest({
|
|
112
|
+
$,
|
|
113
|
+
method: "PUT",
|
|
114
|
+
url: `/tickets/${ticketId}`,
|
|
115
|
+
data,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
$.export("$summary", `Ticket "${ticketName}" (ID: ${this.ticketId}) updated successfully`);
|
|
119
|
+
return response;
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
package/freshdesk.app.mjs
CHANGED
|
@@ -19,6 +19,7 @@ export default {
|
|
|
19
19
|
}));
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
|
+
|
|
22
23
|
ticketId: {
|
|
23
24
|
type: "integer",
|
|
24
25
|
label: "Ticket ID",
|
|
@@ -37,6 +38,48 @@ export default {
|
|
|
37
38
|
}));
|
|
38
39
|
},
|
|
39
40
|
},
|
|
41
|
+
agentId: {
|
|
42
|
+
type: "integer",
|
|
43
|
+
label: "Agent",
|
|
44
|
+
description: "Select an agent to assign the ticket to",
|
|
45
|
+
async options({ page = 0 }) {
|
|
46
|
+
const response = await this._makeRequest({
|
|
47
|
+
method: "GET",
|
|
48
|
+
url: "/agents",
|
|
49
|
+
params: {
|
|
50
|
+
page: page + 1,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return response.map((agent) => ({
|
|
55
|
+
label: agent.contact?.name
|
|
56
|
+
? `${agent.contact.name} (${agent.contact.email || "No email"})`
|
|
57
|
+
: `Agent ${agent.id}`,
|
|
58
|
+
value: agent.id,
|
|
59
|
+
}));
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
groupId: {
|
|
63
|
+
type: "integer",
|
|
64
|
+
label: "Group",
|
|
65
|
+
description: "Select a group to assign the ticket to.",
|
|
66
|
+
async options({ page = 0 }) {
|
|
67
|
+
const groups = await this._makeRequest({
|
|
68
|
+
method: "GET",
|
|
69
|
+
url: "/groups",
|
|
70
|
+
params: {
|
|
71
|
+
page: page + 1,
|
|
72
|
+
per_page: 100,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return groups.map((group) => ({
|
|
77
|
+
label: group.name || `Group ${group.id}`,
|
|
78
|
+
value: group.id,
|
|
79
|
+
}));
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
|
|
40
83
|
ticketStatus: {
|
|
41
84
|
type: "integer",
|
|
42
85
|
label: "Status",
|
|
@@ -207,5 +250,21 @@ export default {
|
|
|
207
250
|
...args,
|
|
208
251
|
});
|
|
209
252
|
},
|
|
253
|
+
async getTicketName(ticketId) {
|
|
254
|
+
const ticket = await this.getTicket({
|
|
255
|
+
ticketId,
|
|
256
|
+
});
|
|
257
|
+
return ticket.subject;
|
|
258
|
+
},
|
|
259
|
+
parseIfJSONString(input) {
|
|
260
|
+
if (typeof input === "string") {
|
|
261
|
+
try {
|
|
262
|
+
return JSON.parse(input);
|
|
263
|
+
} catch (error) {
|
|
264
|
+
return input;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return input;
|
|
268
|
+
},
|
|
210
269
|
},
|
|
211
270
|
};
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "freshdesk-new-contact",
|
|
7
7
|
name: "New Contact Created",
|
|
8
8
|
description: "Emit new event when a contact is created. [See the documentation](https://developers.freshdesk.com/api/#filter_contacts)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.5",
|
|
10
10
|
type: "source",
|
|
11
11
|
props: {
|
|
12
12
|
freshdesk,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "freshdesk-new-ticket",
|
|
7
7
|
name: "New Ticket Created",
|
|
8
8
|
description: "Emit new event when a ticket is created. [See the documentation](https://developers.freshdesk.com/api/#filter_tickets)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.5",
|
|
10
10
|
type: "source",
|
|
11
11
|
props: {
|
|
12
12
|
freshdesk,
|