@@ -41,18 +41,24 @@ class SlackWebMessageContext(BaseModel):
4141class SlackWebMessagingIntegration (
4242 BaseMessagingIntegration [Channel , SlackWebMessageContext ]
4343):
44- def __init__ (self , client : WebClient , tracking : Optional [Tracking ] = None ) -> None :
44+ def __init__ (
45+ self ,
46+ client : WebClient ,
47+ tracking : Optional [Tracking ] = None ,
48+ reply_broadcast : bool = False ,
49+ ) -> None :
4550 self .client = client
4651 self .tracking = tracking
4752 self ._email_to_user_id_cache : Dict [str , str ] = {}
53+ self .reply_broadcast = reply_broadcast
4854
4955 @classmethod
5056 def from_token (
51- cls , token : str , tracking : Optional [Tracking ] = None
57+ cls , token : str , tracking : Optional [Tracking ] = None , ** kwargs : Any
5258 ) -> "SlackWebMessagingIntegration" :
5359 client = WebClient (token = token )
5460 client .retry_handlers .append (RateLimitErrorRetryHandler (max_retry_count = 5 ))
55- return cls (client , tracking )
61+ return cls (client , tracking , ** kwargs )
5662
5763 def parse_message_context (self , context : dict [str , Any ]) -> SlackWebMessageContext :
5864 return SlackWebMessageContext (** context )
@@ -77,7 +83,10 @@ def reply_to_message(
7783 ) -> MessageSendResult [SlackWebMessageContext ]:
7884 formatted_message = format_block_kit (body , self .get_user_id_from_email )
7985 return self ._send_message (
80- destination , formatted_message , thread_ts = message_context .id
86+ destination ,
87+ formatted_message ,
88+ thread_ts = message_context .id ,
89+ reply_broadcast = self .reply_broadcast ,
8190 )
8291
8392 @sleep_and_retry
@@ -87,13 +96,15 @@ def _send_message(
8796 destination : Channel ,
8897 formatted_message : FormattedBlockKitMessage ,
8998 thread_ts : Optional [str ] = None ,
99+ reply_broadcast : bool = False ,
90100 ) -> MessageSendResult [SlackWebMessageContext ]:
91101 try :
92102 response = self .client .chat_postMessage (
93103 channel = destination ,
94104 blocks = json .dumps (formatted_message .blocks ),
95105 attachments = json .dumps (formatted_message .attachments ),
96106 thread_ts = thread_ts ,
107+ reply_broadcast = reply_broadcast ,
97108 )
98109 except SlackApiError as e :
99110 self ._handle_send_err (e , destination )
0 commit comments