File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export default {
44 key : "slack-find-message" ,
55 name : "Find Message" ,
66 description : "Find a Slack message. [See the documentation](https://api.slack.com/methods/search.messages)" ,
7- version : "0.0.23 " ,
7+ version : "0.0.24 " ,
88 type : "action" ,
99 props : {
1010 slack,
@@ -21,23 +21,59 @@ export default {
2121 ] ,
2222 optional : true ,
2323 } ,
24+ maxResults : {
25+ type : "integer" ,
26+ label : "Max Results" ,
27+ description : "The maximum number of messages to return" ,
28+ default : 100 ,
29+ optional : true ,
30+ } ,
31+ sort : {
32+ type : "string" ,
33+ label : "Sort" ,
34+ description : "Return matches sorted by either `score` or `timestamp`" ,
35+ options : [
36+ "score" ,
37+ "timestamp" ,
38+ ] ,
39+ optional : true ,
40+ } ,
41+ sortDirection : {
42+ type : "string" ,
43+ label : "Sort Direction" ,
44+ description : "Sort ascending (asc) or descending (desc)`" ,
45+ options : [
46+ "desc" ,
47+ "asc" ,
48+ ] ,
49+ optional : true ,
50+ } ,
2451 } ,
2552 async run ( { $ } ) {
2653 const matches = [ ] ;
2754 const params = {
2855 query : this . query ,
2956 team_id : this . teamId ,
57+ sort : this . sort ,
58+ sort_dir : this . sortDirection ,
3059 page : 1 ,
3160 } ;
3261 let hasMore ;
3362
3463 do {
3564 const { messages } = await this . slack . searchMessages ( params ) ;
3665 matches . push ( ...messages . matches ) ;
66+ if ( matches . length >= this . maxResults ) {
67+ break ;
68+ }
3769 hasMore = messages ?. length ;
3870 params . page ++ ;
3971 } while ( hasMore ) ;
4072
73+ if ( matches . length > this . maxResults ) {
74+ matches . length = this . maxResults ;
75+ }
76+
4177 $ . export ( "$summary" , `Found ${ matches . length } matching message${ matches . length === 1
4278 ? ""
4379 : "s" } `) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @pipedream/slack" ,
3- "version" : " 0.9.2 " ,
3+ "version" : " 0.9.3 " ,
44 "description" : " Pipedream Slack Components" ,
55 "main" : " slack.app.mjs" ,
66 "keywords" : [
You can’t perform that action at this time.
0 commit comments