@pipedream/freshdesk 0.6.0 → 0.8.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 (45) hide show
  1. package/actions/add-note-to-ticket/add-note-to-ticket.mjs +1 -1
  2. package/actions/add-ticket-tags/add-ticket-tags.mjs +1 -1
  3. package/actions/assign-ticket-to-agent/assign-ticket-to-agent.mjs +1 -1
  4. package/actions/assign-ticket-to-group/assign-ticket-to-group.mjs +1 -1
  5. package/actions/close-ticket/close-ticket.mjs +1 -1
  6. package/actions/create-agent/create-agent.mjs +1 -1
  7. package/actions/create-company/create-company.mjs +1 -1
  8. package/actions/create-contact/create-contact.mjs +1 -1
  9. package/actions/create-message-for-thread/create-message-for-thread.mjs +66 -0
  10. package/actions/create-reply/create-reply.mjs +111 -0
  11. package/actions/create-solution-article/create-solution-article.mjs +1 -1
  12. package/actions/create-thread/create-thread.mjs +60 -0
  13. package/actions/create-ticket/create-ticket.mjs +1 -1
  14. package/actions/create-ticket-field/create-ticket-field.mjs +1 -1
  15. package/actions/delete-solution-article/delete-solution-article.mjs +1 -1
  16. package/actions/download-attachment/download-attachment.mjs +1 -1
  17. package/actions/get-canned-response/get-canned-response.mjs +44 -0
  18. package/actions/get-contact/get-contact.mjs +1 -1
  19. package/actions/get-folder-canned-responses/get-folder-canned-responses.mjs +43 -0
  20. package/actions/get-solution-article/get-solution-article.mjs +1 -1
  21. package/actions/get-ticket/get-ticket.mjs +1 -1
  22. package/actions/list-agents/list-agents.mjs +1 -1
  23. package/actions/list-all-folders/list-all-folders.mjs +35 -0
  24. package/actions/list-all-tickets/list-all-tickets.mjs +1 -1
  25. package/actions/list-category-folders/list-category-folders.mjs +1 -1
  26. package/actions/list-folder-articles/list-folder-articles.mjs +1 -1
  27. package/actions/list-folder-canned-responses/list-folder-canned-responses.mjs +36 -0
  28. package/actions/list-solution-categories/list-solution-categories.mjs +1 -1
  29. package/actions/list-ticket-conversations/list-ticket-conversations.mjs +1 -1
  30. package/actions/list-ticket-fields/list-ticket-fields.mjs +1 -1
  31. package/actions/remove-ticket-tags/remove-ticket-tags.mjs +1 -1
  32. package/actions/set-ticket-priority/set-ticket-priority.mjs +1 -1
  33. package/actions/set-ticket-status/set-ticket-status.mjs +1 -1
  34. package/actions/set-ticket-tags/set-ticket-tags.mjs +1 -1
  35. package/actions/update-agent/update-agent.mjs +1 -1
  36. package/actions/update-contact/update-contact.mjs +1 -1
  37. package/actions/update-solution-article/update-solution-article.mjs +1 -1
  38. package/actions/update-ticket/update-ticket.mjs +1 -1
  39. package/actions/update-ticket-field/update-ticket-field.mjs +1 -1
  40. package/freshdesk.app.mjs +167 -35
  41. package/package.json +2 -2
  42. package/sources/contact-updated/contact-updated.mjs +1 -1
  43. package/sources/new-contact/new-contact.mjs +1 -1
  44. package/sources/new-ticket/new-ticket.mjs +1 -1
  45. package/sources/ticket-updated/ticket-updated.mjs +1 -1
