- 
                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
          
     Merged
      
      
    
  
     Merged
                    Frontapp new components #17689
Changes from 14 commits
      Commits
    
    
            Show all changes
          
          
            18 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      61b8e0d
              
                package version bump
              
              
                GTFalcao 99f6ccf
              
                Adding new actions and adjusting minor things
              
              
                GTFalcao 97c7644
              
                Description improvements
              
              
                GTFalcao 25bc805
              
                Adding sources
              
              
                GTFalcao 10ae11b
              
                Version bumps
              
              
                GTFalcao 4b38191
              
                Checking for undefined values on formData
              
              
                GTFalcao 7c5ca08
              
                Merge branch 'master' into 17465-front
              
              
                GTFalcao 43b137a
              
                Adjusting pagination for 'list message templates'
              
              
                GTFalcao 75af305
              
                pnpm
              
              
                GTFalcao 065f312
              
                Updating sources to timestamp-based
              
              
                GTFalcao aed9e74
              
                Adjusting timestamp setting
              
              
                GTFalcao 808b816
              
                Adding syncDir prop
              
              
                GTFalcao f388c24
              
                Re-adding sortBy and sortOrder
              
              
                GTFalcao f479969
              
                Re-adding missing filterFn calls
              
              
                GTFalcao 48f1c7d
              
                Adjusting form data checking
              
              
                GTFalcao a561db5
              
                Fixing bug on sources
              
              
                GTFalcao a029644
              
                Adjusting inboxIds array format
              
              
                GTFalcao 6a67cb7
              
                Timestamp fix for event emission
              
              
                GTFalcao File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | 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; | ||
| }, | ||
| }; | 
        
          
          
            121 changes: 121 additions & 0 deletions
          
          121 
        
  components/frontapp/actions/create-message-template/create-message-template.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| 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", | ||
| ], | ||
| }, | ||
| syncDir: { | ||
| type: "dir", | ||
| accessMode: "read", | ||
| sync: true, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| 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; | ||
| }, | ||
| }; | ||
        
          
          
            33 changes: 33 additions & 0 deletions
          
          33 
        
  components/frontapp/actions/delete-message-template/delete-message-template.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | 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; | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            70 changes: 70 additions & 0 deletions
          
          70 
        
  components/frontapp/actions/list-message-templates/list-message-templates.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| 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 Field", | ||
| description: "Field used to sort the message templates", | ||
| options: [ | ||
| { | ||
| label: "Created At", | ||
| value: "created_at", | ||
| }, | ||
| { | ||
| label: "Updated At", | ||
| value: "updated_at", | ||
| }, | ||
| ], | ||
| optional: true, | ||
| }, | ||
|         
                  GTFalcao marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| 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, | ||
| }, | ||
| maxResults: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "maxResults", | ||
| ], | ||
| }, | ||
| }, | ||
|         
                  michelle0927 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| async run({ $ }) { | ||
| const items = this.frontApp.paginate({ | ||
| fn: this.frontApp.listMessageTemplates, | ||
| params: { | ||
| sort_by: this.sortBy, | ||
| sort_order: this.sortOrder, | ||
| }, | ||
| maxResults: this.maxResults, | ||
|         
                  GTFalcao marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| $, | ||
| }); | ||
|  | ||
| const results = []; | ||
| for await (const item of items) { | ||
| results.push(item); | ||
| } | ||
| $.export("$summary", `Successfully retrieved ${results?.length} message template${results?.length === 1 | ||
| ? "" | ||
| : "s"}`); | ||
| return results; | ||
| }, | ||
| }; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
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