diff --git a/components/freshdesk/actions/add-note-to-ticket/add-note-to-ticket.mjs b/components/freshdesk/actions/add-note-to-ticket/add-note-to-ticket.mjs index da96a2f3a6ebb..d3def3f4ebea8 100644 --- a/components/freshdesk/actions/add-note-to-ticket/add-note-to-ticket.mjs +++ b/components/freshdesk/actions/add-note-to-ticket/add-note-to-ticket.mjs @@ -5,7 +5,7 @@ export default { key: "freshdesk-add-note-to-ticket", name: "Add Note to Ticket", description: "Add a note or conversation to an existing ticket. [See the documentation](https://developers.freshdesk.com/api/#add_note_to_a_ticket).", - version: "0.0.3", + version: "0.0.4", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/add-ticket-tags/add-ticket-tags.mjs b/components/freshdesk/actions/add-ticket-tags/add-ticket-tags.mjs index 91b08451e324c..7d82b96e673b6 100644 --- a/components/freshdesk/actions/add-ticket-tags/add-ticket-tags.mjs +++ b/components/freshdesk/actions/add-ticket-tags/add-ticket-tags.mjs @@ -6,7 +6,7 @@ export default { name: "Add Ticket Tags", description: "Add tags to a ticket (appends to existing tags). [See the documentation](https://developers.freshdesk.com/api/#update_ticket)", type: "action", - version: "0.0.4", + version: "0.0.5", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/assign-ticket-to-agent/assign-ticket-to-agent.mjs b/components/freshdesk/actions/assign-ticket-to-agent/assign-ticket-to-agent.mjs index a1b419d11b6c3..9e0898db96539 100644 --- a/components/freshdesk/actions/assign-ticket-to-agent/assign-ticket-to-agent.mjs +++ b/components/freshdesk/actions/assign-ticket-to-agent/assign-ticket-to-agent.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-assign-ticket-to-agent", name: "Assign Ticket to Agent", description: "Assign a Freshdesk ticket to a specific agent. [See the documentation](https://developers.freshdesk.com/api/#update_ticket).", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/assign-ticket-to-group/assign-ticket-to-group.mjs b/components/freshdesk/actions/assign-ticket-to-group/assign-ticket-to-group.mjs index adbe62b90247f..f25c2622f4d17 100644 --- a/components/freshdesk/actions/assign-ticket-to-group/assign-ticket-to-group.mjs +++ b/components/freshdesk/actions/assign-ticket-to-group/assign-ticket-to-group.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-assign-ticket-to-group", name: "Assign Ticket to Group", description: "Assign a Freshdesk ticket to a specific group [See the documentation](https://developers.freshdesk.com/api/#update_ticket).", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/close-ticket/close-ticket.mjs b/components/freshdesk/actions/close-ticket/close-ticket.mjs index dd5ff29da1f95..9db902149d76b 100644 --- a/components/freshdesk/actions/close-ticket/close-ticket.mjs +++ b/components/freshdesk/actions/close-ticket/close-ticket.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-close-ticket", name: "Close Ticket", description: "Set a Freshdesk ticket's status to 'Closed'. [See docs](https://developers.freshdesk.com/api/#update_a_ticket)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/create-agent/create-agent.mjs b/components/freshdesk/actions/create-agent/create-agent.mjs index 23582812fba65..8c3f78bddae2a 100644 --- a/components/freshdesk/actions/create-agent/create-agent.mjs +++ b/components/freshdesk/actions/create-agent/create-agent.mjs @@ -5,7 +5,7 @@ export default { key: "freshdesk-create-agent", name: "Create Agent", description: "Create an agent in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#create_agent)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/create-company/create-company.mjs b/components/freshdesk/actions/create-company/create-company.mjs index dd513013e59c9..4374920e115a8 100644 --- a/components/freshdesk/actions/create-company/create-company.mjs +++ b/components/freshdesk/actions/create-company/create-company.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-create-company", name: "Create a Company", description: "Create a company. [See the documentation](https://developers.freshdesk.com/api/#create_company)", - version: "0.0.8", + version: "0.0.9", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/create-contact/create-contact.mjs b/components/freshdesk/actions/create-contact/create-contact.mjs index d5d6cc26638d8..426e849615333 100644 --- a/components/freshdesk/actions/create-contact/create-contact.mjs +++ b/components/freshdesk/actions/create-contact/create-contact.mjs @@ -5,7 +5,7 @@ export default { key: "freshdesk-create-contact", name: "Create a Contact", description: "Create a contact. [See the documentation](https://developers.freshdesk.com/api/#create_contact)", - version: "0.0.8", + version: "0.0.9", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/create-message-for-thread/create-message-for-thread.mjs b/components/freshdesk/actions/create-message-for-thread/create-message-for-thread.mjs new file mode 100644 index 0000000000000..78729359c2331 --- /dev/null +++ b/components/freshdesk/actions/create-message-for-thread/create-message-for-thread.mjs @@ -0,0 +1,66 @@ +import { parseObject } from "../../common/utils.mjs"; +import freshdesk from "../../freshdesk.app.mjs"; + +export default { + key: "freshdesk-create-message-for-thread", + name: "Create Message For Thread", + description: "Create message for a thread. [See the documentation](https://developers.freshdesk.com/api/#create_message_for_thread).", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: false, + }, + type: "action", + props: { + freshdesk, + ticketId: { + propDefinition: [ + freshdesk, + "ticketId", + ], + label: "Ticket ID", + description: "ID of the ticket to create the message for.", + }, + threadId: { + propDefinition: [ + freshdesk, + "threadId", + ({ ticketId }) => ({ + ticketId, + }), + ], + label: "Thread ID", + description: "ID of the thread to create the message for.", + }, + body: { + type: "string", + label: "Body", + description: "Content of the note in HTML format.", + optional: true, + }, + participants: { + type: "string[]", + label: "Participants", + description: "List of the participants to be added to the message.", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.freshdesk.createMessageForThread({ + $, + data: { + body: this.body, + participants: { + email: { + to: parseObject(this.participants), + }, + }, + thread_id: this.threadId, + }, + }); + + $.export("$summary", `Message created successfully with ID: ${response.id}`); + return response; + }, +}; diff --git a/components/freshdesk/actions/create-reply/create-reply.mjs b/components/freshdesk/actions/create-reply/create-reply.mjs new file mode 100644 index 0000000000000..ca42386c76540 --- /dev/null +++ b/components/freshdesk/actions/create-reply/create-reply.mjs @@ -0,0 +1,111 @@ +import { getFileStreamAndMetadata } from "@pipedream/platform"; +import FormData from "form-data"; +import { parseObject } from "../../common/utils.mjs"; +import freshdesk from "../../freshdesk.app.mjs"; + +export default { + key: "freshdesk-create-reply", + name: "Create a Reply", + description: "Create a reply to a ticket. [See the documentation](https://developers.freshdesk.com/api/#reply_ticket).", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: false, + }, + type: "action", + props: { + freshdesk, + ticketId: { + propDefinition: [ + freshdesk, + "ticketId", + ], + }, + body: { + type: "string", + label: "Body", + description: "Content of the note in HTML format.", + }, + attachments: { + type: "string[]", + label: "Attachments", + description: "The total size of all the ticket's attachments (not just this note) cannot exceed 20MB.", + optional: true, + }, + fromEmail: { + propDefinition: [ + freshdesk, + "fromEmail", + ], + optional: true, + }, + userId: { + propDefinition: [ + freshdesk, + "agentId", + ], + label: "User ID", + description: "ID of the agent who is adding the note.", + optional: true, + }, + ccEmails: { + type: "string[]", + label: "CC Emails", + description: "Email address added in the 'cc' field of the outgoing ticket email.", + optional: true, + }, + bccEmails: { + type: "string[]", + label: "BCC Emails", + description: "Email address added in the 'bcc' field of the outgoing ticket email.", + optional: true, + }, + }, + async run({ $ }) { + const formData = new FormData(); + formData.append("body", this.body); + + if (this.fromEmail) { + formData.append("from_email", this.fromEmail.label); + } + if (this.userId) { + formData.append("user_id", this.userId); + } + const parsedCcEmails = parseObject(this.ccEmails); + if (parsedCcEmails) { + parsedCcEmails.forEach((ccEmail) => { + formData.append("cc_emails[]", ccEmail); + }); + } + const parsedBccEmails = parseObject(this.bccEmails); + if (parsedBccEmails) { + parsedBccEmails.forEach((bccEmail) => { + formData.append("bcc_emails[]", bccEmail); + }); + } + + const parsedAttachments = parseObject(this.attachments); + if (parsedAttachments) { + for (const attachment of parsedAttachments) { + const { + stream, metadata, + } = await getFileStreamAndMetadata(attachment); + formData.append("attachments[]", stream, { + contentType: metadata.contentType, + knownLength: metadata.size, + filename: metadata.name, + }); + }; + } + const response = await this.freshdesk.createReply({ + $, + ticketId: this.ticketId, + data: formData, + headers: formData.getHeaders(), + }); + + $.export("$summary", `Reply created successfully with ID: ${response.id}`); + return response; + }, +}; diff --git a/components/freshdesk/actions/create-solution-article/create-solution-article.mjs b/components/freshdesk/actions/create-solution-article/create-solution-article.mjs index f0faa11ce7624..728c2cead6b8d 100644 --- a/components/freshdesk/actions/create-solution-article/create-solution-article.mjs +++ b/components/freshdesk/actions/create-solution-article/create-solution-article.mjs @@ -6,7 +6,7 @@ export default { key: "freshdesk-create-solution-article", name: "Create Solution Article", description: "Create a solution article in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_article_attributes)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/create-thread/create-thread.mjs b/components/freshdesk/actions/create-thread/create-thread.mjs new file mode 100644 index 0000000000000..3d99b5eb7e2d3 --- /dev/null +++ b/components/freshdesk/actions/create-thread/create-thread.mjs @@ -0,0 +1,60 @@ +import freshdesk from "../../freshdesk.app.mjs"; + +export default { + key: "freshdesk-create-thread", + name: "Create a Thread", + description: "Create a thread to a ticket. [See the documentation](https://developers.freshdesk.com/api/#create_a_thread).", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: false, + }, + type: "action", + props: { + freshdesk, + type: { + type: "string", + label: "Type", + description: "Type of the thread.", + options: [ + "forward", + "discussion", + ], + }, + ticketId: { + propDefinition: [ + freshdesk, + "ticketId", + ], + label: "Parent ID", + description: "The ID of the ticket to create the thread for.", + }, + emailConfigId: { + propDefinition: [ + freshdesk, + "fromEmail", + ], + label: "Email Config ID", + description: "The ID of the email config to use for the thread.", + }, + }, + async run({ $ }) { + const response = await this.freshdesk.createThread({ + $, + data: { + type: this.type, + parent: { + id: this.ticketId, + type: "ticket", + }, + additional_info: { + email_config_id: this.emailConfigId.value, + }, + }, + }); + + $.export("$summary", `Thread created successfully with ID: ${response.id}`); + return response; + }, +}; diff --git a/components/freshdesk/actions/create-ticket-field/create-ticket-field.mjs b/components/freshdesk/actions/create-ticket-field/create-ticket-field.mjs index e30713581af3f..2159257489786 100644 --- a/components/freshdesk/actions/create-ticket-field/create-ticket-field.mjs +++ b/components/freshdesk/actions/create-ticket-field/create-ticket-field.mjs @@ -6,7 +6,7 @@ export default { key: "freshdesk-create-ticket-field", name: "Create Ticket Field", description: "Create a ticket field in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#create_ticket_field)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/create-ticket/create-ticket.mjs b/components/freshdesk/actions/create-ticket/create-ticket.mjs index 6abd8c99a8480..996ff42edeb88 100644 --- a/components/freshdesk/actions/create-ticket/create-ticket.mjs +++ b/components/freshdesk/actions/create-ticket/create-ticket.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-create-ticket", name: "Create a Ticket", description: "Create a ticket. [See the documentation](https://developers.freshdesk.com/api/#create_ticket)", - version: "0.0.9", + version: "0.0.10", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/delete-solution-article/delete-solution-article.mjs b/components/freshdesk/actions/delete-solution-article/delete-solution-article.mjs index c7406ec73a0a3..b4241b0391a92 100644 --- a/components/freshdesk/actions/delete-solution-article/delete-solution-article.mjs +++ b/components/freshdesk/actions/delete-solution-article/delete-solution-article.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-delete-solution-article", name: "Delete Solution Article", description: "Delete a solution article in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_article_attributes)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/download-attachment/download-attachment.mjs b/components/freshdesk/actions/download-attachment/download-attachment.mjs index 2e835c60478d8..600223c70422b 100644 --- a/components/freshdesk/actions/download-attachment/download-attachment.mjs +++ b/components/freshdesk/actions/download-attachment/download-attachment.mjs @@ -6,7 +6,7 @@ export default { key: "freshdesk-download-attachment", name: "Download Attachment", description: "Download an attachment from a ticket. [See the documentation](https://developers.freshdesk.com/api/#view_a_ticket)", - version: "0.0.2", + version: "0.0.3", type: "action", annotations: { destructiveHint: false, diff --git a/components/freshdesk/actions/get-contact/get-contact.mjs b/components/freshdesk/actions/get-contact/get-contact.mjs index 376b40bd643d2..c13a85b3929a2 100644 --- a/components/freshdesk/actions/get-contact/get-contact.mjs +++ b/components/freshdesk/actions/get-contact/get-contact.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-get-contact", name: "Get Contact", description: "Get a contact from Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#view_contact)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/get-solution-article/get-solution-article.mjs b/components/freshdesk/actions/get-solution-article/get-solution-article.mjs index fb1c5bee099c8..35ad56bf520d3 100644 --- a/components/freshdesk/actions/get-solution-article/get-solution-article.mjs +++ b/components/freshdesk/actions/get-solution-article/get-solution-article.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-get-solution-article", name: "Get Solution Article", description: "Get a solution article in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_article_attributes)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/get-ticket/get-ticket.mjs b/components/freshdesk/actions/get-ticket/get-ticket.mjs index d02fb99c35488..cc1375ffc11ef 100644 --- a/components/freshdesk/actions/get-ticket/get-ticket.mjs +++ b/components/freshdesk/actions/get-ticket/get-ticket.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-get-ticket", name: "Get Ticket Details", description: "Get details of a Ticket. [See the documentation](https://developers.freshdesk.com/api/#view_a_ticket)", - version: "0.1.7", + version: "0.1.8", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/list-agents/list-agents.mjs b/components/freshdesk/actions/list-agents/list-agents.mjs index c325d6d696627..c31133bff2fbf 100644 --- a/components/freshdesk/actions/list-agents/list-agents.mjs +++ b/components/freshdesk/actions/list-agents/list-agents.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-list-agents", name: "List Agents", description: "List all agents in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#list_all_agents)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/list-all-tickets/list-all-tickets.mjs b/components/freshdesk/actions/list-all-tickets/list-all-tickets.mjs index 09514b35f57ff..0f8d730218bc0 100644 --- a/components/freshdesk/actions/list-all-tickets/list-all-tickets.mjs +++ b/components/freshdesk/actions/list-all-tickets/list-all-tickets.mjs @@ -5,7 +5,7 @@ export default { name: "List Tickets", description: "Fetch up to 100 tickets according to the selected filters. [See the documentation](https://developers.freshdesk.com/api/#list_all_tickets)", - version: "0.2.6", + version: "0.2.7", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/list-category-folders/list-category-folders.mjs b/components/freshdesk/actions/list-category-folders/list-category-folders.mjs index 9c12a2ee50ce0..7cd03b2697b34 100644 --- a/components/freshdesk/actions/list-category-folders/list-category-folders.mjs +++ b/components/freshdesk/actions/list-category-folders/list-category-folders.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-list-category-folders", name: "List Category Folders", description: "List category folders in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_folder_attributes)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/list-folder-articles/list-folder-articles.mjs b/components/freshdesk/actions/list-folder-articles/list-folder-articles.mjs index afc398404471e..bfa649c457e48 100644 --- a/components/freshdesk/actions/list-folder-articles/list-folder-articles.mjs +++ b/components/freshdesk/actions/list-folder-articles/list-folder-articles.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-list-folder-articles", name: "List Folder Articles", description: "List folder articles in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_article_attributes)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/list-solution-categories/list-solution-categories.mjs b/components/freshdesk/actions/list-solution-categories/list-solution-categories.mjs index 06709c4773943..443f94e6515b2 100644 --- a/components/freshdesk/actions/list-solution-categories/list-solution-categories.mjs +++ b/components/freshdesk/actions/list-solution-categories/list-solution-categories.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-list-solution-categories", name: "List Solution Categories", description: "List solution categories in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_category_attributes)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/list-ticket-conversations/list-ticket-conversations.mjs b/components/freshdesk/actions/list-ticket-conversations/list-ticket-conversations.mjs index e7655c8836a18..d18fd5b53c129 100644 --- a/components/freshdesk/actions/list-ticket-conversations/list-ticket-conversations.mjs +++ b/components/freshdesk/actions/list-ticket-conversations/list-ticket-conversations.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-list-ticket-conversations", name: "List Conversations of a Ticket", description: "List all conversations for a ticket. [See the documentation](https://developers.freshdesk.com/api/#list_all_ticket_notes)", - version: "0.0.1", + version: "0.0.2", type: "action", annotations: { destructiveHint: false, diff --git a/components/freshdesk/actions/list-ticket-fields/list-ticket-fields.mjs b/components/freshdesk/actions/list-ticket-fields/list-ticket-fields.mjs index aa31f82c80b10..9c9093d7fc9ad 100644 --- a/components/freshdesk/actions/list-ticket-fields/list-ticket-fields.mjs +++ b/components/freshdesk/actions/list-ticket-fields/list-ticket-fields.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-list-ticket-fields", name: "List Ticket Fields", description: "List all ticket fields in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#list_all_ticket_fields)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/freshdesk/actions/remove-ticket-tags/remove-ticket-tags.mjs b/components/freshdesk/actions/remove-ticket-tags/remove-ticket-tags.mjs index d013bbfd30dbb..16e9809e296c6 100644 --- a/components/freshdesk/actions/remove-ticket-tags/remove-ticket-tags.mjs +++ b/components/freshdesk/actions/remove-ticket-tags/remove-ticket-tags.mjs @@ -6,7 +6,7 @@ export default { name: "Remove Ticket Tags", description: "Remove specific tags from a ticket. [See the documentation](https://developers.freshdesk.com/api/#update_ticket)", type: "action", - version: "0.0.4", + version: "0.0.5", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/set-ticket-priority/set-ticket-priority.mjs b/components/freshdesk/actions/set-ticket-priority/set-ticket-priority.mjs index 952f1837435c6..b046d60640e82 100644 --- a/components/freshdesk/actions/set-ticket-priority/set-ticket-priority.mjs +++ b/components/freshdesk/actions/set-ticket-priority/set-ticket-priority.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-set-ticket-priority", name: "Set Ticket Priority", description: "Update the priority of a ticket in Freshdesk [See the documentation](https://developers.freshdesk.com/api/#update_ticket).", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/set-ticket-status/set-ticket-status.mjs b/components/freshdesk/actions/set-ticket-status/set-ticket-status.mjs index 3f16a179c3b3c..8e7bed27fe88c 100644 --- a/components/freshdesk/actions/set-ticket-status/set-ticket-status.mjs +++ b/components/freshdesk/actions/set-ticket-status/set-ticket-status.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-set-ticket-status", name: "Set Ticket Status", description: "Update the status of a ticket in Freshdesk [See the documentation](https://developers.freshdesk.com/api/#update_ticket).", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/set-ticket-tags/set-ticket-tags.mjs b/components/freshdesk/actions/set-ticket-tags/set-ticket-tags.mjs index f37ff3e5f305b..2fe2831dd0237 100644 --- a/components/freshdesk/actions/set-ticket-tags/set-ticket-tags.mjs +++ b/components/freshdesk/actions/set-ticket-tags/set-ticket-tags.mjs @@ -6,7 +6,7 @@ export default { name: "Set Ticket Tags", description: "Set tags on a ticket (replaces all existing tags). [See the documentation](https://developers.freshdesk.com/api/#update_ticket)", type: "action", - version: "0.0.4", + version: "0.0.5", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/update-agent/update-agent.mjs b/components/freshdesk/actions/update-agent/update-agent.mjs index 1cf289a67f92e..466cc8186e1d1 100644 --- a/components/freshdesk/actions/update-agent/update-agent.mjs +++ b/components/freshdesk/actions/update-agent/update-agent.mjs @@ -5,7 +5,7 @@ export default { key: "freshdesk-update-agent", name: "Update Agent", description: "Update an agent in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#update_agent)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/update-contact/update-contact.mjs b/components/freshdesk/actions/update-contact/update-contact.mjs index 815135e67866e..ddaf0834d93fd 100644 --- a/components/freshdesk/actions/update-contact/update-contact.mjs +++ b/components/freshdesk/actions/update-contact/update-contact.mjs @@ -4,7 +4,7 @@ export default { key: "freshdesk-update-contact", name: "Update Contact", description: "Update a contact in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#update_contact)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/update-solution-article/update-solution-article.mjs b/components/freshdesk/actions/update-solution-article/update-solution-article.mjs index 713e754efdc0e..862223d97dd4c 100644 --- a/components/freshdesk/actions/update-solution-article/update-solution-article.mjs +++ b/components/freshdesk/actions/update-solution-article/update-solution-article.mjs @@ -6,7 +6,7 @@ export default { key: "freshdesk-update-solution-article", name: "Update Solution Article", description: "Update a solution article in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#solution_article_attributes)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/update-ticket-field/update-ticket-field.mjs b/components/freshdesk/actions/update-ticket-field/update-ticket-field.mjs index 794e568bb494c..9d1e3c758a96f 100644 --- a/components/freshdesk/actions/update-ticket-field/update-ticket-field.mjs +++ b/components/freshdesk/actions/update-ticket-field/update-ticket-field.mjs @@ -5,7 +5,7 @@ export default { key: "freshdesk-update-ticket-field", name: "Update Ticket Field", description: "Update a ticket field in Freshdesk. [See the documentation](https://developers.freshdesk.com/api/#update_ticket_field)", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/actions/update-ticket/update-ticket.mjs b/components/freshdesk/actions/update-ticket/update-ticket.mjs index 328d3ca122549..c7c4c87a1d195 100644 --- a/components/freshdesk/actions/update-ticket/update-ticket.mjs +++ b/components/freshdesk/actions/update-ticket/update-ticket.mjs @@ -5,7 +5,7 @@ export default { key: "freshdesk-update-ticket", name: "Update a Ticket", description: "Update status, priority, subject, description, agent, group, etc. [See the documentation](https://developers.freshdesk.com/api/#update_ticket).", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/freshdesk/freshdesk.app.mjs b/components/freshdesk/freshdesk.app.mjs index d0da926b38256..3eb5fb1661695 100644 --- a/components/freshdesk/freshdesk.app.mjs +++ b/components/freshdesk/freshdesk.app.mjs @@ -1,5 +1,5 @@ -import constants from "./common/constants.mjs"; import { axios } from "@pipedream/platform"; +import constants from "./common/constants.mjs"; export default { type: "app", @@ -252,6 +252,35 @@ export default { description: "Array of tags to apply to the ticket. Each tag must be 32 characters or less.", optional: true, }, + fromEmail: { + type: "string", + label: "From Email", + description: "The email address from which the reply is sent. By default the global support email will be used.", + withLabel: true, + async options() { + const response = await this.listEmailConfigs(); + return response.map(({ + id, to_email: email, + }) => ({ + label: email, + value: id, + })); + }, + }, + threadId: { + type: "string", + label: "Thread ID", + description: "ID of the thread to create the message for.", + async options({ ticketId }) { + const { threads } = await this.listThreads({ + params: { + parent_id: ticketId, + parent_type: "ticket", + }, + }); + return threads.map(({ id }) => id); + }, + }, }, methods: { setLastDateChecked(db, value) { @@ -263,10 +292,11 @@ export default { base64Encode(data) { return Buffer.from(data).toString("base64"); }, - _getHeaders() { + _getHeaders(headers = {}) { return { "Authorization": "Basic " + this.base64Encode(this.$auth.api_key + ":X"), "Content-Type": "application/json;charset=utf-8", + ...headers, }; }, _getDomain() { @@ -275,15 +305,12 @@ export default { ? domain : `${domain}.freshdesk.com`; }, - async _makeRequest({ + _makeRequest({ $ = this, headers, ...args }) { return axios($, { baseURL: `https://${this._getDomain()}/api/v2`, - headers: { - ...this._getHeaders(), - ...headers, - }, + headers: this._getHeaders(headers), ...args, }); }, @@ -327,20 +354,20 @@ export default { params.page += 1; } while (true); }, - async createCompany(args) { + createCompany(args) { return this._makeRequest({ url: "/companies", method: "post", ...args, }); }, - async getCompanies(args) { + getCompanies(args) { return this._makeRequest({ url: "/companies", ...args, }); }, - async getContact({ + getContact({ contactId, ...args }) { return this._makeRequest({ @@ -348,20 +375,20 @@ export default { ...args, }); }, - async getContacts(args) { + getContacts(args) { return this._makeRequest({ url: "/contacts", ...args, }); }, - async createContact(args) { + createContact(args) { return this._makeRequest({ url: "/contacts", method: "post", ...args, }); }, - async updateContact({ + updateContact({ contactId, ...args }) { return this._makeRequest({ @@ -370,14 +397,14 @@ export default { ...args, }); }, - async createTicket(args) { + createTicket(args) { return this._makeRequest({ url: "/tickets", method: "post", ...args, }); }, - async getTicket({ + getTicket({ ticketId, ...args }) { return this._makeRequest({ @@ -385,32 +412,32 @@ export default { ...args, }); }, - async searchTickets(args) { + searchTickets(args) { return this._makeRequest({ url: "/search/tickets", ...args, }); }, - async searchContacts(args) { + searchContacts(args) { return this._makeRequest({ url: "/search/contacts", ...args, }); }, - async listTicketFields(args) { + listTicketFields(args) { return this._makeRequest({ url: "/ticket_fields", ...args, }); }, - async createTicketField(args) { + createTicketField(args) { return this._makeRequest({ url: "/admin/ticket_fields", method: "post", ...args, }); }, - async updateTicketField({ + updateTicketField({ ticketFieldId, ...args }) { return this._makeRequest({ @@ -419,20 +446,20 @@ export default { ...args, }); }, - async listAgents(args) { + listAgents(args) { return this._makeRequest({ url: "/agents", ...args, }); }, - async createAgent(args) { + createAgent(args) { return this._makeRequest({ url: "/agents", method: "post", ...args, }); }, - async updateAgent({ + updateAgent({ agentId, ...args }) { return this._makeRequest({ @@ -441,25 +468,25 @@ export default { ...args, }); }, - async listSkills(args) { + listSkills(args) { return this._makeRequest({ url: "/admin/skills", ...args, }); }, - async listRoles(args) { + listRoles(args) { return this._makeRequest({ url: "/roles", ...args, }); }, - async listSolutionCategories(args) { + listSolutionCategories(args) { return this._makeRequest({ url: "/solutions/categories", ...args, }); }, - async listCategoryFolders({ + listCategoryFolders({ categoryId, ...args }) { return this._makeRequest({ @@ -467,7 +494,7 @@ export default { ...args, }); }, - async listFolderArticles({ + listFolderArticles({ folderId, ...args }) { return this._makeRequest({ @@ -475,7 +502,7 @@ export default { ...args, }); }, - async getArticle({ + getArticle({ articleId, ...args }) { return this._makeRequest({ @@ -483,7 +510,7 @@ export default { ...args, }); }, - async createArticle({ + createArticle({ folderId, ...args }) { return this._makeRequest({ @@ -492,7 +519,7 @@ export default { ...args, }); }, - async updateArticle({ + updateArticle({ articleId, ...args }) { return this._makeRequest({ @@ -501,7 +528,7 @@ export default { ...args, }); }, - async deleteArticle({ + deleteArticle({ articleId, ...args }) { return this._makeRequest({ @@ -510,7 +537,7 @@ export default { ...args, }); }, - async listTickets(args) { + listTickets(args) { return this._makeRequest({ url: "/tickets", ...args, @@ -552,7 +579,7 @@ export default { * @param {...*} args - Additional arguments passed to _makeRequest * @returns {Promise} The API response containing the created note */ - async addNoteToTicket({ + addNoteToTicket({ ticketId, data, ...args }) { return this._makeRequest({ @@ -569,7 +596,7 @@ export default { * @param {string[]} args.tags - Array of tags to set * @returns {Promise} API response */ - async setTicketTags({ + setTicketTags({ ticketId, tags, ...args }) { return this._makeRequest({ @@ -669,5 +696,40 @@ export default { } return results; }, + createReply({ + ticketId, ...args + }) { + return this._makeRequest({ + method: "POST", + url: `/tickets/${ticketId}/reply`, + ...args, + }); + }, + listEmailConfigs(args) { + return this._makeRequest({ + url: "/email_configs", + ...args, + }); + }, + createThread(args = {}) { + return this._makeRequest({ + method: "POST", + url: "/collaboration/threads", + ...args, + }); + }, + listThreads(args) { + return this._makeRequest({ + url: "/collaboration/threads", + ...args, + }); + }, + createMessageForThread(args = {}) { + return this._makeRequest({ + method: "POST", + url: "/collaboration/messages", + ...args, + }); + }, }, }; diff --git a/components/freshdesk/package.json b/components/freshdesk/package.json index 45f18ed2e10aa..b857959eafec2 100644 --- a/components/freshdesk/package.json +++ b/components/freshdesk/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/freshdesk", - "version": "0.6.0", + "version": "0.7.0", "description": "Pipedream Freshdesk Components", "main": "freshdesk.app.mjs", "keywords": [ diff --git a/components/freshdesk/sources/contact-updated/contact-updated.mjs b/components/freshdesk/sources/contact-updated/contact-updated.mjs index 3857b5d006a99..9049f1bc64c29 100644 --- a/components/freshdesk/sources/contact-updated/contact-updated.mjs +++ b/components/freshdesk/sources/contact-updated/contact-updated.mjs @@ -5,7 +5,7 @@ export default { key: "freshdesk-contact-updated", name: "Contact Updated", description: "Emit new event when a contact is updated. [See the documentation](https://developers.freshdesk.com/api/#filter_contacts)", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { diff --git a/components/freshdesk/sources/new-contact/new-contact.mjs b/components/freshdesk/sources/new-contact/new-contact.mjs index beb5930fcd539..ad0acac021b88 100644 --- a/components/freshdesk/sources/new-contact/new-contact.mjs +++ b/components/freshdesk/sources/new-contact/new-contact.mjs @@ -5,7 +5,7 @@ export default { key: "freshdesk-new-contact", name: "New Contact Created", description: "Emit new event when a contact is created. [See the documentation](https://developers.freshdesk.com/api/#filter_contacts)", - version: "0.0.8", + version: "0.0.9", type: "source", dedupe: "unique", methods: { diff --git a/components/freshdesk/sources/new-ticket/new-ticket.mjs b/components/freshdesk/sources/new-ticket/new-ticket.mjs index 62700a639a582..d1229cb66f9b0 100644 --- a/components/freshdesk/sources/new-ticket/new-ticket.mjs +++ b/components/freshdesk/sources/new-ticket/new-ticket.mjs @@ -5,7 +5,7 @@ export default { key: "freshdesk-new-ticket", name: "New Ticket Created", description: "Emit new event when a ticket is created. [See the documentation](https://developers.freshdesk.com/api/#filter_tickets)", - version: "0.0.8", + version: "0.0.9", type: "source", dedupe: "unique", methods: { diff --git a/components/freshdesk/sources/ticket-updated/ticket-updated.mjs b/components/freshdesk/sources/ticket-updated/ticket-updated.mjs index 43c6295fe91e7..6576835939044 100644 --- a/components/freshdesk/sources/ticket-updated/ticket-updated.mjs +++ b/components/freshdesk/sources/ticket-updated/ticket-updated.mjs @@ -5,7 +5,7 @@ export default { key: "freshdesk-ticket-updated", name: "Ticket Updated", description: "Emit new event when a ticket is updated. [See the documentation](https://developers.freshdesk.com/api/#filter_tickets)", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: {