@@ -5,7 +5,7 @@ export default {
5
5
  key: "freshdesk-add-note-to-ticket",
6
6
  name: "Add Note to Ticket",
7
7
  description: "Add a note or conversation to an existing ticket. [See the documentation](https://developers.freshdesk.com/api/#add_note_to_a_ticket).",
8
- version: "0.0.3",
8
+ version: "0.0.5",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "Add Ticket Tags",
7
7
  description: "Add tags to a ticket (appends to existing tags). [See the documentation](https://developers.freshdesk.com/api/#update_ticket)",
8
8
  type: "action",
9
- version: "0.0.4",
9
+ version: "0.0.6",
10
10
  annotations: {
11
11
  destructiveHint: true,
12
12
  openWorldHint: true,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-assign-ticket-to-agent",
5
5
  name: "Assign Ticket to Agent",
6
6
  description: "Assign a Freshdesk ticket to a specific agent. [See the documentation](https://developers.freshdesk.com/api/#update_ticket).",
7
- version: "0.0.5",
7
+ version: "0.0.7",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-assign-ticket-to-group",
5
5
  name: "Assign Ticket to Group",
6
6
  description: "Assign a Freshdesk ticket to a specific group [See the documentation](https://developers.freshdesk.com/api/#update_ticket).",
7
- version: "0.0.5",
7
+ version: "0.0.7",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-close-ticket",
5
5
  name: "Close Ticket",
6
6
  description: "Set a Freshdesk ticket's status to 'Closed'. [See docs](https://developers.freshdesk.com/api/#update_a_ticket)",
7
- version: "0.0.5",
7
+ version: "0.0.7",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "freshdesk-create-agent",
6
6
  name: "Create Agent",
7
7
  description: "Create an agent in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#create_agent)",
8
- version: "0.0.2",
8
+ version: "0.0.4",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -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.8",
7
+ version: "0.0.10",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -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",
8
+ version: "0.0.10",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -0,0 +1,66 @@
1
+ import { parseObject } from "../../common/utils.mjs";
2
+ import freshdesk from "../../freshdesk.app.mjs";
3
+
4
+ export default {
5
+ key: "freshdesk-create-message-for-thread",
6
+ name: "Create Message For Thread",
7
+ description: "Create message for a thread. [See the documentation](https://developers.freshdesk.com/api/#create_message_for_thread).",
8
+ version: "0.0.2",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: false,
13
+ },
14
+ type: "action",
15
+ props: {
16
+ freshdesk,
17
+ ticketId: {
18
+ propDefinition: [
19
+ freshdesk,
20
+ "ticketId",
21
+ ],
22
+ label: "Ticket ID",
23
+ description: "ID of the ticket to create the message for.",
24
+ },
25
+ threadId: {
26
+ propDefinition: [
27
+ freshdesk,
28
+ "threadId",
29
+ ({ ticketId }) => ({
30
+ ticketId,
31
+ }),
32
+ ],
33
+ label: "Thread ID",
34
+ description: "ID of the thread to create the message for.",
35
+ },
36
+ body: {
37
+ type: "string",
38
+ label: "Body",
39
+ description: "Content of the note in HTML format.",
40
+ optional: true,
41
+ },
42
+ participants: {
43
+ type: "string[]",
44
+ label: "Participants",
45
+ description: "List of the participants to be added to the message.",
46
+ optional: true,
47
+ },
48
+ },
49
+ async run({ $ }) {
50
+ const response = await this.freshdesk.createMessageForThread({
51
+ $,
52
+ data: {
53
+ body: this.body,
54
+ participants: {
55
+ email: {
56
+ to: parseObject(this.participants),
57
+ },
58
+ },
59
+ thread_id: this.threadId,
60
+ },
61
+ });
62
+
63
+ $.export("$summary", `Message created successfully with ID: ${response.id}`);
64
+ return response;
65
+ },
66
+ };
@@ -0,0 +1,111 @@
1
+ import { getFileStreamAndMetadata } from "@pipedream/platform";
2
+ import FormData from "form-data";
3
+ import { parseObject } from "../../common/utils.mjs";
4
+ import freshdesk from "../../freshdesk.app.mjs";
5
+
6
+ export default {
7
+ key: "freshdesk-create-reply",
8
+ name: "Create a Reply",
9
+ description: "Create a reply to a ticket. [See the documentation](https://developers.freshdesk.com/api/#reply_ticket).",
10
+ version: "0.0.2",
11
+ annotations: {
12
+ destructiveHint: false,
13
+ openWorldHint: true,
14
+ readOnlyHint: false,
15
+ },
16
+ type: "action",
17
+ props: {
18
+ freshdesk,
19
+ ticketId: {
20
+ propDefinition: [
21
+ freshdesk,
22
+ "ticketId",
23
+ ],
24
+ },
25
+ body: {
26
+ type: "string",
27
+ label: "Body",
28
+ description: "Content of the note in HTML format.",
29
+ },
30
+ attachments: {
31
+ type: "string[]",
32
+ label: "Attachments",
33
+ description: "The total size of all the ticket's attachments (not just this note) cannot exceed 20MB.",
34
+ optional: true,
35
+ },
36
+ fromEmail: {
37
+ propDefinition: [
38
+ freshdesk,
39
+ "fromEmail",
40
+ ],
41
+ optional: true,
42
+ },
43
+ userId: {
44
+ propDefinition: [
45
+ freshdesk,
46
+ "agentId",
47
+ ],
48
+ label: "User ID",
49
+ description: "ID of the agent who is adding the note.",
50
+ optional: true,
51
+ },
52
+ ccEmails: {
53
+ type: "string[]",
54
+ label: "CC Emails",
55
+ description: "Email address added in the 'cc' field of the outgoing ticket email.",
56
+ optional: true,
57
+ },
58
+ bccEmails: {
59
+ type: "string[]",
60
+ label: "BCC Emails",
61
+ description: "Email address added in the 'bcc' field of the outgoing ticket email.",
62
+ optional: true,
63
+ },
64
+ },
65
+ async run({ $ }) {
66
+ const formData = new FormData();
67
+ formData.append("body", this.body);
68
+
69
+ if (this.fromEmail) {
70
+ formData.append("from_email", this.fromEmail.label);
71
+ }
72
+ if (this.userId) {
73
+ formData.append("user_id", this.userId);
74
+ }
75
+ const parsedCcEmails = parseObject(this.ccEmails);
76
+ if (parsedCcEmails) {
77
+ parsedCcEmails.forEach((ccEmail) => {
78
+ formData.append("cc_emails[]", ccEmail);
79
+ });
80
+ }
81
+ const parsedBccEmails = parseObject(this.bccEmails);
82
+ if (parsedBccEmails) {
83
+ parsedBccEmails.forEach((bccEmail) => {
84
+ formData.append("bcc_emails[]", bccEmail);
85
+ });
86
+ }
87
+
88
+ const parsedAttachments = parseObject(this.attachments);
89
+ if (parsedAttachments) {
90
+ for (const attachment of parsedAttachments) {
91
+ const {
92
+ stream, metadata,
93
+ } = await getFileStreamAndMetadata(attachment);
94
+ formData.append("attachments[]", stream, {
95
+ contentType: metadata.contentType,
96
+ knownLength: metadata.size,
97
+ filename: metadata.name,
98
+ });
99
+ };
100
+ }
101
+ const response = await this.freshdesk.createReply({
102
+ $,
103
+ ticketId: this.ticketId,
104
+ data: formData,
105
+ headers: formData.getHeaders(),
106
+ });
107
+
108
+ $.export("$summary", `Reply created successfully with ID: ${response.id}`);
109
+ return response;
110
+ },
111
+ };
@@ -6,7 +6,7 @@ export default {
6
6
  key: "freshdesk-create-solution-article",
7
7
  name: "Create Solution Article",
8
8
  description: "Create a solution article in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_article_attributes)",
9
- version: "0.0.2",
9
+ version: "0.0.4",
10
10
  annotations: {
11
11
  destructiveHint: false,
12
12
  openWorldHint: true,
@@ -0,0 +1,60 @@
1
+ import freshdesk from "../../freshdesk.app.mjs";
2
+
3
+ export default {
4
+ key: "freshdesk-create-thread",
5
+ name: "Create a Thread",
6
+ description: "Create a thread to a ticket. [See the documentation](https://developers.freshdesk.com/api/#create_a_thread).",
7
+ version: "0.0.2",
8
+ annotations: {
9
+ destructiveHint: false,
10
+ openWorldHint: true,
11
+ readOnlyHint: false,
12
+ },
13
+ type: "action",
14
+ props: {
15
+ freshdesk,
16
+ type: {
17
+ type: "string",
18
+ label: "Type",
19
+ description: "Type of the thread.",
20
+ options: [
21
+ "forward",
22
+ "discussion",
23
+ ],
24
+ },
25
+ ticketId: {
26
+ propDefinition: [
27
+ freshdesk,
28
+ "ticketId",
29
+ ],
30
+ label: "Parent ID",
31
+ description: "The ID of the ticket to create the thread for.",
32
+ },
33
+ emailConfigId: {
34
+ propDefinition: [
35
+ freshdesk,
36
+ "fromEmail",
37
+ ],
38
+ label: "Email Config ID",
39
+ description: "The ID of the email config to use for the thread.",
40
+ },
41
+ },
42
+ async run({ $ }) {
43
+ const response = await this.freshdesk.createThread({
44
+ $,
45
+ data: {
46
+ type: this.type,
47
+ parent: {
48
+ id: this.ticketId,
49
+ type: "ticket",
50
+ },
51
+ additional_info: {
52
+ email_config_id: this.emailConfigId.value,
53
+ },
54
+ },
55
+ });
56
+
57
+ $.export("$summary", `Thread created successfully with ID: ${response.id}`);
58
+ return response;
59
+ },
60
+ };
@@ -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.9",
7
+ version: "0.0.11",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "freshdesk-create-ticket-field",
7
7
  name: "Create Ticket Field",
8
8
  description: "Create a ticket field in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#create_ticket_field)",
9
- version: "0.0.2",
9
+ version: "0.0.4",
10
10
  annotations: {
11
11
  destructiveHint: false,
12
12
  openWorldHint: true,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-delete-solution-article",
5
5
  name: "Delete Solution Article",
6
6
  description: "Delete a solution article in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_article_attributes)",
7
- version: "0.0.2",
7
+ version: "0.0.4",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "freshdesk-download-attachment",
7
7
  name: "Download Attachment",
8
8
  description: "Download an attachment from a ticket. [See the documentation](https://developers.freshdesk.com/api/#view_a_ticket)",
9
- version: "0.0.2",
9
+ version: "0.0.4",
10
10
  type: "action",
11
11
  annotations: {
12
12
  destructiveHint: false,
@@ -0,0 +1,44 @@
1
+ import freshdesk from "../../freshdesk.app.mjs";
2
+
3
+ export default {
4
+ key: "freshdesk-get-canned-response",
5
+ name: "Get Canned Response",
6
+ description: "View a Canned Response. [See the documentation](https://developers.freshdesk.com/api/#view_a_canned_response)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ props: {
15
+ freshdesk,
16
+ cannedResponseFolderId: {
17
+ propDefinition: [
18
+ freshdesk,
19
+ "cannedResponseFolderId",
20
+ ],
21
+ },
22
+ cannedResponseId: {
23
+ propDefinition: [
24
+ freshdesk,
25
+ "cannedResponseId",
26
+ ({ cannedResponseFolderId }) => ({
27
+ cannedResponseFolderId,
28
+ }),
29
+ ],
30
+ },
31
+ },
32
+ async run({ $ }) {
33
+ const {
34
+ freshdesk,
35
+ cannedResponseId,
36
+ } = this;
37
+ const response = await freshdesk.getCannedResponse({
38
+ $,
39
+ cannedResponseId,
40
+ });
41
+ $.export("$summary", `Successfully retrieved canned response with ID \`${response.id}\``);
42
+ return response;
43
+ },
44
+ };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-get-contact",
5
5
  name: "Get Contact",
6
6
  description: "Get a contact from Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#view_contact)",
7
- version: "0.0.2",
7
+ version: "0.0.4",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -0,0 +1,43 @@
1
+ import freshdesk from "../../freshdesk.app.mjs";
2
+
3
+ export default {
4
+ key: "freshdesk-get-folder-canned-responses",
5
+ name: "Get Canned Responses In A Folder",
6
+ description: "View all the details of canned responses in a folder. [See the documentation](https://developers.freshdesk.com/api/#get_details_of_canned_responses_in_a_folder)",
7
+ version: "0.0.1",
8
+ annotations: {
9
+ destructiveHint: false,
10
+ openWorldHint: true,
11
+ readOnlyHint: true,
12
+ },
13
+ type: "action",
14
+ props: {
15
+ freshdesk,
16
+ cannedResponseFolderId: {
17
+ propDefinition: [
18
+ freshdesk,
19
+ "cannedResponseFolderId",
20
+ ],
21
+ },
22
+ maxResults: {
23
+ propDefinition: [
24
+ freshdesk,
25
+ "maxResults",
26
+ ],
27
+ },
28
+ },
29
+ async run({ $ }) {
30
+ const {
31
+ freshdesk, cannedResponseFolderId, maxResults,
32
+ } = this;
33
+ const responses = await freshdesk.getPaginatedResources({
34
+ fn: freshdesk.getFolderCannedResponses,
35
+ max: maxResults,
36
+ args: {
37
+ folderId: cannedResponseFolderId,
38
+ },
39
+ });
40
+ $.export("$summary", `Successfully retrieved \`${responses.length}\` canned response(s) from folder`);
41
+ return responses;
42
+ },
43
+ };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-get-solution-article",
5
5
  name: "Get Solution Article",
6
6
  description: "Get a solution article in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_article_attributes)",
7
- version: "0.0.2",
7
+ version: "0.0.4",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -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",
7
+ version: "0.1.9",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-list-agents",
5
5
  name: "List Agents",
6
6
  description: "List all agents in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#list_all_agents)",
7
- version: "0.0.2",
7
+ version: "0.0.4",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -0,0 +1,35 @@
1
+ import freshdesk from "../../freshdesk.app.mjs";
2
+
3
+ export default {
4
+ key: "freshdesk-list-all-folders",
5
+ name: "List All Folders",
6
+ description: "View all the canned response folders. [See the documentation](https://developers.freshdesk.com/api/#list_all_canned_response_folders)",
7
+ version: "0.0.1",
8
+ annotations: {
9
+ destructiveHint: false,
10
+ openWorldHint: true,
11
+ readOnlyHint: true,
12
+ },
13
+ type: "action",
14
+ props: {
15
+ freshdesk,
16
+ maxResults: {
17
+ propDefinition: [
18
+ freshdesk,
19
+ "maxResults",
20
+ ],
21
+ },
22
+ },
23
+ async run({ $ }) {
24
+ const {
25
+ freshdesk, maxResults,
26
+ } = this;
27
+ const folders = await freshdesk.getPaginatedResources({
28
+ fn: freshdesk.listCannedResponseFolders,
29
+ max: maxResults,
30
+ args: {},
31
+ });
32
+ $.export("$summary", `Successfully retrieved \`${folders.length}\` folder(s)`);
33
+ return folders;
34
+ },
35
+ };
@@ -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.6",
8
+ version: "0.2.8",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-list-category-folders",
5
5
  name: "List Category Folders",
6
6
  description: "List category folders in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_folder_attributes)",
7
- version: "0.0.2",
7
+ version: "0.0.4",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-list-folder-articles",
5
5
  name: "List Folder Articles",
6
6
  description: "List folder articles in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_article_attributes)",
7
- version: "0.0.2",
7
+ version: "0.0.4",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -0,0 +1,36 @@
1
+ import freshdesk from "../../freshdesk.app.mjs";
2
+
3
+ export default {
4
+ key: "freshdesk-list-folder-canned-responses",
5
+ name: "List All Canned Responses In A Folder",
6
+ description: "View all canned responses in a folder. [See the documentation](https://developers.freshdesk.com/api/#list_all_canned_responses_in_a_folder)",
7
+ version: "0.0.1",
8
+ annotations: {
9
+ destructiveHint: false,
10
+ openWorldHint: true,
11
+ readOnlyHint: true,
12
+ },
13
+ type: "action",
14
+ props: {
15
+ freshdesk,
16
+ cannedResponseFolderId: {
17
+ propDefinition: [
18
+ freshdesk,
19
+ "cannedResponseFolderId",
20
+ ],
21
+ },
22
+ },
23
+ async run({ $ }) {
24
+ const {
25
+ freshdesk,
26
+ cannedResponseFolderId,
27
+ } = this;
28
+ const response = await freshdesk.listCannedResponses({
29
+ $,
30
+ cannedResponseFolderId,
31
+ });
32
+ const responseCount = response?.canned_responses?.length || 0;
33
+ $.export("$summary", `Successfully retrieved \`${responseCount}\` canned response(s) from folder`);
34
+ return response;
35
+ },
36
+ };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-list-solution-categories",
5
5
  name: "List Solution Categories",
6
6
  description: "List solution categories in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_category_attributes)",
7
- version: "0.0.2",
7
+ version: "0.0.4",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-list-ticket-conversations",
5
5
  name: "List Conversations of a Ticket",
6
6
  description: "List all conversations for a ticket. [See the documentation](https://developers.freshdesk.com/api/#list_all_ticket_notes)",
7
- version: "0.0.1",
7
+ version: "0.0.3",
8
8
  type: "action",
9
9
  annotations: {
10
10
  destructiveHint: false,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-list-ticket-fields",
5
5
  name: "List Ticket Fields",
6
6
  description: "List all ticket fields in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#list_all_ticket_fields)",
7
- version: "0.0.2",
7
+ version: "0.0.4",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "Remove Ticket Tags",
7
7
  description: "Remove specific tags from a ticket. [See the documentation](https://developers.freshdesk.com/api/#update_ticket)",
8
8
  type: "action",
9
- version: "0.0.4",
9
+ version: "0.0.6",
10
10
  annotations: {
11
11
  destructiveHint: true,
12
12
  openWorldHint: true,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-set-ticket-priority",
5
5
  name: "Set Ticket Priority",
6
6
  description: "Update the priority of a ticket in Freshdesk [See the documentation](https://developers.freshdesk.com/api/#update_ticket).",
7
- version: "0.0.5",
7
+ version: "0.0.7",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-set-ticket-status",
5
5
  name: "Set Ticket Status",
6
6
  description: "Update the status of a ticket in Freshdesk [See the documentation](https://developers.freshdesk.com/api/#update_ticket).",
7
- version: "0.0.5",
7
+ version: "0.0.7",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -6,7 +6,7 @@ export default {
6
6
  name: "Set Ticket Tags",
7
7
  description: "Set tags on a ticket (replaces all existing tags). [See the documentation](https://developers.freshdesk.com/api/#update_ticket)",
8
8
  type: "action",
9
- version: "0.0.4",
9
+ version: "0.0.6",
10
10
  annotations: {
11
11
  destructiveHint: true,
12
12
  openWorldHint: true,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "freshdesk-update-agent",
6
6
  name: "Update Agent",
7
7
  description: "Update an agent in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#update_agent)",
8
- version: "0.0.2",
8
+ version: "0.0.4",
9
9
  annotations: {
10
10
  destructiveHint: true,
11
11
  openWorldHint: true,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "freshdesk-update-contact",
5
5
  name: "Update Contact",
6
6
  description: "Update a contact in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#update_contact)",
7
- version: "0.0.2",
7
+ version: "0.0.4",
8
8
  annotations: {
9
9
  destructiveHint: true,
10
10
  openWorldHint: true,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "freshdesk-update-solution-article",
7
7
  name: "Update Solution Article",
8
8
  description: "Update a solution article in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_article_attributes)",
9
- version: "0.0.2",
9
+ version: "0.0.4",
10
10
  annotations: {
11
11
  destructiveHint: true,
12
12
  openWorldHint: true,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "freshdesk-update-ticket",
6
6
  name: "Update a Ticket",
7
7
  description: "Update status, priority, subject, description, agent, group, etc. [See the documentation](https://developers.freshdesk.com/api/#update_ticket).",
8
- version: "0.0.5",
8
+ version: "0.0.7",
9
9
  annotations: {
10
10
  destructiveHint: true,
11
11
  openWorldHint: true,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "freshdesk-update-ticket-field",
6
6
  name: "Update Ticket Field",
7
7
  description: "Update a ticket field in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#update_ticket_field)",
8
- version: "0.0.2",
8
+ version: "0.0.4",
9
9
  annotations: {
10
10
  destructiveHint: true,
11
11
  openWorldHint: true,
package/freshdesk.app.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import constants from "./common/constants.mjs";
2
1
  import { axios } from "@pipedream/platform";
2
+ import constants from "./common/constants.mjs";
3
3
 
4
4
  export default {
5
5
  type: "app",
@@ -252,6 +252,75 @@ export default {
252
252
  description: "Array of tags to apply to the ticket. Each tag must be 32 characters or less.",
253
253
  optional: true,
254
254
  },
255
+ fromEmail: {
256
+ type: "string",
257
+ label: "From Email",
258
+ description: "The email address from which the reply is sent. By default the global support email will be used.",
259
+ withLabel: true,
260
+ async options() {
261
+ const response = await this.listEmailConfigs();
262
+ return response.map(({
263
+ id, to_email: email,
264
+ }) => ({
265
+ label: email,
266
+ value: id,
267
+ }));
268
+ },
269
+ },
270
+ threadId: {
271
+ type: "string",
272
+ label: "Thread ID",
273
+ description: "ID of the thread to create the message for.",
274
+ async options({ ticketId }) {
275
+ const { threads } = await this.listThreads({
276
+ params: {
277
+ parent_id: ticketId,
278
+ parent_type: "ticket",
279
+ },
280
+ });
281
+ return threads.map(({ id }) => id);
282
+ },
283
+ },
284
+ cannedResponseFolderId: {
285
+ type: "integer",
286
+ label: "Canned Response Folder ID",
287
+ description: "The ID of a canned response folder",
288
+ async options({ page = 0 }) {
289
+ const folders = await this.listCannedResponseFolders({
290
+ params: {
291
+ page: page + 1,
292
+ },
293
+ });
294
+ return folders.map(({
295
+ id, name,
296
+ }) => ({
297
+ label: name || id,
298
+ value: id,
299
+ }));
300
+ },
301
+ },
302
+ cannedResponseId: {
303
+ type: "integer",
304
+ label: "Canned Response ID",
305
+ description: "The ID of a canned response",
306
+ async options({
307
+ page = 0,
308
+ cannedResponseFolderId,
309
+ }) {
310
+ const { canned_responses: responses } = await this.listCannedResponses({
311
+ cannedResponseFolderId,
312
+ params: {
313
+ page: page + 1,
314
+ },
315
+ });
316
+ return responses.map(({
317
+ id, title,
318
+ }) => ({
319
+ label: title || id,
320
+ value: id,
321
+ }));
322
+ },
323
+ },
255
324
  },
256
325
  methods: {
257
326
  setLastDateChecked(db, value) {
@@ -263,10 +332,11 @@ export default {
263
332
  base64Encode(data) {
264
333
  return Buffer.from(data).toString("base64");
265
334
  },
266
- _getHeaders() {
335
+ _getHeaders(headers = {}) {
267
336
  return {
268
337
  "Authorization": "Basic " + this.base64Encode(this.$auth.api_key + ":X"),
269
338
  "Content-Type": "application/json;charset=utf-8",
339
+ ...headers,
270
340
  };
271
341
  },
272
342
  _getDomain() {
@@ -275,15 +345,12 @@ export default {
275
345
  ? domain
276
346
  : `${domain}.freshdesk.com`;
277
347
  },
278
- async _makeRequest({
348
+ _makeRequest({
279
349
  $ = this, headers, ...args
280
350
  }) {
281
351
  return axios($, {
282
352
  baseURL: `https://${this._getDomain()}/api/v2`,
283
- headers: {
284
- ...this._getHeaders(),
285
- ...headers,
286
- },
353
+ headers: this._getHeaders(headers),
287
354
  ...args,
288
355
  });
289
356
  },
@@ -327,20 +394,20 @@ export default {
327
394
  params.page += 1;
328
395
  } while (true);
329
396
  },
330
- async createCompany(args) {
397
+ createCompany(args) {
331
398
  return this._makeRequest({
332
399
  url: "/companies",
333
400
  method: "post",
334
401
  ...args,
335
402
  });
336
403
  },
337
- async getCompanies(args) {
404
+ getCompanies(args) {
338
405
  return this._makeRequest({
339
406
  url: "/companies",
340
407
  ...args,
341
408
  });
342
409
  },
343
- async getContact({
410
+ getContact({
344
411
  contactId, ...args
345
412
  }) {
346
413
  return this._makeRequest({
@@ -348,20 +415,20 @@ export default {
348
415
  ...args,
349
416
  });
350
417
  },
351
- async getContacts(args) {
418
+ getContacts(args) {
352
419
  return this._makeRequest({
353
420
  url: "/contacts",
354
421
  ...args,
355
422
  });
356
423
  },
357
- async createContact(args) {
424
+ createContact(args) {
358
425
  return this._makeRequest({
359
426
  url: "/contacts",
360
427
  method: "post",
361
428
  ...args,
362
429
  });
363
430
  },
364
- async updateContact({
431
+ updateContact({
365
432
  contactId, ...args
366
433
  }) {
367
434
  return this._makeRequest({
@@ -370,14 +437,14 @@ export default {
370
437
  ...args,
371
438
  });
372
439
  },
373
- async createTicket(args) {
440
+ createTicket(args) {
374
441
  return this._makeRequest({
375
442
  url: "/tickets",
376
443
  method: "post",
377
444
  ...args,
378
445
  });
379
446
  },
380
- async getTicket({
447
+ getTicket({
381
448
  ticketId, ...args
382
449
  }) {
383
450
  return this._makeRequest({
@@ -385,32 +452,32 @@ export default {
385
452
  ...args,
386
453
  });
387
454
  },
388
- async searchTickets(args) {
455
+ searchTickets(args) {
389
456
  return this._makeRequest({
390
457
  url: "/search/tickets",
391
458
  ...args,
392
459
  });
393
460
  },
394
- async searchContacts(args) {
461
+ searchContacts(args) {
395
462
  return this._makeRequest({
396
463
  url: "/search/contacts",
397
464
  ...args,
398
465
  });
399
466
  },
400
- async listTicketFields(args) {
467
+ listTicketFields(args) {
401
468
  return this._makeRequest({
402
469
  url: "/ticket_fields",
403
470
  ...args,
404
471
  });
405
472
  },
406
- async createTicketField(args) {
473
+ createTicketField(args) {
407
474
  return this._makeRequest({
408
475
  url: "/admin/ticket_fields",
409
476
  method: "post",
410
477
  ...args,
411
478
  });
412
479
  },
413
- async updateTicketField({
480
+ updateTicketField({
414
481
  ticketFieldId, ...args
415
482
  }) {
416
483
  return this._makeRequest({
@@ -419,20 +486,20 @@ export default {
419
486
  ...args,
420
487
  });
421
488
  },
422
- async listAgents(args) {
489
+ listAgents(args) {
423
490
  return this._makeRequest({
424
491
  url: "/agents",
425
492
  ...args,
426
493
  });
427
494
  },
428
- async createAgent(args) {
495
+ createAgent(args) {
429
496
  return this._makeRequest({
430
497
  url: "/agents",
431
498
  method: "post",
432
499
  ...args,
433
500
  });
434
501
  },
435
- async updateAgent({
502
+ updateAgent({
436
503
  agentId, ...args
437
504
  }) {
438
505
  return this._makeRequest({
@@ -441,25 +508,25 @@ export default {
441
508
  ...args,
442
509
  });
443
510
  },
444
- async listSkills(args) {
511
+ listSkills(args) {
445
512
  return this._makeRequest({
446
513
  url: "/admin/skills",
447
514
  ...args,
448
515
  });
449
516
  },
450
- async listRoles(args) {
517
+ listRoles(args) {
451
518
  return this._makeRequest({
452
519
  url: "/roles",
453
520
  ...args,
454
521
  });
455
522
  },
456
- async listSolutionCategories(args) {
523
+ listSolutionCategories(args) {
457
524
  return this._makeRequest({
458
525
  url: "/solutions/categories",
459
526
  ...args,
460
527
  });
461
528
  },
462
- async listCategoryFolders({
529
+ listCategoryFolders({
463
530
  categoryId, ...args
464
531
  }) {
465
532
  return this._makeRequest({
@@ -467,7 +534,7 @@ export default {
467
534
  ...args,
468
535
  });
469
536
  },
470
- async listFolderArticles({
537
+ listFolderArticles({
471
538
  folderId, ...args
472
539
  }) {
473
540
  return this._makeRequest({
@@ -475,7 +542,7 @@ export default {
475
542
  ...args,
476
543
  });
477
544
  },
478
- async getArticle({
545
+ getArticle({
479
546
  articleId, ...args
480
547
  }) {
481
548
  return this._makeRequest({
@@ -483,7 +550,7 @@ export default {
483
550
  ...args,
484
551
  });
485
552
  },
486
- async createArticle({
553
+ createArticle({
487
554
  folderId, ...args
488
555
  }) {
489
556
  return this._makeRequest({
@@ -492,7 +559,7 @@ export default {
492
559
  ...args,
493
560
  });
494
561
  },
495
- async updateArticle({
562
+ updateArticle({
496
563
  articleId, ...args
497
564
  }) {
498
565
  return this._makeRequest({
@@ -501,7 +568,7 @@ export default {
501
568
  ...args,
502
569
  });
503
570
  },
504
- async deleteArticle({
571
+ deleteArticle({
505
572
  articleId, ...args
506
573
  }) {
507
574
  return this._makeRequest({
@@ -510,7 +577,7 @@ export default {
510
577
  ...args,
511
578
  });
512
579
  },
513
- async listTickets(args) {
580
+ listTickets(args) {
514
581
  return this._makeRequest({
515
582
  url: "/tickets",
516
583
  ...args,
@@ -552,7 +619,7 @@ export default {
552
619
  * @param {...*} args - Additional arguments passed to _makeRequest
553
620
  * @returns {Promise<Object>} The API response containing the created note
554
621
  */
555
- async addNoteToTicket({
622
+ addNoteToTicket({
556
623
  ticketId, data, ...args
557
624
  }) {
558
625
  return this._makeRequest({
@@ -569,7 +636,7 @@ export default {
569
636
  * @param {string[]} args.tags - Array of tags to set
570
637
  * @returns {Promise<object>} API response
571
638
  */
572
- async setTicketTags({
639
+ setTicketTags({
573
640
  ticketId, tags, ...args
574
641
  }) {
575
642
  return this._makeRequest({
@@ -669,5 +736,70 @@ export default {
669
736
  }
670
737
  return results;
671
738
  },
739
+ createReply({
740
+ ticketId, ...args
741
+ }) {
742
+ return this._makeRequest({
743
+ method: "POST",
744
+ url: `/tickets/${ticketId}/reply`,
745
+ ...args,
746
+ });
747
+ },
748
+ listEmailConfigs(args) {
749
+ return this._makeRequest({
750
+ url: "/email_configs",
751
+ ...args,
752
+ });
753
+ },
754
+ createThread(args = {}) {
755
+ return this._makeRequest({
756
+ method: "POST",
757
+ url: "/collaboration/threads",
758
+ ...args,
759
+ });
760
+ },
761
+ listThreads(args) {
762
+ return this._makeRequest({
763
+ url: "/collaboration/threads",
764
+ ...args,
765
+ });
766
+ },
767
+ createMessageForThread(args = {}) {
768
+ return this._makeRequest({
769
+ method: "POST",
770
+ url: "/collaboration/messages",
771
+ ...args,
772
+ });
773
+ },
774
+ listCannedResponseFolders(args) {
775
+ return this._makeRequest({
776
+ url: "/canned_response_folders",
777
+ ...args,
778
+ });
779
+ },
780
+ listCannedResponses({
781
+ cannedResponseFolderId, ...args
782
+ }) {
783
+ return this._makeRequest({
784
+ url: `/canned_response_folders/${cannedResponseFolderId}`,
785
+ ...args,
786
+ });
787
+ },
788
+ getCannedResponse({
789
+ cannedResponseId, ...args
790
+ }) {
791
+ return this._makeRequest({
792
+ url: `/canned_responses/${cannedResponseId}`,
793
+ ...args,
794
+ });
795
+ },
796
+ getFolderCannedResponses({
797
+ folderId, ...args
798
+ }) {
799
+ return this._makeRequest({
800
+ url: `/canned_response_folders/${folderId}/responses`,
801
+ ...args,
802
+ });
803
+ },
672
804
  },
673
805
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/freshdesk",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Pipedream Freshdesk Components",
5
5
  "main": "freshdesk.app.mjs",
6
6
  "keywords": [
@@ -13,7 +13,7 @@
13
13
  "access": "public"
14
14
  },
15
15
  "dependencies": {
16
- "@pipedream/platform": "^3.0.3",
16
+ "@pipedream/platform": "^3.1.1",
17
17
  "async-retry": "^1.3.3",
18
18
  "moment": "2.29.4"
19
19
  }
@@ -5,7 +5,7 @@ export default {
5
5
  key: "freshdesk-contact-updated",
6
6
  name: "Contact Updated",
7
7
  description: "Emit new event when a contact is updated. [See the documentation](https://developers.freshdesk.com/api/#filter_contacts)",
8
- version: "0.0.1",
8
+ version: "0.0.3",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "freshdesk-new-contact",
6
6
  name: "New Contact Created",
7
7
  description: "Emit new event when a contact is created. [See the documentation](https://developers.freshdesk.com/api/#filter_contacts)",
8
- version: "0.0.8",
8
+ version: "0.0.10",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "freshdesk-new-ticket",
6
6
  name: "New Ticket Created",
7
7
  description: "Emit new event when a ticket is created. [See the documentation](https://developers.freshdesk.com/api/#filter_tickets)",
8
- version: "0.0.8",
8
+ version: "0.0.10",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "freshdesk-ticket-updated",
6
6
  name: "Ticket Updated",
7
7
  description: "Emit new event when a ticket is updated. [See the documentation](https://developers.freshdesk.com/api/#filter_tickets)",
8
- version: "0.0.1",
8
+ version: "0.0.3",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {