From d6c8d8a9d813e054d98b663951fe9bb45c581c28 Mon Sep 17 00:00:00 2001 From: Jorge Cortes Date: Tue, 25 Nov 2025 16:22:58 -0500 Subject: [PATCH] [ACTION] Front - Articles --- .../actions/add-comment/add-comment.mjs | 2 +- .../archive-conversation.mjs | 2 +- .../assign-conversation.mjs | 2 +- .../create-draft-reply/create-draft-reply.mjs | 2 +- .../actions/create-draft/create-draft.mjs | 2 +- .../actions/create-inbox/create-inbox.mjs | 2 +- .../create-message-template.mjs | 2 +- .../actions/create-message/create-message.mjs | 2 +- .../delete-message-template.mjs | 2 +- .../download-article-attachment.mjs | 77 +++++++++++++ .../actions/get-comment/get-comment.mjs | 2 +- .../get-conversation/get-conversation.mjs | 2 +- .../get-knowledge-base-article.mjs | 42 ++++++++ .../get-knowledge-base/get-knowledge-base.mjs | 33 ++++++ .../get-message-template-folder.mjs | 33 ++++++ .../get-message-template.mjs | 33 ++++++ .../actions/get-message/get-message.mjs | 2 +- .../actions/get-teammate/get-teammate.mjs | 2 +- .../actions/import-message/import-message.mjs | 2 +- .../list-comment-mentions.mjs | 2 +- .../actions/list-comments/list-comments.mjs | 2 +- .../list-conversations/list-conversations.mjs | 2 +- .../list-knowledge-base-articles.mjs | 46 ++++++++ .../list-knowledge-base-categories.mjs | 46 ++++++++ .../list-knowledge-bases.mjs | 26 +++++ .../list-message-template-folders.mjs | 52 +++++++++ .../list-message-templates.mjs | 2 +- .../actions/list-teammates/list-teammates.mjs | 2 +- .../receive-custom-messages.mjs | 2 +- .../reply-to-conversation.mjs | 2 +- .../send-new-message/send-new-message.mjs | 2 +- .../tag-conversation/tag-conversation.mjs | 2 +- .../update-conversation.mjs | 2 +- .../update-teammate/update-teammate.mjs | 2 +- components/frontapp/frontapp.app.mjs | 102 ++++++++++++++++++ components/frontapp/package.json | 2 +- .../new-conversation-created.mjs | 2 +- .../new-conversation-state-change.mjs | 2 +- .../new-conversation-tag.mjs | 2 +- .../new-message-template-created.mjs | 2 +- 40 files changed, 520 insertions(+), 30 deletions(-) create mode 100644 components/frontapp/actions/download-article-attachment/download-article-attachment.mjs create mode 100644 components/frontapp/actions/get-knowledge-base-article/get-knowledge-base-article.mjs create mode 100644 components/frontapp/actions/get-knowledge-base/get-knowledge-base.mjs create mode 100644 components/frontapp/actions/get-message-template-folder/get-message-template-folder.mjs create mode 100644 components/frontapp/actions/get-message-template/get-message-template.mjs create mode 100644 components/frontapp/actions/list-knowledge-base-articles/list-knowledge-base-articles.mjs create mode 100644 components/frontapp/actions/list-knowledge-base-categories/list-knowledge-base-categories.mjs create mode 100644 components/frontapp/actions/list-knowledge-bases/list-knowledge-bases.mjs create mode 100644 components/frontapp/actions/list-message-template-folders/list-message-template-folders.mjs diff --git a/components/frontapp/actions/add-comment/add-comment.mjs b/components/frontapp/actions/add-comment/add-comment.mjs index e83de837639f2..5759a690e5c79 100644 --- a/components/frontapp/actions/add-comment/add-comment.mjs +++ b/components/frontapp/actions/add-comment/add-comment.mjs @@ -5,7 +5,7 @@ export default { key: "frontapp-add-comment", name: "Add Comment", description: "Add a comment to a conversation. [See the documentation](https://dev.frontapp.com/reference/add-comment)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/archive-conversation/archive-conversation.mjs b/components/frontapp/actions/archive-conversation/archive-conversation.mjs index cdf43ad723a56..f23c5c02c4bed 100644 --- a/components/frontapp/actions/archive-conversation/archive-conversation.mjs +++ b/components/frontapp/actions/archive-conversation/archive-conversation.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-archive-conversation", name: "Archive Conversation", description: "Archives a conversation. [See the documentation](https://dev.frontapp.com/reference/patch_conversations-conversation-id)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/frontapp/actions/assign-conversation/assign-conversation.mjs b/components/frontapp/actions/assign-conversation/assign-conversation.mjs index f133406bda606..16ee102527f3d 100644 --- a/components/frontapp/actions/assign-conversation/assign-conversation.mjs +++ b/components/frontapp/actions/assign-conversation/assign-conversation.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-assign-conversation", name: "Assign Conversation", description: "Assign or unassign a conversation. [See the documentation](https://dev.frontapp.com/reference/update-conversation-assignee)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/frontapp/actions/create-draft-reply/create-draft-reply.mjs b/components/frontapp/actions/create-draft-reply/create-draft-reply.mjs index 6d09e01170241..eb62cd9b06798 100644 --- a/components/frontapp/actions/create-draft-reply/create-draft-reply.mjs +++ b/components/frontapp/actions/create-draft-reply/create-draft-reply.mjs @@ -5,7 +5,7 @@ export default { key: "frontapp-create-draft-reply", name: "Create Draft Reply", description: "Create a new draft as a reply to the last message in the conversation. [See the documentation](https://dev.frontapp.com/reference/create-draft-reply)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/create-draft/create-draft.mjs b/components/frontapp/actions/create-draft/create-draft.mjs index d61062abec9a5..50b077786c01f 100644 --- a/components/frontapp/actions/create-draft/create-draft.mjs +++ b/components/frontapp/actions/create-draft/create-draft.mjs @@ -5,7 +5,7 @@ export default { key: "frontapp-create-draft", name: "Create Draft", description: "Create a draft message which is the first message of a new conversation. [See the documentation](https://dev.frontapp.com/reference/create-draft)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/create-inbox/create-inbox.mjs b/components/frontapp/actions/create-inbox/create-inbox.mjs index 8bdcf3302699f..3517118687e0e 100644 --- a/components/frontapp/actions/create-inbox/create-inbox.mjs +++ b/components/frontapp/actions/create-inbox/create-inbox.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-create-inbox", name: "Create Inbox", description: "Create an inbox in the default team (workspace). [See the documentation](https://dev.frontapp.com/reference/create-inbox).", - version: "0.0.4", + version: "0.0.5", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/create-message-template/create-message-template.mjs b/components/frontapp/actions/create-message-template/create-message-template.mjs index 6213dbd14750d..bca854afa65ec 100644 --- a/components/frontapp/actions/create-message-template/create-message-template.mjs +++ b/components/frontapp/actions/create-message-template/create-message-template.mjs @@ -6,7 +6,7 @@ export default { key: "frontapp-create-message-template", name: "Create Message Template", description: "Create a new message template. [See the documentation](https://dev.frontapp.com/reference/create-message-template).", - version: "0.0.4", + version: "0.0.5", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/create-message/create-message.mjs b/components/frontapp/actions/create-message/create-message.mjs index afd8075e84cac..3b3ffe24aca60 100644 --- a/components/frontapp/actions/create-message/create-message.mjs +++ b/components/frontapp/actions/create-message/create-message.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-create-message", name: "Create Message", description: "Send a new message from a channel. [See the documentation](https://dev.frontapp.com/reference/create-message).", - version: "0.0.3", + version: "0.0.4", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/delete-message-template/delete-message-template.mjs b/components/frontapp/actions/delete-message-template/delete-message-template.mjs index d9b61589fc416..c9e65489dab6e 100644 --- a/components/frontapp/actions/delete-message-template/delete-message-template.mjs +++ b/components/frontapp/actions/delete-message-template/delete-message-template.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-delete-message-template", name: "Delete Message Template", description: "Delete a message template. [See the documentation](https://dev.frontapp.com/reference/delete-message-template).", - version: "0.0.4", + version: "0.0.5", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/frontapp/actions/download-article-attachment/download-article-attachment.mjs b/components/frontapp/actions/download-article-attachment/download-article-attachment.mjs new file mode 100644 index 0000000000000..2d75b9fa0fd01 --- /dev/null +++ b/components/frontapp/actions/download-article-attachment/download-article-attachment.mjs @@ -0,0 +1,77 @@ +import fs from "fs"; +import path from "path"; +import frontapp from "../../frontapp.app.mjs"; + +export default { + key: "frontapp-download-article-attachment", + name: "Download Article Attachment", + description: "Downloads the attachment from an article. [See the documentation](https://dev.frontapp.com/reference/download-attachment-from-an-article)", + version: "0.0.3", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + type: "action", + props: { + frontapp, + knowledgeBaseId: { + propDefinition: [ + frontapp, + "knowledgeBaseId", + ], + }, + articleId: { + propDefinition: [ + frontapp, + "articleId", + ({ knowledgeBaseId }) => ({ + knowledgeBaseId, + }), + ], + }, + attachmentId: { + type: "string", + label: "Attachment ID", + description: "The ID of the file to download", + }, + filename: { + type: "string", + label: "Filename", + description: "The filename to save the file as in the `/tmp` directory", + optional: true, + }, + syncDir: { + type: "dir", + accessMode: "write", + sync: true, + }, + }, + async run({ $ }) { + const response = await this.frontapp.downloadArticleAttachment({ + $, + articleId: this.articleId, + attachmentId: this.attachmentId, + responseType: "arraybuffer", + }); + + // Extract filename from content-disposition header or use provided filename + const contentDisposition = response.headers["content-disposition"]; + const headerFileName = contentDisposition?.match(/filename\*?=(?:UTF-8'')?([^;]+)/)?.[1]?.replace(/['"]/g, ""); + const fileName = this.filename || headerFileName || this.attachmentId; + const filePath = path.join("/tmp", fileName); + + // The response.data contains the binary content of the attachment file + const buffer = Buffer.isBuffer(response.data) + ? response.data + : Buffer.from(response.data); + fs.writeFileSync(filePath, buffer); + + // Get file size from content-length header or buffer + const fileSize = response.headers["content-length"] || buffer.length; + + $.export("$summary", `Successfully downloaded attachment: ${fileName} (${fileSize} bytes)`); + + return filePath; + }, +}; diff --git a/components/frontapp/actions/get-comment/get-comment.mjs b/components/frontapp/actions/get-comment/get-comment.mjs index 6a7fe5f56fdf5..3b8aeb3b1134d 100644 --- a/components/frontapp/actions/get-comment/get-comment.mjs +++ b/components/frontapp/actions/get-comment/get-comment.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-get-comment", name: "Get Comment", description: "Retrieve a comment from a conversation. [See the documentation](https://dev.frontapp.com/reference/get-comment)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/get-conversation/get-conversation.mjs b/components/frontapp/actions/get-conversation/get-conversation.mjs index 9443fa6d3becc..2b38773e79b0d 100644 --- a/components/frontapp/actions/get-conversation/get-conversation.mjs +++ b/components/frontapp/actions/get-conversation/get-conversation.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-get-conversation", name: "Get Conversation", description: "Retrieve a conversation by its ID from Front. [See the documentation](https://dev.frontapp.com/reference/get-conversation-by-id)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/get-knowledge-base-article/get-knowledge-base-article.mjs b/components/frontapp/actions/get-knowledge-base-article/get-knowledge-base-article.mjs new file mode 100644 index 0000000000000..2a02e835d7bc7 --- /dev/null +++ b/components/frontapp/actions/get-knowledge-base-article/get-knowledge-base-article.mjs @@ -0,0 +1,42 @@ +import frontapp from "../../frontapp.app.mjs"; + +export default { + key: "frontapp-get-knowledge-base-article", + name: "Get Knowledge Base Article", + description: "Fetches a knowledge base article. [See the documentation](https://dev.frontapp.com/reference/get-a-knowledge-base-article)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + frontapp, + knowledgeBaseId: { + propDefinition: [ + frontapp, + "knowledgeBaseId", + ], + }, + articleId: { + propDefinition: [ + frontapp, + "articleId", + ({ knowledgeBaseId }) => ({ + knowledgeBaseId, + }), + ], + }, + }, + async run({ $ }) { + const article = await this.frontapp.getKnowledgeBaseArticle({ + $, + articleId: this.articleId, + }); + + $.export("$summary", `Successfully retrieved knowledge base article with ID: ${this.articleId}`); + + return article; + }, +}; diff --git a/components/frontapp/actions/get-knowledge-base/get-knowledge-base.mjs b/components/frontapp/actions/get-knowledge-base/get-knowledge-base.mjs new file mode 100644 index 0000000000000..b69b8678142de --- /dev/null +++ b/components/frontapp/actions/get-knowledge-base/get-knowledge-base.mjs @@ -0,0 +1,33 @@ +import frontapp from "../../frontapp.app.mjs"; + +export default { + key: "frontapp-get-knowledge-base", + name: "Get Knowledge Base", + description: "Fetches a knowledge base. [See the documentation](https://dev.frontapp.com/reference/get-a-knowledge-base)", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + type: "action", + props: { + frontapp, + knowledgeBaseId: { + propDefinition: [ + frontapp, + "knowledgeBaseId", + ], + }, + }, + async run({ $ }) { + const knowledgeBase = await this.frontapp.getKnowledgeBase({ + $, + knowledgeBaseId: this.knowledgeBaseId, + }); + + $.export("$summary", `Successfully retrieved knowledge base with ID: ${this.knowledgeBaseId}`); + + return knowledgeBase; + }, +}; diff --git a/components/frontapp/actions/get-message-template-folder/get-message-template-folder.mjs b/components/frontapp/actions/get-message-template-folder/get-message-template-folder.mjs new file mode 100644 index 0000000000000..986daea739a93 --- /dev/null +++ b/components/frontapp/actions/get-message-template-folder/get-message-template-folder.mjs @@ -0,0 +1,33 @@ +import frontapp from "../../frontapp.app.mjs"; + +export default { + key: "frontapp-get-message-template-folder", + name: "Get Message Template Folder", + description: "Fetch a message template folder. [See the documentation](https://dev.frontapp.com/reference/get-folder)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + frontapp, + folderId: { + propDefinition: [ + frontapp, + "folderId", + ], + }, + }, + async run({ $ }) { + const folder = await this.frontapp.getMessageTemplateFolder({ + $, + folderId: this.folderId, + }); + + $.export("$summary", `Successfully retrieved message template folder with ID: ${this.folderId}`); + + return folder; + }, +}; diff --git a/components/frontapp/actions/get-message-template/get-message-template.mjs b/components/frontapp/actions/get-message-template/get-message-template.mjs new file mode 100644 index 0000000000000..ed56191500523 --- /dev/null +++ b/components/frontapp/actions/get-message-template/get-message-template.mjs @@ -0,0 +1,33 @@ +import frontapp from "../../frontapp.app.mjs"; + +export default { + key: "frontapp-get-message-template", + name: "Get Message Template", + description: "Fetch a message template. [See the documentation](https://dev.frontapp.com/reference/get-message-template)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + frontapp, + messageTemplateId: { + propDefinition: [ + frontapp, + "messageTemplateId", + ], + }, + }, + async run({ $ }) { + const messageTemplate = await this.frontapp.getMessageTemplate({ + $, + messageTemplateId: this.messageTemplateId, + }); + + $.export("$summary", `Successfully retrieved message template with ID: ${this.messageTemplateId}`); + + return messageTemplate; + }, +}; diff --git a/components/frontapp/actions/get-message/get-message.mjs b/components/frontapp/actions/get-message/get-message.mjs index 6672cf57cc3c5..bc6462d10339f 100644 --- a/components/frontapp/actions/get-message/get-message.mjs +++ b/components/frontapp/actions/get-message/get-message.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-get-message", name: "Get Message", description: "Retrieve a message by its ID. [See the documentation](https://dev.frontapp.com/reference/get-message)", - version: "0.0.4", + version: "0.0.5", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/get-teammate/get-teammate.mjs b/components/frontapp/actions/get-teammate/get-teammate.mjs index 9619513b6cd2a..4de63e62c832a 100644 --- a/components/frontapp/actions/get-teammate/get-teammate.mjs +++ b/components/frontapp/actions/get-teammate/get-teammate.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-get-teammate", name: "Get Teammate", description: "Retrieve a teammate by ID. [See the documentation](https://dev.frontapp.com/reference/get-teammate)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/import-message/import-message.mjs b/components/frontapp/actions/import-message/import-message.mjs index 3327a45205869..01e9e22a083e7 100644 --- a/components/frontapp/actions/import-message/import-message.mjs +++ b/components/frontapp/actions/import-message/import-message.mjs @@ -5,7 +5,7 @@ export default { key: "frontapp-import-message", name: "Import Message", description: "Appends a new message into an inbox. [See the documentation](https://dev.frontapp.com/reference/import-inbox-message).", - version: "0.1.11", + version: "0.1.12", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/list-comment-mentions/list-comment-mentions.mjs b/components/frontapp/actions/list-comment-mentions/list-comment-mentions.mjs index 921d60b85bde9..19107cfdfccb2 100644 --- a/components/frontapp/actions/list-comment-mentions/list-comment-mentions.mjs +++ b/components/frontapp/actions/list-comment-mentions/list-comment-mentions.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-list-comment-mentions", name: "List Comment Mentions", description: "List the teammates mentioned in a comment. [See the documentation](https://dev.frontapp.com/reference/list-comment-mentions)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/list-comments/list-comments.mjs b/components/frontapp/actions/list-comments/list-comments.mjs index e3ddcc5e5d603..f341bb77f137c 100644 --- a/components/frontapp/actions/list-comments/list-comments.mjs +++ b/components/frontapp/actions/list-comments/list-comments.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-list-comments", name: "List Conversation Comments", description: "List the comments in a conversation. [See the documentation](https://dev.frontapp.com/reference/list-conversation-comments)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/list-conversations/list-conversations.mjs b/components/frontapp/actions/list-conversations/list-conversations.mjs index ec19a91d76ba1..a7e28ff624800 100644 --- a/components/frontapp/actions/list-conversations/list-conversations.mjs +++ b/components/frontapp/actions/list-conversations/list-conversations.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-list-conversations", name: "List Conversations", description: "List conversations in the company. [See the documentation](https://dev.frontapp.com/reference/list-conversations)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/list-knowledge-base-articles/list-knowledge-base-articles.mjs b/components/frontapp/actions/list-knowledge-base-articles/list-knowledge-base-articles.mjs new file mode 100644 index 0000000000000..db53609095b12 --- /dev/null +++ b/components/frontapp/actions/list-knowledge-base-articles/list-knowledge-base-articles.mjs @@ -0,0 +1,46 @@ +import frontapp from "../../frontapp.app.mjs"; + +export default { + key: "frontapp-list-knowledge-base-articles", + name: "List Knowledge Base Articles", + description: "List articles in a knowledge base. [See the documentation](https://dev.frontapp.com/reference/list-articles-in-a-knowledge-base)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + frontapp, + knowledgeBaseId: { + propDefinition: [ + frontapp, + "knowledgeBaseId", + ], + }, + maxResults: { + propDefinition: [ + frontapp, + "maxResults", + ], + }, + }, + async run({ $ }) { + const articles = []; + + for await (const article of this.frontapp.paginate({ + fn: this.frontapp.listKnowledgeBaseArticles, + args: { + knowledgeBaseId: this.knowledgeBaseId, + }, + maxResults: this.maxResults, + })) { + articles.push(article); + } + + $.export("$summary", `Successfully retrieved ${articles.length} articles from knowledge base ${this.knowledgeBaseId}`); + + return articles; + }, +}; diff --git a/components/frontapp/actions/list-knowledge-base-categories/list-knowledge-base-categories.mjs b/components/frontapp/actions/list-knowledge-base-categories/list-knowledge-base-categories.mjs new file mode 100644 index 0000000000000..38197c292e476 --- /dev/null +++ b/components/frontapp/actions/list-knowledge-base-categories/list-knowledge-base-categories.mjs @@ -0,0 +1,46 @@ +import frontapp from "../../frontapp.app.mjs"; + +export default { + key: "frontapp-list-knowledge-base-categories", + name: "List Knowledge Base Categories", + description: "List categories in a knowledge base. [See the documentation](https://dev.frontapp.com/reference/list-categories-in-a-knowledge-base)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + frontapp, + knowledgeBaseId: { + propDefinition: [ + frontapp, + "knowledgeBaseId", + ], + }, + maxResults: { + propDefinition: [ + frontapp, + "maxResults", + ], + }, + }, + async run({ $ }) { + const categories = []; + + for await (const category of this.frontapp.paginate({ + fn: this.frontapp.listKnowledgeBaseCategories, + args: { + knowledgeBaseId: this.knowledgeBaseId, + }, + maxResults: this.maxResults, + })) { + categories.push(category); + } + + $.export("$summary", `Successfully retrieved ${categories.length} categories from knowledge base ${this.knowledgeBaseId}`); + + return categories; + }, +}; diff --git a/components/frontapp/actions/list-knowledge-bases/list-knowledge-bases.mjs b/components/frontapp/actions/list-knowledge-bases/list-knowledge-bases.mjs new file mode 100644 index 0000000000000..68186df383853 --- /dev/null +++ b/components/frontapp/actions/list-knowledge-bases/list-knowledge-bases.mjs @@ -0,0 +1,26 @@ +import frontapp from "../../frontapp.app.mjs"; + +export default { + key: "frontapp-list-knowledge-bases", + name: "List Knowledge Bases", + description: "List the knowledge bases of the company. [See the documentation](https://dev.frontapp.com/reference/list-knowledge-bases)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + frontapp, + }, + async run({ $ }) { + const response = await this.frontapp.listKnowledgeBases({ + $, + }); + + $.export("$summary", `Successfully retrieved ${response._results.length} knowledge bases`); + + return response._results; + }, +}; diff --git a/components/frontapp/actions/list-message-template-folders/list-message-template-folders.mjs b/components/frontapp/actions/list-message-template-folders/list-message-template-folders.mjs new file mode 100644 index 0000000000000..c130dad0af9e8 --- /dev/null +++ b/components/frontapp/actions/list-message-template-folders/list-message-template-folders.mjs @@ -0,0 +1,52 @@ +import frontapp from "../../frontapp.app.mjs"; + +export default { + key: "frontapp-list-message-template-folders", + name: "List Message Template Folders", + description: "List the message template folders. [See the documentation](https://dev.frontapp.com/reference/list-folders)", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + type: "action", + props: { + frontapp, + sortBy: { + type: "string", + label: "Sort By", + description: "Field used to sort the message template folders. Either `created_at` or `updated_at`.", + optional: true, + }, + sortOrder: { + type: "string", + label: "Sort Order", + description: "Order by which results should be sorted", + options: [ + "asc", + "desc", + ], + optional: true, + }, + }, + async run({ $ }) { + const params = {}; + + if (this.sortBy) { + params.sort_by = this.sortBy; + } + if (this.sortOrder) { + params.sort_order = this.sortOrder; + } + + const response = await this.frontapp.listMessageTemplateFolders({ + $, + params, + }); + + $.export("$summary", `Successfully retrieved ${response._results.length} message template folders`); + + return response._results; + }, +}; diff --git a/components/frontapp/actions/list-message-templates/list-message-templates.mjs b/components/frontapp/actions/list-message-templates/list-message-templates.mjs index 6e9ff9c069877..b5fc2a174a3d1 100644 --- a/components/frontapp/actions/list-message-templates/list-message-templates.mjs +++ b/components/frontapp/actions/list-message-templates/list-message-templates.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-list-message-templates", name: "List Message Templates", description: "List the message templates. [See the documentation](https://dev.frontapp.com/reference/list-message-templates).", - version: "0.0.4", + version: "0.0.5", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/list-teammates/list-teammates.mjs b/components/frontapp/actions/list-teammates/list-teammates.mjs index 83b6dba04b9ac..63a82c2da6503 100644 --- a/components/frontapp/actions/list-teammates/list-teammates.mjs +++ b/components/frontapp/actions/list-teammates/list-teammates.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-list-teammates", name: "List Teammate", description: "List teammates in the company. [See the documentation](https://dev.frontapp.com/reference/list-teammates)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/receive-custom-messages/receive-custom-messages.mjs b/components/frontapp/actions/receive-custom-messages/receive-custom-messages.mjs index 1e7f81fe6e666..f4e849fd2e278 100644 --- a/components/frontapp/actions/receive-custom-messages/receive-custom-messages.mjs +++ b/components/frontapp/actions/receive-custom-messages/receive-custom-messages.mjs @@ -5,7 +5,7 @@ export default { key: "frontapp-receive-custom-messages", name: "Receive Custom Messages", description: "Receive a custom message in Front. [See the documentation](https://dev.frontapp.com/reference/post_channels-channel-id-incoming-messages).", - version: "0.0.8", + version: "0.0.9", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/reply-to-conversation/reply-to-conversation.mjs b/components/frontapp/actions/reply-to-conversation/reply-to-conversation.mjs index 75c6616ef7436..5cd13cd036d7e 100644 --- a/components/frontapp/actions/reply-to-conversation/reply-to-conversation.mjs +++ b/components/frontapp/actions/reply-to-conversation/reply-to-conversation.mjs @@ -5,7 +5,7 @@ export default { key: "frontapp-reply-to-conversation", name: "Reply To Conversation", description: "Reply to a conversation by sending a message and appending it to the conversation. [See the documentation](https://dev.frontapp.com/reference/post_conversations-conversation-id-messages).", - version: "0.0.8", + version: "0.0.9", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/send-new-message/send-new-message.mjs b/components/frontapp/actions/send-new-message/send-new-message.mjs index 8b46a3c4ccf0b..658367dba1290 100644 --- a/components/frontapp/actions/send-new-message/send-new-message.mjs +++ b/components/frontapp/actions/send-new-message/send-new-message.mjs @@ -5,7 +5,7 @@ export default { key: "frontapp-send-new-message", name: "Send New Message", description: "Sends a new message from a channel. It will create a new conversation. [See the documentation](https://dev.frontapp.com/reference/post_channels-channel-id-messages).", - version: "0.2.10", + version: "0.2.11", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/tag-conversation/tag-conversation.mjs b/components/frontapp/actions/tag-conversation/tag-conversation.mjs index 4c99f1fd4923e..2479c41d8483e 100644 --- a/components/frontapp/actions/tag-conversation/tag-conversation.mjs +++ b/components/frontapp/actions/tag-conversation/tag-conversation.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-tag-conversation", name: "Tag Conversation", description: "Add tags to a conversation. [See the documentation](https://dev.frontapp.com/reference/patch_conversations-conversation-id)", - version: "0.0.5", + version: "0.0.6", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/frontapp/actions/update-conversation/update-conversation.mjs b/components/frontapp/actions/update-conversation/update-conversation.mjs index 9dcec7f732507..5a8f8044b9d1a 100644 --- a/components/frontapp/actions/update-conversation/update-conversation.mjs +++ b/components/frontapp/actions/update-conversation/update-conversation.mjs @@ -5,7 +5,7 @@ export default { key: "frontapp-update-conversation", name: "Update Conversation", description: "Updates a conversation. [See the documentation](https://dev.frontapp.com/reference/patch_conversations-conversation-id).", - version: "0.1.10", + version: "0.1.11", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/frontapp/actions/update-teammate/update-teammate.mjs b/components/frontapp/actions/update-teammate/update-teammate.mjs index 9ab967440f814..3f5b898c2a356 100644 --- a/components/frontapp/actions/update-teammate/update-teammate.mjs +++ b/components/frontapp/actions/update-teammate/update-teammate.mjs @@ -4,7 +4,7 @@ export default { key: "frontapp-update-teammate", name: "Update Teammate", description: "Update a teammate. [See the documentation](https://dev.frontapp.com/reference/update-teammate).", - version: "0.0.4", + version: "0.0.5", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/frontapp/frontapp.app.mjs b/components/frontapp/frontapp.app.mjs index 6ce6d4adbcbf4..10f35fb1cdca0 100644 --- a/components/frontapp/frontapp.app.mjs +++ b/components/frontapp/frontapp.app.mjs @@ -309,6 +309,46 @@ export default { }, optional: true, }, + knowledgeBaseId: { + type: "string", + label: "Knowledge Base ID", + description: "The ID of the knowledge base", + async options() { + const { _results: bases } = await this.listKnowledgeBases(); + return bases.map(({ + id, type, + }) => ({ + label: `${id} (${type})`, + value: id, + })); + }, + }, + articleId: { + type: "string", + label: "Article ID", + description: "The ID of the article to fetch", + async options({ + prevContext, + knowledgeBaseId, + }) { + if (!knowledgeBaseId) { + return []; + } + return this.paginateOptions({ + prevContext, + listResourcesFn: this.listKnowledgeBaseArticles, + mapper: ({ + id, slug, + }) => ({ + label: slug, + value: id, + }), + args: { + knowledgeBaseId, + }, + }); + }, + }, }, methods: { getUrl(path, url) { @@ -642,6 +682,68 @@ export default { ...args, }); }, + async getMessageTemplate({ + messageTemplateId, ...args + } = {}) { + return this.makeRequest({ + path: `/message_templates/${messageTemplateId}`, + ...args, + }); + }, + async getMessageTemplateFolder({ + folderId, ...args + } = {}) { + return this.makeRequest({ + path: `/message_template_folders/${folderId}`, + ...args, + }); + }, + async listKnowledgeBases(args = {}) { + return this.makeRequest({ + path: "/knowledge_bases", + ...args, + }); + }, + async getKnowledgeBase({ + knowledgeBaseId, ...args + } = {}) { + return this.makeRequest({ + path: `/knowledge_bases/${knowledgeBaseId}`, + ...args, + }); + }, + async listKnowledgeBaseCategories({ + knowledgeBaseId, ...args + } = {}) { + return this.makeRequest({ + path: `/knowledge_bases/${knowledgeBaseId}/categories`, + ...args, + }); + }, + async listKnowledgeBaseArticles({ + knowledgeBaseId, ...args + } = {}) { + return this.makeRequest({ + path: `/knowledge_bases/${knowledgeBaseId}/articles`, + ...args, + }); + }, + async getKnowledgeBaseArticle({ + articleId, ...args + } = {}) { + return this.makeRequest({ + path: `/knowledge_base_articles/${articleId}`, + ...args, + }); + }, + async downloadArticleAttachment({ + articleId, attachmentId, ...args + } = {}) { + return this.makeRequest({ + path: `/knowledge_base_articles/${articleId}/download/${attachmentId}`, + ...args, + }); + }, async createMessage({ channelId, ...args }) { diff --git a/components/frontapp/package.json b/components/frontapp/package.json index 2068e0d6893ad..5ab03776a0cd2 100644 --- a/components/frontapp/package.json +++ b/components/frontapp/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/frontapp", - "version": "0.8.4", + "version": "0.9.0", "description": "Pipedream Frontapp Components", "main": "frontapp.app.mjs", "keywords": [ diff --git a/components/frontapp/sources/new-conversation-created/new-conversation-created.mjs b/components/frontapp/sources/new-conversation-created/new-conversation-created.mjs index a3328231e5ed9..eb464ae198d01 100644 --- a/components/frontapp/sources/new-conversation-created/new-conversation-created.mjs +++ b/components/frontapp/sources/new-conversation-created/new-conversation-created.mjs @@ -6,7 +6,7 @@ export default { key: "frontapp-new-conversation-created", name: "New Conversation Created", description: "Emit new event when a conversation is created. [See the documentation](https://dev.frontapp.com/reference/list-conversations)", - version: "0.0.5", + version: "0.0.6", type: "source", dedupe: "unique", methods: { diff --git a/components/frontapp/sources/new-conversation-state-change/new-conversation-state-change.mjs b/components/frontapp/sources/new-conversation-state-change/new-conversation-state-change.mjs index 046ba54970f13..9e38394b33537 100644 --- a/components/frontapp/sources/new-conversation-state-change/new-conversation-state-change.mjs +++ b/components/frontapp/sources/new-conversation-state-change/new-conversation-state-change.mjs @@ -7,7 +7,7 @@ export default { key: "frontapp-new-conversation-state-change", name: "New Conversation State Change", description: "Emit new event when a conversation reaches a specific state. [See the documentation](https://dev.frontapp.com/reference/list-events)", - version: "0.0.7", + version: "0.0.8", type: "source", dedupe: "unique", props: { diff --git a/components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs b/components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs index a32970a437d60..f38d20a357035 100644 --- a/components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs +++ b/components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs @@ -6,7 +6,7 @@ export default { key: "frontapp-new-conversation-tag", name: "New Conversation Tag", description: "Emit new event when a conversation is tagged with a specific tag or any tag. [See the documentation](https://dev.frontapp.com/reference/events)", - version: "0.0.7", + version: "0.0.8", type: "source", dedupe: "unique", props: { diff --git a/components/frontapp/sources/new-message-template-created/new-message-template-created.mjs b/components/frontapp/sources/new-message-template-created/new-message-template-created.mjs index 396175b70ede3..8c675eef69abc 100644 --- a/components/frontapp/sources/new-message-template-created/new-message-template-created.mjs +++ b/components/frontapp/sources/new-message-template-created/new-message-template-created.mjs @@ -6,7 +6,7 @@ export default { key: "frontapp-new-message-template-created", name: "New Message Template Created", description: "Emit new event when a message template is created. [See the documentation](https://dev.frontapp.com/reference/list-message-templates)", - version: "0.0.5", + version: "0.0.6", type: "source", dedupe: "unique", methods: {