Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 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
2 changes: 1 addition & 1 deletion components/frontapp/actions/add-comment/add-comment.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.1",
version: "0.0.2",
type: "action",
props: {
frontApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.1",
version: "0.0.2",
type: "action",
props: {
frontApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.1",
version: "0.0.2",
type: "action",
props: {
frontApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.1",
version: "0.0.2",
type: "action",
props: {
frontApp,
Expand Down
2 changes: 1 addition & 1 deletion components/frontapp/actions/create-draft/create-draft.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.1",
version: "0.0.2",
type: "action",
props: {
frontApp,
Expand Down
47 changes: 47 additions & 0 deletions components/frontapp/actions/create-inbox/create-inbox.mjs
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,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",
],
},
Comment on lines +46 to +51
Copy link
Collaborator

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 syncDir to components that work with the /tmp directory.

Suggested change
attachments: {
propDefinition: [
frontApp,
"attachments",
],
},
attachments: {
propDefinition: [
frontApp,
"attachments",
],
},
syncDir: {
type: "dir",
accessMode: "write",
sync: true,
},

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syncDir prop has to do with File Stash. https://pipedream.com/docs/connect/components/files

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;
},
};
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;
},
};
2 changes: 1 addition & 1 deletion components/frontapp/actions/get-comment/get-comment.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.1",
version: "0.0.2",
type: "action",
props: {
frontApp,
Expand Down
2 changes: 1 addition & 1 deletion components/frontapp/actions/get-teammate/get-teammate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.1",
version: "0.0.2",
type: "action",
props: {
frontApp,
Expand Down
4 changes: 2 additions & 2 deletions components/frontapp/actions/import-message/import-message.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import frontApp from "../../frontapp.app.mjs";
export default {
key: "frontapp-import-message",
name: "Import Message",
description: "Appends a new message into an inbox. [See the docs here](https://dev.frontapp.com/reference/import-inbox-message).",
version: "0.1.7",
description: "Appends a new message into an inbox. [See the documentation](https://dev.frontapp.com/reference/import-inbox-message).",
version: "0.1.8",
type: "action",
props: {
frontApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.1",
version: "0.0.2",
type: "action",
props: {
frontApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.1",
version: "0.0.2",
type: "action",
props: {
frontApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.1",
version: "0.0.2",
type: "action",
props: {
frontApp,
Expand Down
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,
},
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",
],
},
},
async run({ $ }) {
const items = this.frontApp.paginate({
fn: this.frontApp.listMessageTemplates,
params: {
sort_by: this.sortBy,
sort_order: this.sortOrder,
},
maxResults: this.maxResults,
$,
});

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;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -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.1",
version: "0.0.2",
type: "action",
props: {
frontApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import frontApp from "../../frontapp.app.mjs";
export default {
key: "frontapp-receive-custom-messages",
name: "Receive Custom Messages",
description: "Receive a custom message in Front. [See the docs here](https://dev.frontapp.com/reference/post_channels-channel-id-incoming-messages).",
version: "0.0.4",
description: "Receive a custom message in Front. [See the documentation](https://dev.frontapp.com/reference/post_channels-channel-id-incoming-messages).",
version: "0.0.5",
type: "action",
props: {
frontApp,
Expand Down
Loading
Loading