@pipedream/freshdesk 0.6.0 → 0.7.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 (41) 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-contact/get-contact.mjs +1 -1
  18. package/actions/get-solution-article/get-solution-article.mjs +1 -1
  19. package/actions/get-ticket/get-ticket.mjs +1 -1
  20. package/actions/list-agents/list-agents.mjs +1 -1
  21. package/actions/list-all-tickets/list-all-tickets.mjs +1 -1
  22. package/actions/list-category-folders/list-category-folders.mjs +1 -1
  23. package/actions/list-folder-articles/list-folder-articles.mjs +1 -1
  24. package/actions/list-solution-categories/list-solution-categories.mjs +1 -1
  25. package/actions/list-ticket-conversations/list-ticket-conversations.mjs +1 -1
  26. package/actions/list-ticket-fields/list-ticket-fields.mjs +1 -1
  27. package/actions/remove-ticket-tags/remove-ticket-tags.mjs +1 -1
  28. package/actions/set-ticket-priority/set-ticket-priority.mjs +1 -1
  29. package/actions/set-ticket-status/set-ticket-status.mjs +1 -1
  30. package/actions/set-ticket-tags/set-ticket-tags.mjs +1 -1
  31. package/actions/update-agent/update-agent.mjs +1 -1
  32. package/actions/update-contact/update-contact.mjs +1 -1
  33. package/actions/update-solution-article/update-solution-article.mjs +1 -1
  34. package/actions/update-ticket/update-ticket.mjs +1 -1
  35. package/actions/update-ticket-field/update-ticket-field.mjs +1 -1
  36. package/freshdesk.app.mjs +97 -35
  37. package/package.json +2 -2
  38. package/sources/contact-updated/contact-updated.mjs +1 -1
  39. package/sources/new-contact/new-contact.mjs +1 -1
  40. package/sources/new-ticket/new-ticket.mjs +1 -1
  41. 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.4",
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.5",
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.6",
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.6",
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.6",
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.3",
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.9",
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.9",
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.1",
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.1",
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.3",
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.1",
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.10",
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.3",
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.3",
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.3",
10
10
  type: "action",
11
11
  annotations: {
12
12
  destructiveHint: false,
@@ -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.3",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -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.3",
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.8",
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.3",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -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.7",
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.3",
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.3",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -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.3",
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.2",
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.3",
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.5",
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.6",
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.6",
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.5",
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.3",
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.3",
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.3",
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.6",
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.3",
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,35 @@ 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
+ },
255
284
  },
