@@ -103,6 +103,7 @@ def __init__(
103103 # for multi-workspace apps
104104 before_authorize : Optional [Union [Middleware , Callable [..., Any ]]] = None ,
105105 authorize : Optional [Callable [..., AuthorizeResult ]] = None ,
106+ user_facing_authorize_error_message : Optional [str ] = None ,
106107 installation_store : Optional [InstallationStore ] = None ,
107108 # for either only bot scope usage or v1.0.x compatibility
108109 installation_store_bot_only : Optional [bool ] = None ,
@@ -159,6 +160,8 @@ def message_hello(message, say):
159160 before_authorize: A global middleware that can be executed right before authorize function
160161 authorize: The function to authorize an incoming request from Slack
161162 by checking if there is a team/user in the installation data.
163+ user_facing_authorize_error_message: The user-facing error message to display
164+ when the app is installed but the installation is not managed by this app's installation store
162165 installation_store: The module offering save/find operations of installation data
163166 installation_store_bot_only: Use `InstallationStore#find_bot()` if True (Default: False)
164167 request_verification_enabled: False if you would like to disable the built-in middleware (Default: True).
@@ -178,7 +181,7 @@ def message_hello(message, say):
178181 `SslCheck` is a built-in middleware that handles ssl_check requests from Slack.
179182 oauth_settings: The settings related to Slack app installation flow (OAuth flow)
180183 oauth_flow: Instantiated `slack_bolt.oauth.OAuthFlow`. This is always prioritized over oauth_settings.
181- verification_token: Deprecated verification mechanism. This can used only for ssl_check requests.
184+ verification_token: Deprecated verification mechanism. This can be used only for ssl_check requests.
182185 listener_executor: Custom executor to run background tasks. If absent, the default `ThreadPoolExecutor` will
183186 be used.
184187 """
@@ -348,6 +351,7 @@ def message_hello(message, say):
348351 ignoring_self_events_enabled = ignoring_self_events_enabled ,
349352 ssl_check_enabled = ssl_check_enabled ,
350353 url_verification_enabled = url_verification_enabled ,
354+ user_facing_authorize_error_message = user_facing_authorize_error_message ,
351355 )
352356
353357 def _init_middleware_list (
@@ -357,6 +361,7 @@ def _init_middleware_list(
357361 ignoring_self_events_enabled : bool = True ,
358362 ssl_check_enabled : bool = True ,
359363 url_verification_enabled : bool = True ,
364+ user_facing_authorize_error_message : Optional [str ] = None ,
360365 ):
361366 if self ._init_middleware_list_done :
362367 return
@@ -385,13 +390,18 @@ def _init_middleware_list(
385390 SingleTeamAuthorization (
386391 auth_test_result = auth_test_result ,
387392 base_logger = self ._base_logger ,
393+ user_facing_authorize_error_message = user_facing_authorize_error_message ,
388394 )
389395 )
390396 except SlackApiError as err :
391397 raise BoltError (error_auth_test_failure (err .response ))
392398 elif self ._authorize is not None :
393399 self ._middleware_list .append (
394- MultiTeamsAuthorization (authorize = self ._authorize , base_logger = self ._base_logger )
400+ MultiTeamsAuthorization (
401+ authorize = self ._authorize ,
402+ base_logger = self ._base_logger ,
403+ user_facing_authorize_error_message = user_facing_authorize_error_message ,
404+ )
395405 )
396406 else :
397407 raise BoltError (error_token_required ())
@@ -401,6 +411,7 @@ def _init_middleware_list(
401411 authorize = self ._authorize ,
402412 base_logger = self ._base_logger ,
403413 user_token_resolution = self ._oauth_flow .settings .user_token_resolution ,
414+ user_facing_authorize_error_message = user_facing_authorize_error_message ,
404415 )
405416 )
406417 if ignoring_self_events_enabled is True :
0 commit comments