@@ -103,6 +103,7 @@ def __init__(
103
103
# for multi-workspace apps
104
104
before_authorize : Optional [Union [Middleware , Callable [..., Any ]]] = None ,
105
105
authorize : Optional [Callable [..., AuthorizeResult ]] = None ,
106
+ user_facing_authorize_error_message : Optional [str ] = None ,
106
107
installation_store : Optional [InstallationStore ] = None ,
107
108
# for either only bot scope usage or v1.0.x compatibility
108
109
installation_store_bot_only : Optional [bool ] = None ,
@@ -159,6 +160,8 @@ def message_hello(message, say):
159
160
before_authorize: A global middleware that can be executed right before authorize function
160
161
authorize: The function to authorize an incoming request from Slack
161
162
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
162
165
installation_store: The module offering save/find operations of installation data
163
166
installation_store_bot_only: Use `InstallationStore#find_bot()` if True (Default: False)
164
167
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):
178
181
`SslCheck` is a built-in middleware that handles ssl_check requests from Slack.
179
182
oauth_settings: The settings related to Slack app installation flow (OAuth flow)
180
183
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.
182
185
listener_executor: Custom executor to run background tasks. If absent, the default `ThreadPoolExecutor` will
183
186
be used.
184
187
"""
@@ -348,6 +351,7 @@ def message_hello(message, say):
348
351
ignoring_self_events_enabled = ignoring_self_events_enabled ,
349
352
ssl_check_enabled = ssl_check_enabled ,
350
353
url_verification_enabled = url_verification_enabled ,
354
+ user_facing_authorize_error_message = user_facing_authorize_error_message ,
351
355
)
352
356
353
357
def _init_middleware_list (
@@ -357,6 +361,7 @@ def _init_middleware_list(
357
361
ignoring_self_events_enabled : bool = True ,
358
362
ssl_check_enabled : bool = True ,
359
363
url_verification_enabled : bool = True ,
364
+ user_facing_authorize_error_message : Optional [str ] = None ,
360
365
):
361
366
if self ._init_middleware_list_done :
362
367
return
@@ -385,13 +390,18 @@ def _init_middleware_list(
385
390
SingleTeamAuthorization (
386
391
auth_test_result = auth_test_result ,
387
392
base_logger = self ._base_logger ,
393
+ user_facing_authorize_error_message = user_facing_authorize_error_message ,
388
394
)
389
395
)
390
396
except SlackApiError as err :
391
397
raise BoltError (error_auth_test_failure (err .response ))
392
398
elif self ._authorize is not None :
393
399
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
+ )
395
405
)
396
406
else :
397
407
raise BoltError (error_token_required ())
@@ -401,6 +411,7 @@ def _init_middleware_list(
401
411
authorize = self ._authorize ,
402
412
base_logger = self ._base_logger ,
403
413
user_token_resolution = self ._oauth_flow .settings .user_token_resolution ,
414
+ user_facing_authorize_error_message = user_facing_authorize_error_message ,
404
415
)
405
416
)
406
417
if ignoring_self_events_enabled is True :
0 commit comments