-
Notifications
You must be signed in to change notification settings - Fork 5.5k
FrontApp - new actions #16247
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
+858
−27
Merged
FrontApp - new actions #16247
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import frontApp from "../../frontapp.app.mjs"; | ||
| import utils from "../../common/utils.mjs"; | ||
|
|
||
| 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.1", | ||
| type: "action", | ||
| props: { | ||
| frontApp, | ||
| conversationId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "conversationId", | ||
| ], | ||
| }, | ||
| body: { | ||
| type: "string", | ||
| label: "Body", | ||
| description: "Content of the comment. Can include markdown formatting.", | ||
| }, | ||
| authorId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "teammateId", | ||
| ], | ||
| label: "Author ID", | ||
| optional: true, | ||
| }, | ||
| isPinned: { | ||
| type: "boolean", | ||
| label: "Is Pinned?", | ||
| description: "Whether or not the comment is pinned in its conversation", | ||
| optional: true, | ||
| }, | ||
| attachments: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "attachments", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.frontApp.addComment({ | ||
| $, | ||
| conversationId: this.conversationId, | ||
| data: { | ||
| body: this.body, | ||
| author_id: this.authorId, | ||
| is_pinned: this.isPinned, | ||
| attachments: this.attachments, | ||
| }, | ||
| headers: utils.hasArrayItems(this.attachments) && { | ||
| "Content-Type": "multipart/form-data", | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created comment with ID: ${response.id}`); | ||
| return response; | ||
| }, | ||
| }; |
29 changes: 29 additions & 0 deletions
29
components/frontapp/actions/archive-conversation/archive-conversation.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,29 @@ | ||
| import frontApp from "../../frontapp.app.mjs"; | ||
|
|
||
| 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.1", | ||
| type: "action", | ||
| props: { | ||
| frontApp, | ||
| conversationId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "conversationId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.frontApp.updateConversation({ | ||
| $, | ||
| conversationId: this.conversationId, | ||
| data: { | ||
| status: "archived", | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully archived conversation with ID: ${this.conversationId}`); | ||
| return response; | ||
| }, | ||
| }; |
37 changes: 37 additions & 0 deletions
37
components/frontapp/actions/assign-conversation/assign-conversation.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,37 @@ | ||
| import frontApp from "../../frontapp.app.mjs"; | ||
|
|
||
| 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.1", | ||
| type: "action", | ||
| props: { | ||
| frontApp, | ||
| conversationId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "conversationId", | ||
| ], | ||
| }, | ||
| assigneeId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "teammateId", | ||
| ], | ||
| label: "Assignee ID", | ||
| description: "ID of the contact to assign", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.frontApp.updateConversationAssignee({ | ||
| $, | ||
| conversationId: this.conversationId, | ||
| data: { | ||
| assignee_id: this.assigneeId, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully assigned contact to conversation with ID: ${this.conversationId}`); | ||
| return response; | ||
| }, | ||
| }; |
125 changes: 125 additions & 0 deletions
125
components/frontapp/actions/create-draft-reply/create-draft-reply.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,125 @@ | ||
| import frontApp from "../../frontapp.app.mjs"; | ||
| import utils from "../../common/utils.mjs"; | ||
|
|
||
| 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.1", | ||
| type: "action", | ||
| props: { | ||
| frontApp, | ||
| teamId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "teamId", | ||
| ], | ||
| }, | ||
| conversationId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "conversationId", | ||
| ], | ||
| }, | ||
| channelId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "channelId", | ||
| ], | ||
| }, | ||
| body: { | ||
| type: "string", | ||
| label: "Body", | ||
| description: "Body of the draft reply. Accepts HTML", | ||
| }, | ||
| subject: { | ||
| type: "string", | ||
| label: "Subject", | ||
| description: "Subject of the draft reply", | ||
| optional: true, | ||
| }, | ||
| authorId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "teammateId", | ||
| ], | ||
| label: "Author ID", | ||
| }, | ||
| to: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "to", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| cc: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "cc", | ||
| ], | ||
| }, | ||
| bcc: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "bcc", | ||
| ], | ||
| }, | ||
| attachments: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "attachments", | ||
| ], | ||
| }, | ||
| mode: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "mode", | ||
| ], | ||
| }, | ||
| signatureId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "signatureId", | ||
| (c) => ({ | ||
| teamId: c.teamId, | ||
| }), | ||
| ], | ||
| }, | ||
| shouldAddDefaultSignature: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "shouldAddDefaultSignature", | ||
| ], | ||
| }, | ||
| quoteBody: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "quoteBody", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.frontApp.createDraftReply({ | ||
| $, | ||
| conversationId: this.conversationId, | ||
| data: { | ||
| channel_id: this.channelId, | ||
| body: this.body, | ||
| author_id: this.authorId, | ||
| to: this.to, | ||
| cc: this.cc, | ||
| bcc: this.bcc, | ||
| attachments: this.attachments, | ||
| mode: this.mode, | ||
| signature_id: this.signatureId, | ||
| should_add_default_signature: this.shouldAddDefaultSignature, | ||
| quote_body: this.quoteBody, | ||
| }, | ||
| headers: utils.hasArrayItems(this.attachments) && { | ||
| "Content-Type": "multipart/form-data", | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created draft reply with ID: ${response.id}`); | ||
| return response; | ||
| }, | ||
| }; |
118 changes: 118 additions & 0 deletions
118
components/frontapp/actions/create-draft/create-draft.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,118 @@ | ||
| import frontApp from "../../frontapp.app.mjs"; | ||
| import utils from "../../common/utils.mjs"; | ||
|
|
||
| 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.1", | ||
| type: "action", | ||
| props: { | ||
| frontApp, | ||
| teamId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "teamId", | ||
| ], | ||
| }, | ||
| channelId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "channelId", | ||
| ], | ||
| }, | ||
| body: { | ||
| type: "string", | ||
| label: "Body", | ||
| description: "Body of the draft message. Accepts HTML", | ||
| }, | ||
| subject: { | ||
| type: "string", | ||
| label: "Subject", | ||
| description: "Subject of the draft", | ||
| optional: true, | ||
| }, | ||
| authorId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "teammateId", | ||
| ], | ||
| label: "Author ID", | ||
| }, | ||
| to: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "to", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| cc: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "cc", | ||
| ], | ||
| }, | ||
| bcc: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "bcc", | ||
| ], | ||
| }, | ||
| attachments: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "attachments", | ||
| ], | ||
| }, | ||
| mode: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "mode", | ||
| ], | ||
| }, | ||
| signatureId: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "signatureId", | ||
| (c) => ({ | ||
| teamId: c.teamId, | ||
| }), | ||
| ], | ||
| }, | ||
| shouldAddDefaultSignature: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "shouldAddDefaultSignature", | ||
| ], | ||
| }, | ||
| quoteBody: { | ||
| propDefinition: [ | ||
| frontApp, | ||
| "quoteBody", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.frontApp.createDraft({ | ||
| $, | ||
| channelId: this.channelId, | ||
| data: { | ||
| body: this.body, | ||
| author_id: this.authorId, | ||
| to: this.to, | ||
| cc: this.cc, | ||
| bcc: this.bcc, | ||
| attachments: this.attachments, | ||
| mode: this.mode, | ||
| signature_id: this.signatureId, | ||
| should_add_default_signature: this.shouldAddDefaultSignature, | ||
| quote_body: this.quoteBody, | ||
| }, | ||
| headers: utils.hasArrayItems(this.attachments) && { | ||
| "Content-Type": "multipart/form-data", | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created draft with ID: ${response.id}`); | ||
| return response; | ||
| }, | ||
| }; | ||
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.
Uh oh!
There was an error while loading. Please reload this page.