Skip to content

Commit 2320d5b

Browse files
committed
Adding page prop to 'get conversation threads'
1 parent a68c532 commit 2320d5b

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

components/help_scout/actions/get-conversation-threads/get-conversation-threads.mjs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,31 @@ export default {
1414
"conversationId",
1515
],
1616
},
17+
page: {
18+
type: "integer",
19+
label: "Page",
20+
description: "Page number to retrieve. By default, the 25 most recent threads are retrieved (page 1)",
21+
optional: true,
22+
default: 1,
23+
min: 1,
24+
},
1725
},
1826
async run({ $ }) {
19-
const response = (await this.helpScout.getConversationThreads({
27+
const response = await this.helpScout.getConversationThreads({
2028
$,
2129
conversationId: this.conversationId,
22-
}))?._embedded?.threads;
30+
params: {
31+
page: this.page,
32+
},
33+
});
34+
35+
const threads = response?._embedded?.threads;
36+
const pageInfo = response?.page;
2337

24-
$.export("$summary", `Successfully retrieved ${response?.length || 0} threads for conversation ID: ${this.conversationId}`);
25-
return response;
38+
$.export("$summary", `Successfully retrieved ${threads?.length || 0} threads for conversation ID: ${this.conversationId} (Page ${pageInfo?.number + 1 || this.page} of ${pageInfo?.totalPages || "unknown"})`);
39+
return {
40+
threads,
41+
pagination: pageInfo,
42+
};
2643
},
2744
};

0 commit comments

Comments
 (0)