Skip to content

Commit ede3f24

Browse files
committed
Adding new actions
1 parent 1320057 commit ede3f24

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import helpScout from "../../help_scout.app.mjs";
2+
3+
export default {
4+
key: "help_scout-get-conversation-details",
5+
name: "Get Conversation Details",
6+
description: "Retrieves the details of a specific conversation. [See the documentation](https://developer.helpscout.com/mailbox-api/endpoints/conversations/get/)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
helpScout,
11+
conversationId: {
12+
propDefinition: [
13+
helpScout,
14+
"conversationId",
15+
],
16+
},
17+
embed: {
18+
type: "boolean",
19+
label: "Embed",
20+
description: "If true, the response will include the threads of the conversation.",
21+
optional: true,
22+
},
23+
},
24+
async run({ $ }) {
25+
const response = await this.helpScout.getConversation({
26+
$,
27+
conversationId: this.conversationId,
28+
params: {
29+
embed: this.embed,
30+
},
31+
});
32+
33+
$.export("$summary", `Successfully retrieved conversation details (ID: ${this.conversationId})`);
34+
return response;
35+
},
36+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import helpScout from "../../help_scout.app.mjs";
2+
3+
export default {
4+
key: "help_scout-get-conversation-threads",
5+
name: "Get Conversation Threads",
6+
description: "Retrieves the threads of a specific conversation. [See the documentation](https://developer.helpscout.com/mailbox-api/endpoints/conversations/threads/list/)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
helpScout,
11+
conversationId: {
12+
propDefinition: [
13+
helpScout,
14+
"conversationId",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = (await this.helpScout.getConversationThreads({
20+
$,
21+
conversationId: this.conversationId,
22+
}))?._embedded?.threads;
23+
24+
$.export("$summary", `Successfully retrieved ${response?.length || 0} threads for conversation ID: ${this.conversationId}`);
25+
return response;
26+
},
27+
};

components/help_scout/help_scout.app.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,21 @@ export default {
146146
...opts,
147147
});
148148
},
149+
getConversation({
150+
conversationId, ...opts
151+
}) {
152+
return this._makeRequest({
153+
path: `/conversations/${conversationId}`,
154+
...opts,
155+
});
156+
},
157+
getConversationThreads({
158+
conversationId, ...opts
159+
}) {
160+
return this._makeRequest({
161+
path: `/conversations/${conversationId}/threads`,
162+
...opts,
163+
});
164+
},
149165
},
150166
};

0 commit comments

Comments
 (0)