- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
Frontapp new components #17689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frontapp new components #17689
Changes from 7 commits
61b8e0d
              99f6ccf
              97c7644
              25bc805
              10ae11b
              4b38191
              7c5ca08
              43b137a
              75af305
              065f312
              aed9e74
              808b816
              f388c24
              f479969
              48f1c7d
              a561db5
              a029644
              6a67cb7
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import frontApp from "../../frontapp.app.mjs"; | ||
|  | ||
| 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.1", | ||
| type: "action", | ||
| props: { | ||
| frontApp, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "The name of the inbox", | ||
| }, | ||
| teammateIds: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "teammateId", | ||
| ], | ||
| type: "string[]", | ||
| label: "Teammate IDs", | ||
| description: "One or more IDs of teammates that should have access to the inbox", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| frontApp, | ||
| name, | ||
| teammateIds, | ||
| } = this; | ||
|  | ||
| const data = { | ||
| name, | ||
| teammate_ids: teammateIds, | ||
| }; | ||
|  | ||
| const response = await frontApp.createInbox({ | ||
| data, | ||
| $, | ||
| }); | ||
|  | ||
| $.export("$summary", `Successfully created inbox "${name}"`); | ||
| return response; | ||
| }, | ||
| }; | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| import FormData from "form-data"; | ||
| import { getFileStreamAndMetadata } from "@pipedream/platform"; | ||
| import frontApp from "../../frontapp.app.mjs"; | ||
|  | ||
| 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.1", | ||
| type: "action", | ||
| props: { | ||
| frontApp, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "Name of the message template", | ||
| }, | ||
| subject: { | ||
| type: "string", | ||
| label: "Subject", | ||
| description: "Subject of the message template", | ||
| optional: true, | ||
| }, | ||
| body: { | ||
| type: "string", | ||
| label: "Body", | ||
| description: "Body of the message template. You can supply HTML with inline CSS to structure and style your template", | ||
| }, | ||
| folderId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "folderId", | ||
| ], | ||
| description: "ID of the message template folder to place this message template in", | ||
| }, | ||
| inboxIds: { | ||
| type: "string[]", | ||
| label: "Inbox IDs", | ||
| description: "The specific inboxes this template is available in. If not specified, it will be available in all inboxes", | ||
| propDefinition: [ | ||
| frontApp, | ||
| "inboxId", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| attachments: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "attachments", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| frontApp, | ||
| name, | ||
| subject, | ||
| body, | ||
| folderId, | ||
| inboxIds, | ||
| attachments, | ||
| } = this; | ||
|  | ||
| let data, headers = {}; | ||
|  | ||
| // Handle attachments if provided | ||
| if (attachments?.length > 0) { | ||
| const formData = new FormData(); | ||
|  | ||
| formData.append("name", name); | ||
| formData.append("body", body); | ||
| if (subject !== undefined) { | ||
| formData.append("subject", subject); | ||
| } | ||
| if (folderId !== undefined) { | ||
| formData.append("folder_id", folderId); | ||
| } | ||
| if (inboxIds !== undefined) { | ||
| formData.append("inbox_ids", inboxIds); | ||
| } | ||
|  | ||
| for (const attachment of attachments) { | ||
| const { | ||
| stream, metadata, | ||
| } = await getFileStreamAndMetadata(attachment); | ||
| formData.append("attachments", stream, { | ||
| contentType: metadata.contentType, | ||
| knownLength: metadata.size, | ||
| filename: metadata.name, | ||
| }); | ||
| } | ||
|  | ||
| data = formData; | ||
| headers = formData.getHeaders(); | ||
| } else { | ||
| // Simple JSON request without attachments | ||
| data = { | ||
| name, | ||
| subject, | ||
| body, | ||
| folder_id: folderId, | ||
| inbox_ids: inboxIds, | ||
| }; | ||
| } | ||
|  | ||
| const response = await frontApp.createMessageTemplate({ | ||
| data, | ||
| headers, | ||
| $, | ||
| }); | ||
|  | ||
| $.export("$summary", `Successfully created message template "${name}"`); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import frontApp from "../../frontapp.app.mjs"; | ||
|  | ||
| 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.1", | ||
| type: "action", | ||
| props: { | ||
| frontApp, | ||
| messageTemplateId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "messageTemplateId", | ||
| ], | ||
| description: "ID of the message template to delete", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| frontApp, | ||
| messageTemplateId, | ||
| } = this; | ||
|  | ||
| const response = await frontApp.deleteMessageTemplate({ | ||
| messageTemplateId, | ||
| $, | ||
| }); | ||
|  | ||
| $.export("$summary", `Successfully deleted message template ${messageTemplateId}`); | ||
| return response; | ||
| }, | ||
| }; | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import frontApp from "../../frontapp.app.mjs"; | ||
|  | ||
| 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.1", | ||
| type: "action", | ||
| props: { | ||
| frontApp, | ||
| sortBy: { | ||
| type: "string", | ||
| label: "Sort By", | ||
|          | ||
| description: "Field used to sort the message templates", | ||
| options: [ | ||
| "created_at", | ||
| "updated_at", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| sortOrder: { | ||
| type: "string", | ||
| label: "Sort Order", | ||
| description: "Order by which results should be sorted", | ||
| options: [ | ||
| { | ||
| label: "Ascending", | ||
| value: "asc", | ||
| }, | ||
| { | ||
| label: "Descending", | ||
| value: "desc", | ||
| }, | ||
| ], | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| frontApp, | ||
| sortBy, | ||
| sortOrder, | ||
| } = this; | ||
|  | ||
| const response = await frontApp.listMessageTemplates({ | ||
| $, | ||
| params: { | ||
| sort_by: sortBy, | ||
| sort_order: sortOrder, | ||
| }, | ||
| }); | ||
|  | ||
| const templates = response._results || []; | ||
| const length = templates.length; | ||
| $.export("$summary", `Successfully retrieved ${length} message template${length === 1 | ||
| ? "" | ||
| : "s"}`); | ||
|  | ||
| return response; | ||
| }, | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we're supposed to be adding
syncDirto components that work with the /tmp directory.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
syncDirprop has to do with File Stash. https://pipedream.com/docs/connect/components/files