@@ -27,6 +27,7 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
2727 { label : 'Create Canvas' , id : 'canvas' } ,
2828 { label : 'Read Messages' , id : 'read' } ,
2929 { label : 'Get Message' , id : 'get_message' } ,
30+ { label : 'Get Thread' , id : 'get_thread' } ,
3031 { label : 'List Channels' , id : 'list_channels' } ,
3132 { label : 'List Channel Members' , id : 'list_members' } ,
3233 { label : 'List Users' , id : 'list_users' } ,
@@ -343,6 +344,42 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
343344 generationType : 'timestamp' ,
344345 } ,
345346 } ,
347+ // Get Thread specific fields
348+ {
349+ id : 'getThreadTimestamp' ,
350+ title : 'Thread Timestamp' ,
351+ type : 'short-input' ,
352+ placeholder : 'Thread timestamp (thread_ts, e.g., 1405894322.002768)' ,
353+ condition : {
354+ field : 'operation' ,
355+ value : 'get_thread' ,
356+ } ,
357+ required : true ,
358+ wandConfig : {
359+ enabled : true ,
360+ prompt : `Extract or generate a Slack thread timestamp from the user's input.
361+ Slack thread timestamps (thread_ts) are in the format: XXXXXXXXXX.XXXXXX (seconds.microseconds since Unix epoch).
362+ Examples:
363+ - "1405894322.002768" -> 1405894322.002768 (already a valid timestamp)
364+ - "thread_ts from the trigger" -> The user wants to reference a variable, output the original text
365+ - A URL like "https://slack.com/archives/C123/p1405894322002768" -> Extract 1405894322.002768 (remove 'p' prefix, add decimal after 10th digit)
366+
367+ If the input looks like a reference to another block's output (contains < and >) or a variable, return it as-is.
368+ Return ONLY the timestamp string - no explanations, no quotes, no extra text.` ,
369+ placeholder : 'Paste a Slack thread URL or thread_ts...' ,
370+ generationType : 'timestamp' ,
371+ } ,
372+ } ,
373+ {
374+ id : 'threadLimit' ,
375+ title : 'Message Limit' ,
376+ type : 'short-input' ,
377+ placeholder : '100' ,
378+ condition : {
379+ field : 'operation' ,
380+ value : 'get_thread' ,
381+ } ,
382+ } ,
346383 {
347384 id : 'oldest' ,
348385 title : 'Oldest Timestamp' ,
@@ -458,6 +495,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
458495 'slack_canvas' ,
459496 'slack_message_reader' ,
460497 'slack_get_message' ,
498+ 'slack_get_thread' ,
461499 'slack_list_channels' ,
462500 'slack_list_members' ,
463501 'slack_list_users' ,
@@ -478,6 +516,8 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
478516 return 'slack_message_reader'
479517 case 'get_message' :
480518 return 'slack_get_message'
519+ case 'get_thread' :
520+ return 'slack_get_thread'
481521 case 'list_channels' :
482522 return 'slack_list_channels'
483523 case 'list_members' :
@@ -529,6 +569,8 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
529569 userLimit,
530570 userId,
531571 getMessageTimestamp,
572+ getThreadTimestamp,
573+ threadLimit,
532574 ...rest
533575 } = params
534576
@@ -612,6 +654,20 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
612654 baseParams . timestamp = getMessageTimestamp
613655 break
614656
657+ case 'get_thread' : {
658+ if ( ! getThreadTimestamp ) {
659+ throw new Error ( 'Thread timestamp is required for get thread operation' )
660+ }
661+ baseParams . threadTs = getThreadTimestamp
662+ if ( threadLimit ) {
663+ const parsedLimit = Number . parseInt ( threadLimit , 10 )
664+ if ( ! Number . isNaN ( parsedLimit ) && parsedLimit > 0 ) {
665+ baseParams . limit = Math . min ( parsedLimit , 200 )
666+ }
667+ }
668+ break
669+ }
670+
615671 case 'list_channels' : {
616672 baseParams . includePrivate = includePrivate !== 'false'
617673 baseParams . excludeArchived = true
@@ -719,6 +775,12 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
719775 userId : { type : 'string' , description : 'User ID to look up' } ,
720776 // Get Message inputs
721777 getMessageTimestamp : { type : 'string' , description : 'Message timestamp to retrieve' } ,
778+ // Get Thread inputs
779+ getThreadTimestamp : { type : 'string' , description : 'Thread timestamp to retrieve' } ,
780+ threadLimit : {
781+ type : 'string' ,
782+ description : 'Maximum number of messages to return from thread' ,
783+ } ,
722784 } ,
723785 outputs : {
724786 // slack_message outputs (send operation)
@@ -746,6 +808,24 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
746808 'Array of message objects with comprehensive properties: text, user, timestamp, reactions, threads, files, attachments, blocks, stars, pins, and edit history' ,
747809 } ,
748810
811+ // slack_get_thread outputs (get_thread operation)
812+ parentMessage : {
813+ type : 'json' ,
814+ description : 'The thread parent message with all properties' ,
815+ } ,
816+ replies : {
817+ type : 'json' ,
818+ description : 'Array of reply messages in the thread (excluding the parent)' ,
819+ } ,
820+ replyCount : {
821+ type : 'number' ,
822+ description : 'Number of replies returned in this response' ,
823+ } ,
824+ hasMore : {
825+ type : 'boolean' ,
826+ description : 'Whether there are more messages in the thread' ,
827+ } ,
828+
749829 // slack_list_channels outputs (list_channels operation)
750830 channels : {
751831 type : 'json' ,
0 commit comments