256
285
  methods: {
257
286
  setLastDateChecked(db, value) {
@@ -263,10 +292,11 @@ export default {
263
292
  base64Encode(data) {
264
293
  return Buffer.from(data).toString("base64");
265
294
  },
266
- _getHeaders() {
295
+ _getHeaders(headers = {}) {
267
296
  return {
268
297
  "Authorization": "Basic " + this.base64Encode(this.$auth.api_key + ":X"),
269
298
  "Content-Type": "application/json;charset=utf-8",
299
+ ...headers,
270
300
  };
271
301
  },
272
302
  _getDomain() {
@@ -275,15 +305,12 @@ export default {
275
305
  ? domain
276
306
  : `${domain}.freshdesk.com`;
277
307
  },
278
- async _makeRequest({
308
+ _makeRequest({
279
309
  $ = this, headers, ...args
280
310
  }) {
281
311
  return axios($, {
282
312
  baseURL: `https://${this._getDomain()}/api/v2`,
283
- headers: {
284
- ...this._getHeaders(),
285
- ...headers,
286
- },
313
+ headers: this._getHeaders(headers),
287
314
  ...args,
288
315
  });
289
316
  },
@@ -327,20 +354,20 @@ export default {
327
354
  params.page += 1;
328
355
  } while (true);
329
356
  },
330
- async createCompany(args) {
357
+ createCompany(args) {
331
358
  return this._makeRequest({
332
359
  url: "/companies",
333
360
  method: "post",
334
361
  ...args,
335
362
  });
336
363
  },
337
- async getCompanies(args) {
364
+ getCompanies(args) {
338
365
  return this._makeRequest({
339
366
  url: "/companies",
340
367
  ...args,
341
368
  });
342
369
  },
343
- async getContact({
370
+ getContact({
344
371
  contactId, ...args
345
372
  }) {
346
373
  return this._makeRequest({
@@ -348,20 +375,20 @@ export default {
348
375
  ...args,
349
376
  });
350
377
  },
351
- async getContacts(args) {
378
+ getContacts(args) {
352
379
  return this._makeRequest({
353
380
  url: "/contacts",
354
381
  ...args,
355
382
  });
356
383
  },
357
- async createContact(args) {
384
+ createContact(args) {
358
385
  return this._makeRequest({
359
386
  url: "/contacts",
360
387
  method: "post",
361
388
  ...args,
362
389
  });
363
390
  },
364
- async updateContact({
391
+ updateContact({
365
392
  contactId, ...args
366
393
  }) {
367
394
  return this._makeRequest({
@@ -370,14 +397,14 @@ export default {
370
397
  ...args,
371
398
  });
372
399
  },
373
- async createTicket(args) {
400
+ createTicket(args) {
374
401
  return this._makeRequest({
375
402
  url: "/tickets",
376
403
  method: "post",
377
404
  ...args,
378
405
  });
379
406
  },
380
- async getTicket({
407
+ getTicket({
381
408
  ticketId, ...args
382
409
  }) {
383
410
  return this._makeRequest({
@@ -385,32 +412,32 @@ export default {
385
412
  ...args,
386
413
  });
387
414
  },
388
- async searchTickets(args) {
415
+ searchTickets(args) {
389
416
  return this._makeRequest({
390
417
  url: "/search/tickets",
391
418
  ...args,
392
419
  });
393
420
  },
394
- async searchContacts(args) {
421
+ searchContacts(args) {
395
422
  return this._makeRequest({
396
423
  url: "/search/contacts",
397
424
  ...args,
398
425
  });
399
426
  },
400
- async listTicketFields(args) {
427
+ listTicketFields(args) {
401
428
  return this._makeRequest({
402
429
  url: "/ticket_fields",
403
430
  ...args,
404
431
  });
405
432
  },
406
- async createTicketField(args) {
433
+ createTicketField(args) {
407
434
  return this._makeRequest({
408
435
  url: "/admin/ticket_fields",
409
436
  method: "post",
410
437
  ...args,
411
438
  });
412
439
  },
413
- async updateTicketField({
440
+ updateTicketField({
414
441
  ticketFieldId, ...args
415
442
  }) {
416
443
  return this._makeRequest({
@@ -419,20 +446,20 @@ export default {
419
446
  ...args,
420
447
  });
421
448
  },
422
- async listAgents(args) {
449
+ listAgents(args) {
423
450
  return this._makeRequest({
424
451
  url: "/agents",
425
452
  ...args,
426
453
  });
427
454
  },
428
- async createAgent(args) {
455
+ createAgent(args) {
429
456
  return this._makeRequest({
430
457
  url: "/agents",
431
458
  method: "post",
432
459
  ...args,
433
460
  });
434
461
  },
435
- async updateAgent({
462
+ updateAgent({
436
463
  agentId, ...args
437
464
  }) {
438
465
  return this._makeRequest({
@@ -441,25 +468,25 @@ export default {
441
468
  ...args,
442
469
  });
443
470
  },
444
- async listSkills(args) {
471
+ listSkills(args) {
445
472
  return this._makeRequest({
446
473
  url: "/admin/skills",
447
474
  ...args,
448
475
  });
449
476
  },
450
- async listRoles(args) {
477
+ listRoles(args) {
451
478
  return this._makeRequest({
452
479
  url: "/roles",
453
480
  ...args,
454
481
  });
455
482
  },
456
- async listSolutionCategories(args) {
483
+ listSolutionCategories(args) {
457
484
  return this._makeRequest({
458
485
  url: "/solutions/categories",
459
486
  ...args,
460
487
  });
461
488
  },
462
- async listCategoryFolders({
489
+ listCategoryFolders({
463
490
  categoryId, ...args
464
491
  }) {
465
492
  return this._makeRequest({
@@ -467,7 +494,7 @@ export default {
467
494
  ...args,
468
495
  });
469
496
  },
470
- async listFolderArticles({
497
+ listFolderArticles({
471
498
  folderId, ...args
472
499
  }) {
473
500
  return this._makeRequest({
@@ -475,7 +502,7 @@ export default {
475
502
  ...args,
476
503
  });
477
504
  },
478
- async getArticle({
505
+ getArticle({
479
506
  articleId, ...args
480
507
  }) {
481
508
  return this._makeRequest({
@@ -483,7 +510,7 @@ export default {
483
510
  ...args,
484
511
  });
485
512
  },
486
- async createArticle({
513
+ createArticle({
487
514
  folderId, ...args
488
515
  }) {
489
516
  return this._makeRequest({
@@ -492,7 +519,7 @@ export default {
492
519
  ...args,
493
520
  });
494
521
  },
495
- async updateArticle({
522
+ updateArticle({
496
523
  articleId, ...args
497
524
  }) {
498
525
  return this._makeRequest({
@@ -501,7 +528,7 @@ export default {
501
528
  ...args,
502
529
  });
503
530
  },
504
- async deleteArticle({
531
+ deleteArticle({
505
532
  articleId, ...args
506
533
  }) {
507
534
  return this._makeRequest({
@@ -510,7 +537,7 @@ export default {
510
537
  ...args,
511
538
  });
512
539
  },
513
- async listTickets(args) {
540
+ listTickets(args) {
514
541
  return this._makeRequest({
515
542
  url: "/tickets",
516
543
  ...args,
@@ -552,7 +579,7 @@ export default {
552
579
  * @param {...*} args - Additional arguments passed to _makeRequest
553
580
  * @returns {Promise<Object>} The API response containing the created note
554
581
  */
555
- async addNoteToTicket({
582
+ addNoteToTicket({
556
583
  ticketId, data, ...args
557
584
  }) {
558
585
  return this._makeRequest({
@@ -569,7 +596,7 @@ export default {
569
596
  * @param {string[]} args.tags - Array of tags to set
570
597
  * @returns {Promise<object>} API response
571
598
  */
572
- async setTicketTags({
599
+ setTicketTags({
573
600
  ticketId, tags, ...args
574
601
  }) {
575
602
  return this._makeRequest({
@@ -669,5 +696,40 @@ export default {
669
696
  }
670
697
  return results;
671
698
  },
699
+ createReply({
700
+ ticketId, ...args
701
+ }) {
702
+ return this._makeRequest({
703
+ method: "POST",
704
+ url: `/tickets/${ticketId}/reply`,
705
+ ...args,
706
+ });
707
+ },
708
+ listEmailConfigs(args) {
709
+ return this._makeRequest({
710
+ url: "/email_configs",
711
+ ...args,
712
+ });
713
+ },
714
+ createThread(args = {}) {
715
+ return this._makeRequest({
716
+ method: "POST",
717
+ url: "/collaboration/threads",
718
+ ...args,
719
+ });
720
+ },
721
+ listThreads(args) {
722
+ return this._makeRequest({
723
+ url: "/collaboration/threads",
724
+ ...args,
725
+ });
726
+ },
727
+ createMessageForThread(args = {}) {
728
+ return this._makeRequest({
729
+ method: "POST",
730
+ url: "/collaboration/messages",
731
+ ...args,
732
+ });
733
+ },
672
734
  },
673
735
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/freshdesk",
3
- "version": "0.6.0",
3
+ "version": "0.7.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.2",
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.9",
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.9",
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.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {