Skip to content

Commit eca7334

Browse files
Front- new components (#17978)
* get message and get conversation * bump version
1 parent 3bda4ed commit eca7334

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import frontApp from "../../frontapp.app.mjs";
2+
3+
export default {
4+
key: "frontapp-get-conversation",
5+
name: "Get Conversation",
6+
description: "Retrieve a conversation by its ID from Front. [See the documentation](https://dev.frontapp.com/reference/get-conversation-by-id)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
frontApp,
11+
conversationId: {
12+
propDefinition: [
13+
frontApp,
14+
"conversationId",
15+
],
16+
},
17+
includeMessages: {
18+
type: "boolean",
19+
label: "Include Messages",
20+
description: "Whether to include all messages from the conversation",
21+
default: false,
22+
optional: true,
23+
},
24+
},
25+
async run({ $ }) {
26+
const conversation = await this.frontApp.getConversation({
27+
$,
28+
conversationId: this.conversationId,
29+
});
30+
31+
if (this.includeMessages) {
32+
const messages = [];
33+
for await (const message of this.frontapp.paginate({
34+
fn: this.frontapp.makeRequest,
35+
path: `/conversations/${this.conversationId}/messages`,
36+
})) {
37+
messages.push(message);
38+
}
39+
conversation.messages = messages;
40+
}
41+
42+
$.export("$summary", `Successfully retrieved conversation with ID: ${this.conversationId}`);
43+
44+
return conversation;
45+
},
46+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import frontApp from "../../frontapp.app.mjs";
2+
3+
export default {
4+
key: "frontapp-get-message",
5+
name: "Get Message",
6+
description: "Retrieve a message by its ID. [See the documentation](https://dev.frontapp.com/reference/get-message)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
frontApp,
11+
messageId: {
12+
type: "string",
13+
label: "Message ID",
14+
description: "The unique identifier of the message to retrieve",
15+
},
16+
},
17+
async run({ $ }) {
18+
const response = await this.frontApp.makeRequest({
19+
$,
20+
path: `/messages/${this.messageId}`,
21+
});
22+
$.export("$summary", `Successfully retrieved message with ID: ${this.messageId}`);
23+
return response;
24+
},
25+
};

components/frontapp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/frontapp",
3-
"version": "0.7.0",
3+
"version": "0.7.1",
44
"description": "Pipedream Frontapp Components",
55
"main": "frontapp.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)