Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions components/frontapp/actions/add-comment/add-comment.mjs
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;
},
};
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;
},
};
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;
},
};
126 changes: 126 additions & 0 deletions components/frontapp/actions/create-draft-reply/create-draft-reply.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
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,
subject: this.subject,
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;
},
};
119 changes: 119 additions & 0 deletions components/frontapp/actions/create-draft/create-draft.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
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,
subject: this.subject,
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;
},
};
Loading