File tree Expand file tree Collapse file tree 2 files changed +69
-1
lines changed Expand file tree Collapse file tree 2 files changed +69
-1
lines changed Original file line number Diff line number Diff line change 1+ import app from "../../freshchat.app.mjs" ;
2+
3+ export default {
4+ key : "freshchat-list-messages" ,
5+ name : "List Messages" ,
6+ description : "Lists all messages in a conversation. [See the documentation](https://developers.freshchat.com/api/#list_messages)" ,
7+ type : "action" ,
8+ version : "0.0.1" ,
9+ annotations : {
10+ destructiveHint : false ,
11+ openWorldHint : true ,
12+ readOnlyHint : true ,
13+ } ,
14+ props : {
15+ app,
16+ userId : {
17+ propDefinition : [
18+ app ,
19+ "userId" ,
20+ ] ,
21+ } ,
22+ conversationId : {
23+ propDefinition : [
24+ app ,
25+ "conversationId" ,
26+ ( { userId } ) => ( {
27+ userId,
28+ } ) ,
29+ ] ,
30+ } ,
31+ fromTime : {
32+ type : "string" ,
33+ label : "From Time" ,
34+ description : "UTC datetime to retrieve messages after this timestamp (ISO 8601 format)" ,
35+ optional : true ,
36+ } ,
37+ maxResults : {
38+ propDefinition : [
39+ app ,
40+ "maxResults" ,
41+ ] ,
42+ } ,
43+ } ,
44+ async run ( { $ } ) {
45+ const {
46+ app,
47+ conversationId,
48+ fromTime,
49+ maxResults,
50+ } = this ;
51+
52+ const response = await app . getPaginatedResults ( {
53+ fn : app . listMessages ,
54+ args : {
55+ $,
56+ conversationId,
57+ params : {
58+ from_time : fromTime ,
59+ } ,
60+ } ,
61+ resourceKey : "messages" ,
62+ max : maxResults ,
63+ } ) ;
64+
65+ $ . export ( "$summary" , `Listed ${ response . length } message(s)` ) ;
66+ return response ;
67+ } ,
68+ } ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @pipedream/freshchat" ,
3- "version" : " 0.1.1 " ,
3+ "version" : " 0.2.0 " ,
44 "description" : " Pipedream Freshchat Components" ,
55 "main" : " freshchat.app.mjs" ,
66 "keywords" : [
You can’t perform that action at this time.
0 commit comments