Skip to content

Commit cfe7a67

Browse files
authored
Frontapp new components (#17689)
* package version bump * Adding new actions and adjusting minor things * Description improvements * Adding sources * Version bumps * Checking for undefined values on formData * Adjusting pagination for 'list message templates' * pnpm * Updating sources to timestamp-based * Adjusting timestamp setting * Adding syncDir prop * Re-adding sortBy and sortOrder * Re-adding missing filterFn calls * Adjusting form data checking * Fixing bug on sources * Adjusting inboxIds array format * Timestamp fix for event emission
1 parent 0471e62 commit cfe7a67

File tree

33 files changed

+715
-36
lines changed

33 files changed

+715
-36
lines changed

components/frontapp/actions/add-comment/add-comment.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "frontapp-add-comment",
66
name: "Add Comment",
77
description: "Add a comment to a conversation. [See the documentation](https://dev.frontapp.com/reference/add-comment)",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "action",
1010
props: {
1111
frontApp,

components/frontapp/actions/archive-conversation/archive-conversation.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "frontapp-archive-conversation",
55
name: "Archive Conversation",
66
description: "Archives a conversation. [See the documentation](https://dev.frontapp.com/reference/patch_conversations-conversation-id)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
frontApp,

components/frontapp/actions/assign-conversation/assign-conversation.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "frontapp-assign-conversation",
55
name: "Assign Conversation",
66
description: "Assign or unassign a conversation. [See the documentation](https://dev.frontapp.com/reference/update-conversation-assignee)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
frontApp,

components/frontapp/actions/create-draft-reply/create-draft-reply.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "frontapp-create-draft-reply",
66
name: "Create Draft Reply",
77
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)",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "action",
1010
props: {
1111
frontApp,

components/frontapp/actions/create-draft/create-draft.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "frontapp-create-draft",
66
name: "Create Draft",
77
description: "Create a draft message which is the first message of a new conversation. [See the documentation](https://dev.frontapp.com/reference/create-draft)",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "action",
1010
props: {
1111
frontApp,
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import frontApp from "../../frontapp.app.mjs";
2+
3+
export default {
4+
key: "frontapp-create-inbox",
5+
name: "Create Inbox",
6+
description: "Create an inbox in the default team (workspace). [See the documentation](https://dev.frontapp.com/reference/create-inbox).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
frontApp,
11+
name: {
12+
type: "string",
13+
label: "Name",
14+
description: "The name of the inbox",
15+
},
16+
teammateIds: {
17+
propDefinition: [
18+
frontApp,
19+
"teammateId",
20+
],
21+
type: "string[]",
22+
label: "Teammate IDs",
23+
description: "One or more IDs of teammates that should have access to the inbox",
24+
optional: true,
25+
},
26+
},
27+
async run({ $ }) {
28+
const {
29+
frontApp,
30+
name,
31+
teammateIds,
32+
} = this;
33+
34+
const data = {
35+
name,
36+
teammate_ids: teammateIds,
37+
};
38+
39+
const response = await frontApp.createInbox({
40+
data,
41+
$,
42+
});
43+
44+
$.export("$summary", `Successfully created inbox "${name}"`);
45+
return response;
46+
},
47+
};
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
import FormData from "form-data";
2+
import { getFileStreamAndMetadata } from "@pipedream/platform";
3+
import frontApp from "../../frontapp.app.mjs";
4+
5+
export default {
6+
key: "frontapp-create-message-template",
7+
name: "Create Message Template",
8+
description: "Create a new message template. [See the documentation](https://dev.frontapp.com/reference/create-message-template).",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
frontApp,
13+
name: {
14+
type: "string",
15+
label: "Name",
16+
description: "Name of the message template",
17+
},
18+
subject: {
19+
type: "string",
20+
label: "Subject",
21+
description: "Subject of the message template",
22+
optional: true,
23+
},
24+
body: {
25+
type: "string",
26+
label: "Body",
27+
description: "Body of the message template. You can supply HTML with inline CSS to structure and style your template",
28+
},
29+
folderId: {
30+
propDefinition: [
31+
frontApp,
32+
"folderId",
33+
],
34+
description: "ID of the message template folder to place this message template in",
35+
},
36+
inboxIds: {
37+
type: "string[]",
38+
label: "Inbox IDs",
39+
description: "The specific inboxes this template is available in. If not specified, it will be available in all inboxes",
40+
propDefinition: [
41+
frontApp,
42+
"inboxId",
43+
],
44+
optional: true,
45+
},
46+
attachments: {
47+
propDefinition: [
48+
frontApp,
49+
"attachments",
50+
],
51+
},
52+
syncDir: {
53+
type: "dir",
54+
accessMode: "read",
55+
sync: true,
56+
optional: true,
57+
},
58+
},
59+
async run({ $ }) {
60+
const {
61+
frontApp,
62+
name,
63+
subject,
64+
body,
65+
folderId,
66+
inboxIds,
67+
attachments,
68+
} = this;
69+
70+
let data, headers = {};
71+
72+
// Handle attachments if provided
73+
if (attachments?.length > 0) {
74+
const formData = new FormData();
75+
76+
formData.append("name", name);
77+
formData.append("body", body);
78+
if (subject !== undefined) {
79+
formData.append("subject", subject);
80+
}
81+
if (folderId !== undefined) {
82+
formData.append("folder_id", folderId);
83+
}
84+
if (typeof inboxIds === "string") {
85+
formData.append("inbox_ids", inboxIds);
86+
} else if (Array.isArray(inboxIds)) {
87+
for (const inboxId of inboxIds) {
88+
formData.append("inbox_ids", inboxId);
89+
}
90+
}
91+
92+
for (const attachment of attachments) {
93+
const {
94+
stream, metadata,
95+
} = await getFileStreamAndMetadata(attachment);
96+
formData.append("attachments", stream, {
97+
contentType: metadata.contentType,
98+
knownLength: metadata.size,
99+
filename: metadata.name,
100+
});
101+
}
102+
103+
data = formData;
104+
headers = formData.getHeaders();
105+
} else {
106+
// Simple JSON request without attachments
107+
data = {
108+
name,
109+
subject,
110+
body,
111+
folder_id: folderId,
112+
inbox_ids: inboxIds,
113+
};
114+
}
115+
116+
const response = await frontApp.createMessageTemplate({
117+
data,
118+
headers,
119+
$,
120+
});
121+
122+
$.export("$summary", `Successfully created message template "${name}"`);
123+
return response;
124+
},
125+
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import frontApp from "../../frontapp.app.mjs";
2+
3+
export default {
4+
key: "frontapp-delete-message-template",
5+
name: "Delete Message Template",
6+
description: "Delete a message template. [See the documentation](https://dev.frontapp.com/reference/delete-message-template).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
frontApp,
11+
messageTemplateId: {
12+
propDefinition: [
13+
frontApp,
14+
"messageTemplateId",
15+
],
16+
description: "ID of the message template to delete",
17+
},
18+
},
19+
async run({ $ }) {
20+
const {
21+
frontApp,
22+
messageTemplateId,
23+
} = this;
24+
25+
const response = await frontApp.deleteMessageTemplate({
26+
messageTemplateId,
27+
$,
28+
});
29+
30+
$.export("$summary", `Successfully deleted message template ${messageTemplateId}`);
31+
return response;
32+
},
33+
};

components/frontapp/actions/get-comment/get-comment.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "frontapp-get-comment",
55
name: "Get Comment",
66
description: "Retrieve a comment from a conversation. [See the documentation](https://dev.frontapp.com/reference/get-comment)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
frontApp,

components/frontapp/actions/get-teammate/get-teammate.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "frontapp-get-teammate",
55
name: "Get Teammate",
66
description: "Retrieve a teammate by ID. [See the documentation](https://dev.frontapp.com/reference/get-teammate)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
frontApp,

0 commit comments

Comments
 (0)