diff --git a/docs/static/api-docs/slack_bolt/adapter/aiohttp/index.html b/docs/static/api-docs/slack_bolt/adapter/aiohttp/index.html index 0b2b6e84..879b7a02 100644 --- a/docs/static/api-docs/slack_bolt/adapter/aiohttp/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/aiohttp/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.aiohttp API documentation - + @@ -37,12 +48,53 @@

Functions

async def to_aiohttp_response(bolt_resp: BoltResponse) ‑> aiohttp.web_response.Response
+
+ +Expand source code + +
async def to_aiohttp_response(bolt_resp: BoltResponse) -> web.Response:
+    content_type = bolt_resp.headers.pop(
+        "content-type",
+        ["application/json" if bolt_resp.body.startswith("{") else "text/plain"],
+    )[0]
+    content_type = re.sub(r";\s*charset=utf-8", "", content_type)
+    resp = web.Response(
+        status=bolt_resp.status,
+        body=bolt_resp.body,
+        headers=bolt_resp.first_headers_without_set_cookie(),
+        content_type=content_type,
+    )
+    for cookie in bolt_resp.cookies():
+        for name, c in cookie.items():
+            resp.set_cookie(
+                name=name,
+                value=c.value,
+                max_age=c.get("max-age"),
+                expires=c.get("expires"),
+                path=c.get("path"),  # type: ignore[arg-type]
+                domain=c.get("domain"),
+                secure=True,
+                httponly=True,
+            )
+    return resp
+
async def to_bolt_request(request: aiohttp.web_request.Request) ‑> AsyncBoltRequest
+
+ +Expand source code + +
async def to_bolt_request(request: web.Request) -> AsyncBoltRequest:
+    return AsyncBoltRequest(
+        body=await request.text(),
+        query=request.query_string,
+        headers=request.headers,  # type: ignore[arg-type]
+    )
+
@@ -70,7 +122,7 @@

Functions

diff --git a/docs/static/api-docs/slack_bolt/adapter/asgi/aiohttp/index.html b/docs/static/api-docs/slack_bolt/adapter/asgi/aiohttp/index.html index b36d86ed..d598dc6c 100644 --- a/docs/static/api-docs/slack_bolt/adapter/asgi/aiohttp/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/asgi/aiohttp/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.asgi.aiohttp API documentation - + @@ -40,26 +51,6 @@

Classes

(app: AsyncApp,
path: str = '/slack/events')
-

Setup Bolt as an ASGI web framework, this will make your application compatible with ASGI web servers. -This can be used for production deployment.

-

With the default settings, http://localhost:3000/slack/events -Run Bolt with uvicron

-
# Python
-app = AsyncApp()
-api = SlackRequestHandler(app)
-
-# bash
-export SLACK_SIGNING_SECRET=***
-export SLACK_BOT_TOKEN=xoxb-***
-uvicorn app:api --port 3000 --log-level debug
-
-

Args

-
-
app
-
Your bolt application
-
path
-
The path to handle request from Slack (Default: /slack/events)
-
Expand source code @@ -105,25 +96,40 @@

Args

AsyncBoltRequest(body=await request.get_raw_body(), query=request.query_string, headers=request.get_headers()) )
+

Setup Bolt as an ASGI web framework, this will make your application compatible with ASGI web servers. +This can be used for production deployment.

+

With the default settings, http://localhost:3000/slack/events +Run Bolt with uvicron

+
# Python
+app = AsyncApp()
+api = SlackRequestHandler(app)
+
+# bash
+export SLACK_SIGNING_SECRET=***
+export SLACK_BOT_TOKEN=xoxb-***
+uvicorn app:api --port 3000 --log-level debug
+
+

Args

+
+
app
+
Your bolt application
+
path
+
The path to handle request from Slack (Default: /slack/events)
+

Ancestors

-

Class variables

-
-
var appAsyncApp
-
-
-
-

Inherited members

@@ -145,9 +151,6 @@

Inherited members

@@ -155,7 +158,7 @@

diff --git a/docs/static/api-docs/slack_bolt/adapter/asgi/async_handler.html b/docs/static/api-docs/slack_bolt/adapter/asgi/async_handler.html index 9bf506f0..9ecdb6fd 100644 --- a/docs/static/api-docs/slack_bolt/adapter/asgi/async_handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/asgi/async_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.asgi.async_handler API documentation - + @@ -40,26 +51,6 @@

Classes

(app: AsyncApp,
path: str = '/slack/events')
-

Setup Bolt as an ASGI web framework, this will make your application compatible with ASGI web servers. -This can be used for production deployment.

-

With the default settings, http://localhost:3000/slack/events -Run Bolt with uvicron

-
# Python
-app = AsyncApp()
-api = SlackRequestHandler(app)
-
-# bash
-export SLACK_SIGNING_SECRET=***
-export SLACK_BOT_TOKEN=xoxb-***
-uvicorn app:api --port 3000 --log-level debug
-
-

Args

-
-
app
-
Your bolt application
-
path
-
The path to handle request from Slack (Default: /slack/events)
-
Expand source code @@ -105,25 +96,40 @@

Args

AsyncBoltRequest(body=await request.get_raw_body(), query=request.query_string, headers=request.get_headers()) )
+

Setup Bolt as an ASGI web framework, this will make your application compatible with ASGI web servers. +This can be used for production deployment.

+

With the default settings, http://localhost:3000/slack/events +Run Bolt with uvicron

+
# Python
+app = AsyncApp()
+api = SlackRequestHandler(app)
+
+# bash
+export SLACK_SIGNING_SECRET=***
+export SLACK_BOT_TOKEN=xoxb-***
+uvicorn app:api --port 3000 --log-level debug
+
+

Args

+
+
app
+
Your bolt application
+
path
+
The path to handle request from Slack (Default: /slack/events)
+

Ancestors

-

Class variables

-
-
var appAsyncApp
-
-
-
-

Inherited members

@@ -145,9 +151,6 @@

Inherited members

@@ -155,7 +158,7 @@

-

Generated by pdoc 0.11.3.

+

Generated by pdoc 0.11.5.

diff --git a/docs/static/api-docs/slack_bolt/adapter/asgi/base_handler.html b/docs/static/api-docs/slack_bolt/adapter/asgi/base_handler.html index 37deef2d..2e194b12 100644 --- a/docs/static/api-docs/slack_bolt/adapter/asgi/base_handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/asgi/base_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.asgi.base_handler API documentation - + @@ -39,7 +50,6 @@

Classes

class BaseSlackRequestHandler
-
Expand source code @@ -101,6 +111,7 @@

Classes

return raise TypeError(f"Unsupported scope type: {scope['type']!r}")
+

Subclasses

  • SlackRequestHandler
  • @@ -109,11 +120,11 @@

    Class variables

    var appApp | AsyncApp
    -
    +

    The type of the None singleton.

    var path : str
    -
    +

    The type of the None singleton.

    Methods

    @@ -122,18 +133,42 @@

    Methods

    async def dispatch(self,
    request: AsgiHttpRequest) ‑> BoltResponse
    +
    + +Expand source code + +
    async def dispatch(self, request: AsgiHttpRequest) -> BoltResponse:
    +    """Dispatches a request to the Bolt App"""
    +    raise NotImplementedError
    +

    Dispatches a request to the Bolt App

    async def handle_callback(self,
    request: AsgiHttpRequest) ‑> BoltResponse
    +
    + +Expand source code + +
    async def handle_callback(self, request: AsgiHttpRequest) -> BoltResponse:
    +    """Handles the callback of the OAuthFlow"""
    +    raise NotImplementedError
    +

    Handles the callback of the OAuthFlow

    async def handle_installation(self,
    request: AsgiHttpRequest) ‑> BoltResponse
    +
    + +Expand source code + +
    async def handle_installation(self, request: AsgiHttpRequest) -> BoltResponse:
    +    """Handles installation of the OAuthFlow"""
    +    raise NotImplementedError
    +

    Handles installation of the OAuthFlow

    @@ -169,7 +204,7 @@

    -

    Generated by pdoc 0.11.3.

    +

    Generated by pdoc 0.11.5.

    diff --git a/docs/static/api-docs/slack_bolt/adapter/asgi/builtin/index.html b/docs/static/api-docs/slack_bolt/adapter/asgi/builtin/index.html index 07f13216..4a0d0c77 100644 --- a/docs/static/api-docs/slack_bolt/adapter/asgi/builtin/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/asgi/builtin/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.asgi.builtin API documentation - + @@ -40,26 +51,6 @@

    Classes

    (app: App,
    path: str = '/slack/events')
    -

    Setup Bolt as an ASGI web framework, this will make your application compatible with ASGI web servers. -This can be used for production deployment.

    -

    With the default settings, http://localhost:3000/slack/events -Run Bolt with uvicron

    -
    # Python
    -app = App()
    -api = SlackRequestHandler(app)
    -
    -# bash
    -export SLACK_SIGNING_SECRET=***
    -export SLACK_BOT_TOKEN=xoxb-***
    -uvicorn app:api --port 3000 --log-level debug
    -
    -

    Args

    -
    -
    app
    -
    Your bolt application
    -
    path
    -
    The path to handle request from Slack (Default: /slack/events)
    -
    Expand source code @@ -103,6 +94,26 @@

    Args

    BoltRequest(body=await request.get_raw_body(), query=request.query_string, headers=request.get_headers()) )
    +

    Setup Bolt as an ASGI web framework, this will make your application compatible with ASGI web servers. +This can be used for production deployment.

    +

    With the default settings, http://localhost:3000/slack/events +Run Bolt with uvicron

    +
    # Python
    +app = App()
    +api = SlackRequestHandler(app)
    +
    +# bash
    +export SLACK_SIGNING_SECRET=***
    +export SLACK_BOT_TOKEN=xoxb-***
    +uvicorn app:api --port 3000 --log-level debug
    +
    +

    Args

    +
    +
    app
    +
    Your bolt application
    +
    path
    +
    The path to handle request from Slack (Default: /slack/events)
    +

    Ancestors

    • BaseSlackRequestHandler
    • @@ -115,9 +126,11 @@

      Inherited members

      @@ -146,7 +159,7 @@

      -

      Generated by pdoc 0.11.3.

      +

      Generated by pdoc 0.11.5.

      diff --git a/docs/static/api-docs/slack_bolt/adapter/asgi/http_request.html b/docs/static/api-docs/slack_bolt/adapter/asgi/http_request.html index e1f8a58d..38ab574d 100644 --- a/docs/static/api-docs/slack_bolt/adapter/asgi/http_request.html +++ b/docs/static/api-docs/slack_bolt/adapter/asgi/http_request.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.asgi.http_request API documentation - + @@ -40,7 +51,6 @@

      Classes

      (scope: Dict[str, str | bytes | Iterable[Tuple[bytes, bytes]]],
      receive: Callable)
      -
      Expand source code @@ -69,18 +79,103 @@

      Classes

      break return bytes(chunks).decode(ENCODING)
      +

      Instance variables

      var query_string
      +
      + +Expand source code + +
      class AsgiHttpRequest:
      +    __slots__ = ("receive", "query_string", "raw_headers")
      +
      +    def __init__(self, scope: scope_type, receive: Callable):
      +        self.receive = receive
      +        self.query_string = str(scope["query_string"], ENCODING)  # type: ignore[arg-type]
      +        self.raw_headers: Iterable[Tuple[bytes, bytes]] = scope["headers"]  # type: ignore[assignment]
      +
      +    def get_headers(self) -> Dict[str, Union[str, Sequence[str]]]:
      +        return {str(header[0], ENCODING): str(header[1], (ENCODING)) for header in self.raw_headers}
      +
      +    async def get_raw_body(self) -> str:
      +        chunks = bytearray()
      +        while True:
      +            chunk: Dict[str, Union[str, bytes]] = await self.receive()
      +
      +            if chunk["type"] != "http.request":
      +                raise Exception("Body chunks could not be received from asgi server")
      +
      +            chunks.extend(chunk.get("body", b""))  # type: ignore[arg-type]
      +            if not chunk.get("more_body", False):
      +                break
      +        return bytes(chunks).decode(ENCODING)
      +
      var raw_headers
      +
      + +Expand source code + +
      class AsgiHttpRequest:
      +    __slots__ = ("receive", "query_string", "raw_headers")
      +
      +    def __init__(self, scope: scope_type, receive: Callable):
      +        self.receive = receive
      +        self.query_string = str(scope["query_string"], ENCODING)  # type: ignore[arg-type]
      +        self.raw_headers: Iterable[Tuple[bytes, bytes]] = scope["headers"]  # type: ignore[assignment]
      +
      +    def get_headers(self) -> Dict[str, Union[str, Sequence[str]]]:
      +        return {str(header[0], ENCODING): str(header[1], (ENCODING)) for header in self.raw_headers}
      +
      +    async def get_raw_body(self) -> str:
      +        chunks = bytearray()
      +        while True:
      +            chunk: Dict[str, Union[str, bytes]] = await self.receive()
      +
      +            if chunk["type"] != "http.request":
      +                raise Exception("Body chunks could not be received from asgi server")
      +
      +            chunks.extend(chunk.get("body", b""))  # type: ignore[arg-type]
      +            if not chunk.get("more_body", False):
      +                break
      +        return bytes(chunks).decode(ENCODING)
      +
      var receive
      +
      + +Expand source code + +
      class AsgiHttpRequest:
      +    __slots__ = ("receive", "query_string", "raw_headers")
      +
      +    def __init__(self, scope: scope_type, receive: Callable):
      +        self.receive = receive
      +        self.query_string = str(scope["query_string"], ENCODING)  # type: ignore[arg-type]
      +        self.raw_headers: Iterable[Tuple[bytes, bytes]] = scope["headers"]  # type: ignore[assignment]
      +
      +    def get_headers(self) -> Dict[str, Union[str, Sequence[str]]]:
      +        return {str(header[0], ENCODING): str(header[1], (ENCODING)) for header in self.raw_headers}
      +
      +    async def get_raw_body(self) -> str:
      +        chunks = bytearray()
      +        while True:
      +            chunk: Dict[str, Union[str, bytes]] = await self.receive()
      +
      +            if chunk["type"] != "http.request":
      +                raise Exception("Body chunks could not be received from asgi server")
      +
      +            chunks.extend(chunk.get("body", b""))  # type: ignore[arg-type]
      +            if not chunk.get("more_body", False):
      +                break
      +        return bytes(chunks).decode(ENCODING)
      +
      @@ -90,12 +185,36 @@

      Methods

      def get_headers(self) ‑> Dict[str, str | Sequence[str]]
      +
      + +Expand source code + +
      def get_headers(self) -> Dict[str, Union[str, Sequence[str]]]:
      +    return {str(header[0], ENCODING): str(header[1], (ENCODING)) for header in self.raw_headers}
      +
      async def get_raw_body(self) ‑> str
      +
      + +Expand source code + +
      async def get_raw_body(self) -> str:
      +    chunks = bytearray()
      +    while True:
      +        chunk: Dict[str, Union[str, bytes]] = await self.receive()
      +
      +        if chunk["type"] != "http.request":
      +            raise Exception("Body chunks could not be received from asgi server")
      +
      +        chunks.extend(chunk.get("body", b""))  # type: ignore[arg-type]
      +        if not chunk.get("more_body", False):
      +            break
      +    return bytes(chunks).decode(ENCODING)
      +
      @@ -131,7 +250,7 @@

      -

      Generated by pdoc 0.11.3.

      +

      Generated by pdoc 0.11.5.

      diff --git a/docs/static/api-docs/slack_bolt/adapter/asgi/http_response.html b/docs/static/api-docs/slack_bolt/adapter/asgi/http_response.html index fa51ddb6..93c92922 100644 --- a/docs/static/api-docs/slack_bolt/adapter/asgi/http_response.html +++ b/docs/static/api-docs/slack_bolt/adapter/asgi/http_response.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.asgi.http_response API documentation - + @@ -40,7 +51,6 @@

      Classes

      (status: int, headers: Dict[str, Sequence[str]] = {}, body: str = '')
      -
      Expand source code @@ -70,18 +80,106 @@

      Classes

      "more_body": False, }
      +

      Instance variables

      var body
      +
      + +Expand source code + +
      class AsgiHttpResponse:
      +    __slots__ = ("status", "raw_headers", "body")
      +
      +    def __init__(self, status: int, headers: Dict[str, Sequence[str]] = {}, body: str = ""):
      +        self.status: int = status
      +        self.raw_headers: List[Tuple[bytes, bytes]] = [
      +            (bytes(key, ENCODING), bytes(value[0], ENCODING)) for key, value in headers.items()
      +        ]
      +        self.raw_headers.append((b"content-length", bytes(str(len(body)), ENCODING)))
      +        self.body: bytes = bytes(body, ENCODING)
      +
      +    def get_response_start(self) -> Dict[str, Union[str, int, Iterable[Tuple[bytes, bytes]]]]:
      +        return {
      +            "type": "http.response.start",
      +            "status": self.status,
      +            "headers": self.raw_headers,
      +        }
      +
      +    def get_response_body(self) -> Dict[str, Union[str, bytes, bool]]:
      +        return {
      +            "type": "http.response.body",
      +            "body": self.body,
      +            "more_body": False,
      +        }
      +
      var raw_headers
      +
      + +Expand source code + +
      class AsgiHttpResponse:
      +    __slots__ = ("status", "raw_headers", "body")
      +
      +    def __init__(self, status: int, headers: Dict[str, Sequence[str]] = {}, body: str = ""):
      +        self.status: int = status
      +        self.raw_headers: List[Tuple[bytes, bytes]] = [
      +            (bytes(key, ENCODING), bytes(value[0], ENCODING)) for key, value in headers.items()
      +        ]
      +        self.raw_headers.append((b"content-length", bytes(str(len(body)), ENCODING)))
      +        self.body: bytes = bytes(body, ENCODING)
      +
      +    def get_response_start(self) -> Dict[str, Union[str, int, Iterable[Tuple[bytes, bytes]]]]:
      +        return {
      +            "type": "http.response.start",
      +            "status": self.status,
      +            "headers": self.raw_headers,
      +        }
      +
      +    def get_response_body(self) -> Dict[str, Union[str, bytes, bool]]:
      +        return {
      +            "type": "http.response.body",
      +            "body": self.body,
      +            "more_body": False,
      +        }
      +
      var status
      +
      + +Expand source code + +
      class AsgiHttpResponse:
      +    __slots__ = ("status", "raw_headers", "body")
      +
      +    def __init__(self, status: int, headers: Dict[str, Sequence[str]] = {}, body: str = ""):
      +        self.status: int = status
      +        self.raw_headers: List[Tuple[bytes, bytes]] = [
      +            (bytes(key, ENCODING), bytes(value[0], ENCODING)) for key, value in headers.items()
      +        ]
      +        self.raw_headers.append((b"content-length", bytes(str(len(body)), ENCODING)))
      +        self.body: bytes = bytes(body, ENCODING)
      +
      +    def get_response_start(self) -> Dict[str, Union[str, int, Iterable[Tuple[bytes, bytes]]]]:
      +        return {
      +            "type": "http.response.start",
      +            "status": self.status,
      +            "headers": self.raw_headers,
      +        }
      +
      +    def get_response_body(self) -> Dict[str, Union[str, bytes, bool]]:
      +        return {
      +            "type": "http.response.body",
      +            "body": self.body,
      +            "more_body": False,
      +        }
      +
      @@ -91,12 +189,34 @@

      Methods

      def get_response_body(self) ‑> Dict[str, str | bytes | bool]
      +
      + +Expand source code + +
      def get_response_body(self) -> Dict[str, Union[str, bytes, bool]]:
      +    return {
      +        "type": "http.response.body",
      +        "body": self.body,
      +        "more_body": False,
      +    }
      +
      def get_response_start(self) ‑> Dict[str, str | int | Iterable[Tuple[bytes, bytes]]]
      +
      + +Expand source code + +
      def get_response_start(self) -> Dict[str, Union[str, int, Iterable[Tuple[bytes, bytes]]]]:
      +    return {
      +        "type": "http.response.start",
      +        "status": self.status,
      +        "headers": self.raw_headers,
      +    }
      +
      @@ -132,7 +252,7 @@

      diff --git a/docs/static/api-docs/slack_bolt/adapter/asgi/index.html b/docs/static/api-docs/slack_bolt/adapter/asgi/index.html index 3e6dc537..295ead70 100644 --- a/docs/static/api-docs/slack_bolt/adapter/asgi/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/asgi/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.asgi API documentation - + @@ -71,26 +82,6 @@

      Classes

      (app: App,
      path: str = '/slack/events')
      -

      Setup Bolt as an ASGI web framework, this will make your application compatible with ASGI web servers. -This can be used for production deployment.

      -

      With the default settings, http://localhost:3000/slack/events -Run Bolt with uvicron

      -
      # Python
      -app = App()
      -api = SlackRequestHandler(app)
      -
      -# bash
      -export SLACK_SIGNING_SECRET=***
      -export SLACK_BOT_TOKEN=xoxb-***
      -uvicorn app:api --port 3000 --log-level debug
      -
      -

      Args

      -
      -
      app
      -
      Your bolt application
      -
      path
      -
      The path to handle request from Slack (Default: /slack/events)
      -
      Expand source code @@ -134,6 +125,26 @@

      Args

      BoltRequest(body=await request.get_raw_body(), query=request.query_string, headers=request.get_headers()) )
      +

      Setup Bolt as an ASGI web framework, this will make your application compatible with ASGI web servers. +This can be used for production deployment.

      +

      With the default settings, http://localhost:3000/slack/events +Run Bolt with uvicron

      +
      # Python
      +app = App()
      +api = SlackRequestHandler(app)
      +
      +# bash
      +export SLACK_SIGNING_SECRET=***
      +export SLACK_BOT_TOKEN=xoxb-***
      +uvicorn app:api --port 3000 --log-level debug
      +
      +

      Args

      +
      +
      app
      +
      Your bolt application
      +
      path
      +
      The path to handle request from Slack (Default: /slack/events)
      +

      Ancestors

      • BaseSlackRequestHandler
      • @@ -146,9 +157,11 @@

        Inherited members

        @@ -188,7 +201,7 @@

        -

        Generated by pdoc 0.11.3.

        +

        Generated by pdoc 0.11.5.

        diff --git a/docs/static/api-docs/slack_bolt/adapter/asgi/utils.html b/docs/static/api-docs/slack_bolt/adapter/asgi/utils.html index ce55c6dc..031deda6 100644 --- a/docs/static/api-docs/slack_bolt/adapter/asgi/utils.html +++ b/docs/static/api-docs/slack_bolt/adapter/asgi/utils.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.asgi.utils API documentation - + @@ -49,7 +60,7 @@

        Module slack_bolt.adapter.asgi.utils

        diff --git a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/chalice_handler.html b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/chalice_handler.html index b5cbb0a1..e8bd162e 100644 --- a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/chalice_handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/chalice_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.aws_lambda.chalice_handler API documentation - + @@ -37,18 +48,51 @@

        Functions

        def not_found() ‑> chalice.app.Response
        +
        + +Expand source code + +
        def not_found() -> Response:
        +    return Response(
        +        status_code=404,
        +        body="Not Found",
        +        headers={},
        +    )
        +
        def to_bolt_request(request: chalice.app.Request, body: str) ‑> BoltRequest
        +
        + +Expand source code + +
        def to_bolt_request(request: Request, body: str) -> BoltRequest:
        +    return BoltRequest(
        +        body=body,
        +        query=request.query_params,  # type: ignore[arg-type]
        +        headers=request.headers,  # type: ignore[arg-type]
        +    )
        +
        def to_chalice_response(resp: BoltResponse) ‑> chalice.app.Response
        +
        + +Expand source code + +
        def to_chalice_response(resp: BoltResponse) -> Response:
        +    return Response(
        +        status_code=resp.status,
        +        body=resp.body,
        +        headers=resp.first_headers(),  # type: ignore[arg-type]
        +    )
        +
        @@ -61,7 +105,6 @@

        Classes

        (app: App,
        chalice: chalice.app.Chalice,
        lambda_client: botocore.client.BaseClient | None = None)
        -
        Expand source code @@ -137,6 +180,7 @@

        Classes

        return not_found()
        +

        Static methods

        @@ -152,6 +196,49 @@

        Methods

        def handle(self, request: chalice.app.Request)
        +
        + +Expand source code + +
        def handle(self, request: Request):
        +    body: str = request.raw_body.decode("utf-8") if request.raw_body else ""  # type: ignore[union-attr]
        +    self.logger.debug(f"Incoming request: {request.to_dict()}, body: {body}")
        +
        +    method = request.method
        +    if method is None:
        +        return not_found()
        +    if method == "GET":
        +        if self.app.oauth_flow is not None:
        +            oauth_flow: OAuthFlow = self.app.oauth_flow
        +            bolt_req: BoltRequest = to_bolt_request(request, body)
        +            query = bolt_req.query
        +            is_callback = query is not None and (
        +                (_first_value(query, "code") is not None and _first_value(query, "state") is not None)
        +                or _first_value(query, "error") is not None
        +            )
        +            if is_callback:
        +                bolt_resp = oauth_flow.handle_callback(bolt_req)
        +                return to_chalice_response(bolt_resp)
        +            else:
        +                bolt_resp = oauth_flow.handle_installation(bolt_req)
        +                return to_chalice_response(bolt_resp)
        +    elif method == "POST":
        +        bolt_req = to_bolt_request(request, body)
        +        # https://docs.aws.amazon.com/lambda/latest/dg/python-context.html
        +        aws_lambda_function_name = self.chalice.lambda_context.function_name
        +        bolt_req.context["aws_lambda_function_name"] = aws_lambda_function_name
        +        bolt_req.context["chalice_request"] = request.to_dict()
        +        bolt_resp = self.app.dispatch(bolt_req)
        +        aws_response = to_chalice_response(bolt_resp)
        +        return aws_response
        +    elif method == "NONE":
        +        bolt_req = to_bolt_request(request, body)
        +        bolt_resp = self.app.dispatch(bolt_req)
        +        aws_response = to_chalice_response(bolt_resp)
        +        return aws_response
        +
        +    return not_found()
        +
        @@ -191,7 +278,7 @@

        -

        Generated by pdoc 0.11.3.

        +

        Generated by pdoc 0.11.5.

        diff --git a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/chalice_lazy_listener_runner.html b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/chalice_lazy_listener_runner.html index 4a882d5b..8bd6428c 100644 --- a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/chalice_lazy_listener_runner.html +++ b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/chalice_lazy_listener_runner.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.aws_lambda.chalice_lazy_listener_runner API documentation - + @@ -40,7 +51,6 @@

        Classes

        (logger: logging.Logger,
        lambda_client: botocore.client.BaseClient | None = None)
        -
        Expand source code @@ -74,6 +84,7 @@

        Classes

        Payload=json.dumps(payload), )
        +

        Ancestors

        • LazyListenerRunner
        • @@ -82,6 +93,7 @@

          Inherited members

          • LazyListenerRunner: @@ -112,7 +124,7 @@

            -

            Generated by pdoc 0.11.3.

            +

            Generated by pdoc 0.11.5.

            diff --git a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/handler.html b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/handler.html index 65923f86..48fd279c 100644 --- a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.aws_lambda.handler API documentation - + @@ -37,18 +48,64 @@

            Functions

            def not_found() ‑> Dict[str, Any]
            +
            + +Expand source code + +
            def not_found() -> Dict[str, Any]:
            +    return {
            +        "statusCode": 404,
            +        "body": "Not Found",
            +        "headers": {},
            +    }
            +
            def to_aws_response(resp: BoltResponse) ‑> Dict[str, Any]
            +
            + +Expand source code + +
            def to_aws_response(resp: BoltResponse) -> Dict[str, Any]:
            +    return {
            +        "statusCode": resp.status,
            +        "body": resp.body,
            +        "headers": resp.first_headers(),
            +    }
            +
            def to_bolt_request(event) ‑> BoltRequest
            +
            + +Expand source code + +
            def to_bolt_request(event) -> BoltRequest:
            +    body = event.get("body", "")
            +    if event["isBase64Encoded"]:
            +        body = base64.b64decode(body).decode("utf-8")
            +    cookies: Sequence[str] = event.get("cookies", [])
            +    if cookies is None or len(cookies) == 0:
            +        # In the case of format v1
            +        multiValueHeaders = event.get("multiValueHeaders", {})
            +        cookies = multiValueHeaders.get("cookie", [])
            +        if len(cookies) == 0:
            +            # Try using uppercase
            +            cookies = multiValueHeaders.get("Cookie", [])
            +    headers = event.get("headers", {})
            +    headers["cookie"] = cookies
            +    return BoltRequest(
            +        body=body,
            +        query=event.get("queryStringParameters", {}),
            +        headers=headers,
            +    )
            +
            @@ -61,7 +118,6 @@

            Classes

            (app: App)
            -
            Expand source code @@ -124,6 +180,7 @@

            Classes

            return not_found()
            +

            Static methods

            @@ -139,6 +196,52 @@

            Methods

            def handle(self, event, context)
            +
            + +Expand source code + +
            def handle(self, event, context):
            +    self.logger.debug(f"Incoming event: {event}, context: {context}")
            +
            +    method = event.get("requestContext", {}).get("http", {}).get("method")
            +    if method is None:
            +        method = event.get("requestContext", {}).get("httpMethod")
            +
            +    if method is None:
            +        return not_found()
            +    if method == "GET":
            +        if self.app.oauth_flow is not None:
            +            oauth_flow: OAuthFlow = self.app.oauth_flow
            +            bolt_req: BoltRequest = to_bolt_request(event)
            +            query = bolt_req.query
            +            is_callback = query is not None and (
            +                (_first_value(query, "code") is not None and _first_value(query, "state") is not None)
            +                or _first_value(query, "error") is not None
            +            )
            +            if is_callback:
            +                bolt_resp = oauth_flow.handle_callback(bolt_req)
            +                return to_aws_response(bolt_resp)
            +            else:
            +                bolt_resp = oauth_flow.handle_installation(bolt_req)
            +                return to_aws_response(bolt_resp)
            +    elif method == "POST":
            +        bolt_req = to_bolt_request(event)
            +        # https://docs.aws.amazon.com/lambda/latest/dg/python-context.html
            +        aws_lambda_function_name = context.function_name
            +        bolt_req.context["aws_lambda_function_name"] = aws_lambda_function_name
            +        bolt_req.context["aws_lambda_invoked_function_arn"] = context.invoked_function_arn
            +        bolt_req.context["lambda_request"] = event
            +        bolt_resp = self.app.dispatch(bolt_req)
            +        aws_response = to_aws_response(bolt_resp)
            +        return aws_response
            +    elif method == "NONE":
            +        bolt_req = to_bolt_request(event)
            +        bolt_resp = self.app.dispatch(bolt_req)
            +        aws_response = to_aws_response(bolt_resp)
            +        return aws_response
            +
            +    return not_found()
            +
            @@ -178,7 +281,7 @@

            diff --git a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/index.html b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/index.html index 7b3f6882..023c9b6e 100644 --- a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.aws_lambda API documentation - + @@ -71,7 +82,6 @@

            Classes

            (app: App)
            -
            Expand source code @@ -134,6 +144,7 @@

            Classes

            return not_found()
            +

            Static methods

            @@ -149,6 +160,52 @@

            Methods

            def handle(self, event, context)
            +
            + +Expand source code + +
            def handle(self, event, context):
            +    self.logger.debug(f"Incoming event: {event}, context: {context}")
            +
            +    method = event.get("requestContext", {}).get("http", {}).get("method")
            +    if method is None:
            +        method = event.get("requestContext", {}).get("httpMethod")
            +
            +    if method is None:
            +        return not_found()
            +    if method == "GET":
            +        if self.app.oauth_flow is not None:
            +            oauth_flow: OAuthFlow = self.app.oauth_flow
            +            bolt_req: BoltRequest = to_bolt_request(event)
            +            query = bolt_req.query
            +            is_callback = query is not None and (
            +                (_first_value(query, "code") is not None and _first_value(query, "state") is not None)
            +                or _first_value(query, "error") is not None
            +            )
            +            if is_callback:
            +                bolt_resp = oauth_flow.handle_callback(bolt_req)
            +                return to_aws_response(bolt_resp)
            +            else:
            +                bolt_resp = oauth_flow.handle_installation(bolt_req)
            +                return to_aws_response(bolt_resp)
            +    elif method == "POST":
            +        bolt_req = to_bolt_request(event)
            +        # https://docs.aws.amazon.com/lambda/latest/dg/python-context.html
            +        aws_lambda_function_name = context.function_name
            +        bolt_req.context["aws_lambda_function_name"] = aws_lambda_function_name
            +        bolt_req.context["aws_lambda_invoked_function_arn"] = context.invoked_function_arn
            +        bolt_req.context["lambda_request"] = event
            +        bolt_resp = self.app.dispatch(bolt_req)
            +        aws_response = to_aws_response(bolt_resp)
            +        return aws_response
            +    elif method == "NONE":
            +        bolt_req = to_bolt_request(event)
            +        bolt_resp = self.app.dispatch(bolt_req)
            +        aws_response = to_aws_response(bolt_resp)
            +        return aws_response
            +
            +    return not_found()
            +
            @@ -192,7 +249,7 @@

            -

            Generated by pdoc 0.11.3.

            +

            Generated by pdoc 0.11.5.

            diff --git a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/internals.html b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/internals.html index 28b2ed6d..94fa2be4 100644 --- a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/internals.html +++ b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/internals.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.aws_lambda.internals API documentation - + @@ -49,7 +60,7 @@

            Module slack_bolt.adapter.aws_lambda.internals diff --git a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/lambda_s3_oauth_flow.html b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/lambda_s3_oauth_flow.html index 7a8691e7..067ad846 100644 --- a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/lambda_s3_oauth_flow.html +++ b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/lambda_s3_oauth_flow.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.aws_lambda.lambda_s3_oauth_flow API documentation - + @@ -40,16 +51,6 @@

            Classes

            (*,
            client: slack_sdk.web.client.WebClient | None = None,
            logger: logging.Logger | None = None,
            settings: OAuthSettings | None = None,
            oauth_state_bucket_name: str | None = None,
            installation_bucket_name: str | None = None)
            -

            The module to run the Slack app installation flow (OAuth flow).

            -

            Args

            -
            -
            client
            -
            The slack_sdk.web.WebClient instance.
            -
            logger
            -
            The logger.
            -
            settings
            -
            OAuth settings to configure this module.
            -
            Expand source code @@ -115,6 +116,16 @@

            Args

            self._logger = logging.getLogger(__name__) return self._logger
            +

            The module to run the Slack app installation flow (OAuth flow).

            +

            Args

            +
            +
            client
            +
            The slack_sdk.web.WebClient instance.
            +
            logger
            +
            The logger.
            +
            settings
            +
            OAuth settings to configure this module.
            +

            Ancestors

            • OAuthFlow
            • @@ -123,7 +134,6 @@

              Instance variables

              prop client : slack_sdk.web.client.WebClient
              -
              Expand source code @@ -134,10 +144,10 @@

              Instance variables

              self._client = create_web_client(logger=self.logger) return self._client
              +
              prop logger : logging.Logger
              -
              Expand source code @@ -148,8 +158,23 @@

              Instance variables

              self._logger = logging.getLogger(__name__) return self._logger
              +
              +

              Inherited members

              +
            @@ -179,7 +204,7 @@

            -

            Generated by pdoc 0.11.3.

            +

            Generated by pdoc 0.11.5.

            diff --git a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/lazy_listener_runner.html b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/lazy_listener_runner.html index 880cfa93..4fbebcd4 100644 --- a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/lazy_listener_runner.html +++ b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/lazy_listener_runner.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.aws_lambda.lazy_listener_runner API documentation - + @@ -40,7 +51,6 @@

            Classes

            (logger: logging.Logger, lambda_client: Any | None = None)
            -
            Expand source code @@ -66,6 +76,7 @@

            Classes

            ) self.logger.info(invocation)
            +

            Ancestors

            • LazyListenerRunner
            • @@ -74,6 +85,7 @@

              Inherited members

              • LazyListenerRunner: @@ -104,7 +116,7 @@

                -

                Generated by pdoc 0.11.3.

                +

                Generated by pdoc 0.11.5.

                diff --git a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/local_lambda_client.html b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/local_lambda_client.html index 75fd507b..1441fb2b 100644 --- a/docs/static/api-docs/slack_bolt/adapter/aws_lambda/local_lambda_client.html +++ b/docs/static/api-docs/slack_bolt/adapter/aws_lambda/local_lambda_client.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.aws_lambda.local_lambda_client API documentation - + @@ -40,7 +51,6 @@

                Classes

                (app: chalice.app.Chalice, config: chalice.config.Config)
                -

                Lambda client implementing invoke for use when running with Chalice CLI.

                Expand source code @@ -65,6 +75,7 @@

                Classes

                response = self._app(json.loads(Payload), lambda_context) return InvokeResponse(payload=response)
                +

                Lambda client implementing invoke for use when running with Chalice CLI.

                Ancestors

                • chalice.test.BaseClient
                • @@ -75,6 +86,23 @@

                  Methods

                  def invoke(self, FunctionName: str, InvocationType: str = 'Event', Payload: str = '{}') ‑> chalice.test.InvokeResponse
                  +
                  + +Expand source code + +
                  def invoke(
                  +    self,
                  +    FunctionName: str,
                  +    InvocationType: str = "Event",
                  +    Payload: str = "{}",
                  +) -> InvokeResponse:
                  +    scoped = self._config.scope(self._config.chalice_stage, FunctionName)
                  +    lambda_context = LambdaContext(FunctionName, memory_size=scoped.lambda_memory_size)
                  +
                  +    with self._patched_env_vars(scoped.environment_variables):
                  +        response = self._app(json.loads(Payload), lambda_context)
                  +    return InvokeResponse(payload=response)
                  +
                  @@ -106,7 +134,7 @@

                  -

                  Generated by pdoc 0.11.3.

                  +

                  Generated by pdoc 0.11.5.

                  diff --git a/docs/static/api-docs/slack_bolt/adapter/bottle/handler.html b/docs/static/api-docs/slack_bolt/adapter/bottle/handler.html index 47253e59..e14b2da4 100644 --- a/docs/static/api-docs/slack_bolt/adapter/bottle/handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/bottle/handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.bottle.handler API documentation - + @@ -37,12 +48,36 @@

                  Functions

                  def set_response(bolt_resp: BoltResponse,
                  resp: bottle.BaseResponse) ‑> None
                  +
                  + +Expand source code + +
                  def set_response(bolt_resp: BoltResponse, resp: Response) -> None:
                  +    resp.status = bolt_resp.status
                  +    for k, values in bolt_resp.headers.items():
                  +        for v in values:
                  +            resp.add_header(k, v)
                  +
                  def to_bolt_request(req: bottle.BaseRequest) ‑> BoltRequest
                  +
                  + +Expand source code + +
                  def to_bolt_request(req: Request) -> BoltRequest:
                  +    body = req.body.read()
                  +    if isinstance(body, bytes):
                  +        body = body.decode("utf-8")
                  +    return BoltRequest(
                  +        body=body,
                  +        query=req.query_string,
                  +        headers=req.headers,
                  +    )
                  +
                  @@ -55,7 +90,6 @@

                  Classes

                  (app: App)
                  -
                  Expand source code @@ -84,12 +118,37 @@

                  Classes

                  resp.status = 404 return "Not Found"
                  +

                  Methods

                  def handle(self, req: bottle.BaseRequest, resp: bottle.BaseResponse) ‑> str
                  +
                  + +Expand source code + +
                  def handle(self, req: Request, resp: Response) -> str:
                  +    if req.method == "GET":
                  +        if self.app.oauth_flow is not None:
                  +            oauth_flow: OAuthFlow = self.app.oauth_flow
                  +            if req.path == oauth_flow.install_path:
                  +                bolt_resp = oauth_flow.handle_installation(to_bolt_request(req))
                  +                set_response(bolt_resp, resp)
                  +                return bolt_resp.body or ""
                  +            elif req.path == oauth_flow.redirect_uri_path:
                  +                bolt_resp = oauth_flow.handle_callback(to_bolt_request(req))
                  +                set_response(bolt_resp, resp)
                  +                return bolt_resp.body or ""
                  +    elif req.method == "POST":
                  +        bolt_resp = self.app.dispatch(to_bolt_request(req))
                  +        set_response(bolt_resp, resp)
                  +        return bolt_resp.body or ""
                  +
                  +    resp.status = 404
                  +    return "Not Found"
                  +
                  @@ -127,7 +186,7 @@

                  diff --git a/docs/static/api-docs/slack_bolt/adapter/bottle/index.html b/docs/static/api-docs/slack_bolt/adapter/bottle/index.html index 11389133..0ceecb7f 100644 --- a/docs/static/api-docs/slack_bolt/adapter/bottle/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/bottle/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.bottle API documentation - + @@ -47,7 +58,6 @@

                  Classes

                  (app: App)
                  -
                  Expand source code @@ -76,12 +86,37 @@

                  Classes

                  resp.status = 404 return "Not Found"
                  +

                  Methods

                  def handle(self, req: bottle.BaseRequest, resp: bottle.BaseResponse) ‑> str
                  +
                  + +Expand source code + +
                  def handle(self, req: Request, resp: Response) -> str:
                  +    if req.method == "GET":
                  +        if self.app.oauth_flow is not None:
                  +            oauth_flow: OAuthFlow = self.app.oauth_flow
                  +            if req.path == oauth_flow.install_path:
                  +                bolt_resp = oauth_flow.handle_installation(to_bolt_request(req))
                  +                set_response(bolt_resp, resp)
                  +                return bolt_resp.body or ""
                  +            elif req.path == oauth_flow.redirect_uri_path:
                  +                bolt_resp = oauth_flow.handle_callback(to_bolt_request(req))
                  +                set_response(bolt_resp, resp)
                  +                return bolt_resp.body or ""
                  +    elif req.method == "POST":
                  +        bolt_resp = self.app.dispatch(to_bolt_request(req))
                  +        set_response(bolt_resp, resp)
                  +        return bolt_resp.body or ""
                  +
                  +    resp.status = 404
                  +    return "Not Found"
                  +
                  @@ -118,7 +153,7 @@

                  -

                  Generated by pdoc 0.11.3.

                  +

                  Generated by pdoc 0.11.5.

                  diff --git a/docs/static/api-docs/slack_bolt/adapter/cherrypy/handler.html b/docs/static/api-docs/slack_bolt/adapter/cherrypy/handler.html index 96829170..73578629 100644 --- a/docs/static/api-docs/slack_bolt/adapter/cherrypy/handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/cherrypy/handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.cherrypy.handler API documentation - + @@ -37,18 +48,73 @@

                  Functions

                  def build_bolt_request() ‑> BoltRequest
                  +
                  + +Expand source code + +
                  def build_bolt_request() -> BoltRequest:
                  +    req = cherrypy.request
                  +    body = req.raw_body if hasattr(req, "raw_body") else ""
                  +    return BoltRequest(
                  +        body=body,
                  +        query=req.query_string,
                  +        headers=req.headers,
                  +    )
                  +
                  def set_response_status_and_headers(bolt_resp: BoltResponse) ‑> None
                  +
                  + +Expand source code + +
                  def set_response_status_and_headers(bolt_resp: BoltResponse) -> None:
                  +    cherrypy.response.status = bolt_resp.status
                  +    for k, v in bolt_resp.first_headers_without_set_cookie().items():
                  +        cherrypy.response.headers[k] = v
                  +    for cookie in bolt_resp.cookies():
                  +        for name, c in cookie.items():
                  +            str_max_age: Optional[str] = c.get("max-age")
                  +            max_age: Optional[int] = int(str_max_age) if str_max_age else None
                  +            cherrypy_cookie = cherrypy.response.cookie
                  +            cherrypy_cookie[name] = c.value
                  +            cherrypy_cookie[name]["expires"] = c.get("expires")
                  +            cherrypy_cookie[name]["max-age"] = max_age
                  +            cherrypy_cookie[name]["domain"] = c.get("domain")
                  +            cherrypy_cookie[name]["path"] = c.get("path")
                  +            cherrypy_cookie[name]["secure"] = True
                  +            cherrypy_cookie[name]["httponly"] = True
                  +
                  def slack_in()
                  +
                  + +Expand source code + +
                  @cherrypy.tools.register("on_start_resource")
                  +def slack_in():
                  +    request = cherrypy.serving.request
                  +
                  +    def slack_processor(entity):
                  +        try:
                  +            if request.process_request_body:
                  +                body = entity.fp.read()
                  +                body = body.decode("utf-8") if isinstance(body, bytes) else ""
                  +                request.raw_body = body
                  +        except ValueError:
                  +            raise cherrypy.HTTPError(400, "Invalid request body")
                  +
                  +    request.body.processors.clear()
                  +    request.body.processors["application/json"] = slack_processor
                  +    request.body.processors["application/x-www-form-urlencoded"] = slack_processor
                  +
                  @@ -61,7 +127,6 @@

                  Classes

                  (app: App)
                  -
                  Expand source code @@ -92,12 +157,39 @@

                  Classes

                  cherrypy.response.status = 404 return "Not Found".encode("utf-8")
                  +

                  Methods

                  def handle(self) ‑> bytes
                  +
                  + +Expand source code + +
                  def handle(self) -> bytes:
                  +    req = cherrypy.request
                  +    if req.method == "GET":
                  +        if self.app.oauth_flow is not None:
                  +            oauth_flow: OAuthFlow = self.app.oauth_flow
                  +            request_path = req.wsgi_environ["REQUEST_URI"].split("?")[0]
                  +            if request_path == oauth_flow.install_path:
                  +                bolt_resp = oauth_flow.handle_installation(build_bolt_request())
                  +                set_response_status_and_headers(bolt_resp)
                  +                return (bolt_resp.body or "").encode("utf-8")
                  +            elif request_path == oauth_flow.redirect_uri_path:
                  +                bolt_resp = oauth_flow.handle_callback(build_bolt_request())
                  +                set_response_status_and_headers(bolt_resp)
                  +                return (bolt_resp.body or "").encode("utf-8")
                  +    elif req.method == "POST":
                  +        bolt_resp = self.app.dispatch(build_bolt_request())
                  +        set_response_status_and_headers(bolt_resp)
                  +        return (bolt_resp.body or "").encode("utf-8")
                  +
                  +    cherrypy.response.status = 404
                  +    return "Not Found".encode("utf-8")
                  +
                  @@ -136,7 +228,7 @@

                  diff --git a/docs/static/api-docs/slack_bolt/adapter/cherrypy/index.html b/docs/static/api-docs/slack_bolt/adapter/cherrypy/index.html index a0a15e41..a1c121e0 100644 --- a/docs/static/api-docs/slack_bolt/adapter/cherrypy/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/cherrypy/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.cherrypy API documentation - + @@ -47,7 +58,6 @@

                  Classes

                  (app: App)
                  -
                  Expand source code @@ -78,12 +88,39 @@

                  Classes

                  cherrypy.response.status = 404 return "Not Found".encode("utf-8")
                  +

                  Methods

                  def handle(self) ‑> bytes
                  +
                  + +Expand source code + +
                  def handle(self) -> bytes:
                  +    req = cherrypy.request
                  +    if req.method == "GET":
                  +        if self.app.oauth_flow is not None:
                  +            oauth_flow: OAuthFlow = self.app.oauth_flow
                  +            request_path = req.wsgi_environ["REQUEST_URI"].split("?")[0]
                  +            if request_path == oauth_flow.install_path:
                  +                bolt_resp = oauth_flow.handle_installation(build_bolt_request())
                  +                set_response_status_and_headers(bolt_resp)
                  +                return (bolt_resp.body or "").encode("utf-8")
                  +            elif request_path == oauth_flow.redirect_uri_path:
                  +                bolt_resp = oauth_flow.handle_callback(build_bolt_request())
                  +                set_response_status_and_headers(bolt_resp)
                  +                return (bolt_resp.body or "").encode("utf-8")
                  +    elif req.method == "POST":
                  +        bolt_resp = self.app.dispatch(build_bolt_request())
                  +        set_response_status_and_headers(bolt_resp)
                  +        return (bolt_resp.body or "").encode("utf-8")
                  +
                  +    cherrypy.response.status = 404
                  +    return "Not Found".encode("utf-8")
                  +
                  @@ -120,7 +157,7 @@

                  -

                  Generated by pdoc 0.11.3.

                  +

                  Generated by pdoc 0.11.5.

                  diff --git a/docs/static/api-docs/slack_bolt/adapter/django/handler.html b/docs/static/api-docs/slack_bolt/adapter/django/handler.html index 62140c7e..a2de8c99 100644 --- a/docs/static/api-docs/slack_bolt/adapter/django/handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/django/handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.django.handler API documentation - + @@ -37,18 +48,72 @@

                  Functions

                  def release_thread_local_connections(logger: logging.Logger, execution_timing: str)
                  +
                  + +Expand source code + +
                  def release_thread_local_connections(logger: Logger, execution_timing: str):
                  +    close_old_connections()
                  +    if logger.level <= logging.DEBUG:
                  +        current: Thread = current_thread()
                  +        logger.debug(
                  +            "Released thread-bound old DB connections "
                  +            f"(thread name: {current.name}, execution timing: {execution_timing})"
                  +        )
                  +
                  def to_bolt_request(req: django.http.request.HttpRequest) ‑> BoltRequest
                  +
                  + +Expand source code + +
                  def to_bolt_request(req: HttpRequest) -> BoltRequest:
                  +    raw_body: bytes = req.body
                  +    body: str = raw_body.decode("utf-8") if raw_body else ""
                  +    return BoltRequest(
                  +        body=body,
                  +        query=req.META["QUERY_STRING"],
                  +        headers=req.headers,
                  +    )
                  +
                  def to_django_response(bolt_resp: BoltResponse) ‑> django.http.response.HttpResponse
                  +
                  + +Expand source code + +
                  def to_django_response(bolt_resp: BoltResponse) -> HttpResponse:
                  +    resp: HttpResponse = HttpResponse(
                  +        status=bolt_resp.status,
                  +        content=bolt_resp.body.encode("utf-8"),
                  +    )
                  +    for k, v in bolt_resp.first_headers_without_set_cookie().items():
                  +        resp[k] = v
                  +
                  +    for cookie in bolt_resp.cookies():
                  +        for name, c in cookie.items():
                  +            str_max_age: Optional[str] = c.get("max-age")
                  +            max_age: Optional[int] = int(str_max_age) if str_max_age else None
                  +            resp.set_cookie(
                  +                key=name,
                  +                value=c.value,
                  +                expires=c.get("expires"),
                  +                max_age=max_age,
                  +                domain=c.get("domain"),
                  +                path=c.get("path"),
                  +                secure=True,
                  +                httponly=True,
                  +            )
                  +    return resp
                  +
                  @@ -60,9 +125,6 @@

                  Classes

                  class DjangoListenerCompletionHandler
                  -

                  Django sets DB connections as a thread-local variable per thread. -If the thread is not managed on the Django app side, the connections won't be released by Django. -This handler releases the connections every time a ThreadListenerRunner execution completes.

                  Expand source code @@ -76,6 +138,9 @@

                  Classes

                  def handle(self, request: BoltRequest, response: Optional[BoltResponse]) -> None: release_thread_local_connections(request.context.logger, "listener-completion")
                  +

                  Django sets DB connections as a thread-local variable per thread. +If the thread is not managed on the Django app side, the connections won't be released by Django. +This handler releases the connections every time a ThreadListenerRunner execution completes.

                  Ancestors

                  • ListenerCompletionHandler
                  • @@ -93,9 +158,6 @@

                    Inherited members

                    class DjangoListenerStartHandler
                    -

                    Django sets DB connections as a thread-local variable per thread. -If the thread is not managed on the Django app side, the connections won't be released by Django. -This handler releases the connections every time a ThreadListenerRunner execution completes.

                    Expand source code @@ -109,6 +171,9 @@

                    Inherited members

                    def handle(self, request: BoltRequest, response: Optional[BoltResponse]) -> None: release_thread_local_connections(request.context.logger, "listener-start")
                    +

                    Django sets DB connections as a thread-local variable per thread. +If the thread is not managed on the Django app side, the connections won't be released by Django. +This handler releases the connections every time a ThreadListenerRunner execution completes.

                    Ancestors

                    • ListenerStartHandler
                    • @@ -127,7 +192,6 @@

                      Inherited members

                      (logger: logging.Logger, executor: concurrent.futures._base.Executor)
                      -
                      Expand source code @@ -149,6 +213,7 @@

                      Inherited members

                      self.executor.submit(wrapped_func)
                      +

                      Ancestors

                      • ThreadLazyListenerRunner
                      • @@ -158,6 +223,7 @@

                        Inherited members

                        • ThreadLazyListenerRunner: @@ -169,7 +235,6 @@

                          Inherited members

                          (app: App)
                          -
                          Expand source code @@ -243,12 +308,33 @@

                          Inherited members

                          return HttpResponse(status=404, content=b"Not Found")
                          +

                          Methods

                          def handle(self, req: django.http.request.HttpRequest) ‑> django.http.response.HttpResponse
                          +
                          + +Expand source code + +
                          def handle(self, req: HttpRequest) -> HttpResponse:
                          +    if req.method == "GET":
                          +        if self.app.oauth_flow is not None:
                          +            oauth_flow: OAuthFlow = self.app.oauth_flow
                          +            if req.path == oauth_flow.install_path:
                          +                bolt_resp = oauth_flow.handle_installation(to_bolt_request(req))
                          +                return to_django_response(bolt_resp)
                          +            elif req.path == oauth_flow.redirect_uri_path:
                          +                bolt_resp = oauth_flow.handle_callback(to_bolt_request(req))
                          +                return to_django_response(bolt_resp)
                          +    elif req.method == "POST":
                          +        bolt_resp = self.app.dispatch(to_bolt_request(req))
                          +        return to_django_response(bolt_resp)
                          +
                          +    return HttpResponse(status=404, content=b"Not Found")
                          +
                          @@ -296,7 +382,7 @@

                          diff --git a/docs/static/api-docs/slack_bolt/adapter/django/index.html b/docs/static/api-docs/slack_bolt/adapter/django/index.html index a4eaf4a5..ed9f4365 100644 --- a/docs/static/api-docs/slack_bolt/adapter/django/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/django/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.django API documentation - + @@ -47,7 +58,6 @@

                          Classes

                          (app: App)
                          -
                          Expand source code @@ -121,12 +131,33 @@

                          Classes

                          return HttpResponse(status=404, content=b"Not Found")
                          +

                          Methods

                          def handle(self, req: django.http.request.HttpRequest) ‑> django.http.response.HttpResponse
                          +
                          + +Expand source code + +
                          def handle(self, req: HttpRequest) -> HttpResponse:
                          +    if req.method == "GET":
                          +        if self.app.oauth_flow is not None:
                          +            oauth_flow: OAuthFlow = self.app.oauth_flow
                          +            if req.path == oauth_flow.install_path:
                          +                bolt_resp = oauth_flow.handle_installation(to_bolt_request(req))
                          +                return to_django_response(bolt_resp)
                          +            elif req.path == oauth_flow.redirect_uri_path:
                          +                bolt_resp = oauth_flow.handle_callback(to_bolt_request(req))
                          +                return to_django_response(bolt_resp)
                          +    elif req.method == "POST":
                          +        bolt_resp = self.app.dispatch(to_bolt_request(req))
                          +        return to_django_response(bolt_resp)
                          +
                          +    return HttpResponse(status=404, content=b"Not Found")
                          +
                          @@ -163,7 +194,7 @@

                          -

                          Generated by pdoc 0.11.3.

                          +

                          Generated by pdoc 0.11.5.

                          diff --git a/docs/static/api-docs/slack_bolt/adapter/falcon/async_resource.html b/docs/static/api-docs/slack_bolt/adapter/falcon/async_resource.html index 29b78063..07d43239 100644 --- a/docs/static/api-docs/slack_bolt/adapter/falcon/async_resource.html +++ b/docs/static/api-docs/slack_bolt/adapter/falcon/async_resource.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.falcon.async_resource API documentation - + @@ -40,12 +51,6 @@

                          Classes

                          (app: AsyncApp)
                          -

                          For use with ASGI Falcon Apps.

                          -

                          from slack_bolt.async_app import AsyncApp -app = AsyncApp()

                          -

                          import falcon -app = falcon.asgi.App() -app.add_route("/slack/events", AsyncSlackAppResource(app))

                          Expand source code @@ -116,18 +121,53 @@

                          Classes

                          http_only=True, )
                          +

                          For use with ASGI Falcon Apps.

                          +

                          from slack_bolt.async_app import AsyncApp +app = AsyncApp()

                          +

                          import falcon +app = falcon.asgi.App() +app.add_route("/slack/events", AsyncSlackAppResource(app))

                          Methods

                          async def on_get(self, req: falcon.asgi.request.Request, resp: falcon.asgi.response.Response)
                          +
                          + +Expand source code + +
                          async def on_get(self, req: Request, resp: Response):
                          +    if self.app.oauth_flow is not None:
                          +        oauth_flow: AsyncOAuthFlow = self.app.oauth_flow
                          +        if req.path == oauth_flow.install_path:
                          +            bolt_resp = await oauth_flow.handle_installation(await self._to_bolt_request(req))
                          +            await self._write_response(bolt_resp, resp)
                          +            return
                          +        elif req.path == oauth_flow.redirect_uri_path:
                          +            bolt_resp = await oauth_flow.handle_callback(await self._to_bolt_request(req))
                          +            await self._write_response(bolt_resp, resp)
                          +            return
                          +
                          +    resp.status = "404"
                          +    # Falcon 4.x w/ mypy fails to correctly infer the str type here
                          +    resp.body = "The page is not found..."  # type: ignore[assignment]
                          +
                          async def on_post(self, req: falcon.asgi.request.Request, resp: falcon.asgi.response.Response)
                          +
                          + +Expand source code + +
                          async def on_post(self, req: Request, resp: Response):
                          +    bolt_req = await self._to_bolt_request(req)
                          +    bolt_resp = await self.app.async_dispatch(bolt_req)
                          +    await self._write_response(bolt_resp, resp)
                          +
                          @@ -160,7 +200,7 @@

                          -

                          Generated by pdoc 0.11.3.

                          +

                          Generated by pdoc 0.11.5.

                          diff --git a/docs/static/api-docs/slack_bolt/adapter/falcon/index.html b/docs/static/api-docs/slack_bolt/adapter/falcon/index.html index a688c666..50874f7b 100644 --- a/docs/static/api-docs/slack_bolt/adapter/falcon/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/falcon/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.falcon API documentation - + @@ -51,11 +62,6 @@

                          Classes

                          (app: App)
                          -

                          from slack_bolt import App -app = App()

                          -

                          import falcon -api = application = falcon.API() -api.add_route("/slack/events", SlackAppResource(app))

                          Expand source code @@ -126,18 +132,52 @@

                          Classes

                          http_only=True, )
                          +

                          from slack_bolt import App +app = App()

                          +

                          import falcon +api = application = falcon.API() +api.add_route("/slack/events", SlackAppResource(app))

                          Methods

                          def on_get(self, req: falcon.request.Request, resp: falcon.response.Response)
                          +
                          + +Expand source code + +
                          def on_get(self, req: Request, resp: Response):
                          +    if self.app.oauth_flow is not None:
                          +        oauth_flow: OAuthFlow = self.app.oauth_flow
                          +        if req.path == oauth_flow.install_path:
                          +            bolt_resp = oauth_flow.handle_installation(self._to_bolt_request(req))
                          +            self._write_response(bolt_resp, resp)
                          +            return
                          +        elif req.path == oauth_flow.redirect_uri_path:
                          +            bolt_resp = oauth_flow.handle_callback(self._to_bolt_request(req))
                          +            self._write_response(bolt_resp, resp)
                          +            return
                          +
                          +    resp.status = "404"
                          +    # Falcon 4.x w/ mypy fails to correctly infer the str type here
                          +    resp.body = "The page is not found..."  # type: ignore[assignment]
                          +
                          def on_post(self, req: falcon.request.Request, resp: falcon.response.Response)
                          +
                          + +Expand source code + +
                          def on_post(self, req: Request, resp: Response):
                          +    bolt_req = self._to_bolt_request(req)
                          +    bolt_resp = self.app.dispatch(bolt_req)
                          +    self._write_response(bolt_resp, resp)
                          +
                          @@ -176,7 +216,7 @@

                          -

                          Generated by pdoc 0.11.3.

                          +

                          Generated by pdoc 0.11.5.

                          diff --git a/docs/static/api-docs/slack_bolt/adapter/falcon/resource.html b/docs/static/api-docs/slack_bolt/adapter/falcon/resource.html index b3bdf6cf..b999b290 100644 --- a/docs/static/api-docs/slack_bolt/adapter/falcon/resource.html +++ b/docs/static/api-docs/slack_bolt/adapter/falcon/resource.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.falcon.resource API documentation - + @@ -40,11 +51,6 @@

                          Classes

                          (app: App)
                          -

                          from slack_bolt import App -app = App()

                          -

                          import falcon -api = application = falcon.API() -api.add_route("/slack/events", SlackAppResource(app))

                          Expand source code @@ -115,18 +121,52 @@

                          Classes

                          http_only=True, )
                          +

                          from slack_bolt import App +app = App()

                          +

                          import falcon +api = application = falcon.API() +api.add_route("/slack/events", SlackAppResource(app))

                          Methods

                          def on_get(self, req: falcon.request.Request, resp: falcon.response.Response)
                          +
                          + +Expand source code + +
                          def on_get(self, req: Request, resp: Response):
                          +    if self.app.oauth_flow is not None:
                          +        oauth_flow: OAuthFlow = self.app.oauth_flow
                          +        if req.path == oauth_flow.install_path:
                          +            bolt_resp = oauth_flow.handle_installation(self._to_bolt_request(req))
                          +            self._write_response(bolt_resp, resp)
                          +            return
                          +        elif req.path == oauth_flow.redirect_uri_path:
                          +            bolt_resp = oauth_flow.handle_callback(self._to_bolt_request(req))
                          +            self._write_response(bolt_resp, resp)
                          +            return
                          +
                          +    resp.status = "404"
                          +    # Falcon 4.x w/ mypy fails to correctly infer the str type here
                          +    resp.body = "The page is not found..."  # type: ignore[assignment]
                          +
                          def on_post(self, req: falcon.request.Request, resp: falcon.response.Response)
                          +
                          + +Expand source code + +
                          def on_post(self, req: Request, resp: Response):
                          +    bolt_req = self._to_bolt_request(req)
                          +    bolt_resp = self.app.dispatch(bolt_req)
                          +    self._write_response(bolt_resp, resp)
                          +
                          @@ -159,7 +199,7 @@

                          -

                          Generated by pdoc 0.11.3.

                          +

                          Generated by pdoc 0.11.5.

                          diff --git a/docs/static/api-docs/slack_bolt/adapter/fastapi/async_handler.html b/docs/static/api-docs/slack_bolt/adapter/fastapi/async_handler.html index 9fec3596..0056ce30 100644 --- a/docs/static/api-docs/slack_bolt/adapter/fastapi/async_handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/fastapi/async_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.fastapi.async_handler API documentation - + @@ -40,7 +51,6 @@

                          Classes

                          (app: AsyncApp)
                          -
                          Expand source code @@ -73,12 +83,41 @@

                          Classes

                          content="Not found", )
                          +

                          Methods

                          async def handle(self,
                          req: starlette.requests.Request,
                          addition_context_properties: Dict[str, Any] | None = None) ‑> starlette.responses.Response
                          +
                          + +Expand source code + +
                          async def handle(self, req: Request, addition_context_properties: Optional[Dict[str, Any]] = None) -> Response:
                          +    body = await req.body()
                          +    if req.method == "GET":
                          +        if self.app.oauth_flow is not None:
                          +            oauth_flow: AsyncOAuthFlow = self.app.oauth_flow
                          +            if req.url.path == oauth_flow.install_path:
                          +                bolt_resp = await oauth_flow.handle_installation(
                          +                    to_async_bolt_request(req, body, addition_context_properties)
                          +                )
                          +                return to_starlette_response(bolt_resp)
                          +            elif req.url.path == oauth_flow.redirect_uri_path:
                          +                bolt_resp = await oauth_flow.handle_callback(
                          +                    to_async_bolt_request(req, body, addition_context_properties)
                          +                )
                          +                return to_starlette_response(bolt_resp)
                          +    elif req.method == "POST":
                          +        bolt_resp = await self.app.async_dispatch(to_async_bolt_request(req, body, addition_context_properties))
                          +        return to_starlette_response(bolt_resp)
                          +
                          +    return Response(
                          +        status_code=404,
                          +        content="Not found",
                          +    )
                          +
                          @@ -110,7 +149,7 @@

                          -

                          Generated by pdoc 0.11.3.

                          +

                          Generated by pdoc 0.11.5.

                          diff --git a/docs/static/api-docs/slack_bolt/adapter/fastapi/index.html b/docs/static/api-docs/slack_bolt/adapter/fastapi/index.html index b0dcb6a2..49b91a81 100644 --- a/docs/static/api-docs/slack_bolt/adapter/fastapi/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/fastapi/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.fastapi API documentation - + @@ -47,7 +58,6 @@

                          Classes

                          (app: App)
                          -
                          Expand source code @@ -76,12 +86,37 @@

                          Classes

                          content="Not found", )
                          +

                          Methods

                          async def handle(self,
                          req: starlette.requests.Request,
                          addition_context_properties: Dict[str, Any] | None = None) ‑> starlette.responses.Response
                          +
                          + +Expand source code + +
                          async def handle(self, req: Request, addition_context_properties: Optional[Dict[str, Any]] = None) -> Response:
                          +    body = await req.body()
                          +    if req.method == "GET":
                          +        if self.app.oauth_flow is not None:
                          +            oauth_flow: OAuthFlow = self.app.oauth_flow
                          +            if req.url.path == oauth_flow.install_path:
                          +                bolt_resp = oauth_flow.handle_installation(to_bolt_request(req, body, addition_context_properties))
                          +                return to_starlette_response(bolt_resp)
                          +            elif req.url.path == oauth_flow.redirect_uri_path:
                          +                bolt_resp = oauth_flow.handle_callback(to_bolt_request(req, body, addition_context_properties))
                          +                return to_starlette_response(bolt_resp)
                          +    elif req.method == "POST":
                          +        bolt_resp = self.app.dispatch(to_bolt_request(req, body, addition_context_properties))
                          +        return to_starlette_response(bolt_resp)
                          +
                          +    return Response(
                          +        status_code=404,
                          +        content="Not found",
                          +    )
                          +
                          @@ -118,7 +153,7 @@

                          -

                          Generated by pdoc 0.11.3.

                          +

                          Generated by pdoc 0.11.5.

                          diff --git a/docs/static/api-docs/slack_bolt/adapter/flask/handler.html b/docs/static/api-docs/slack_bolt/adapter/flask/handler.html index 249df9c9..1b395260 100644 --- a/docs/static/api-docs/slack_bolt/adapter/flask/handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/flask/handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.flask.handler API documentation - + @@ -37,12 +48,37 @@

                          Functions

                          def to_bolt_request(req: flask.wrappers.Request) ‑> BoltRequest
                          +
                          + +Expand source code + +
                          def to_bolt_request(req: Request) -> BoltRequest:
                          +    return BoltRequest(
                          +        body=req.get_data(as_text=True),
                          +        query=req.query_string.decode("utf-8"),
                          +        headers=req.headers,  # type: ignore[arg-type]
                          +    )
                          +
                          def to_flask_response(bolt_resp: BoltResponse) ‑> flask.wrappers.Response
                          +
                          + +Expand source code + +
                          def to_flask_response(bolt_resp: BoltResponse) -> Response:
                          +    resp: Response = make_response(bolt_resp.body, bolt_resp.status)
                          +    for k, values in bolt_resp.headers.items():
                          +        if k.lower() == "content-type" and resp.headers.get("content-type") is not None:
                          +            # Remove the one set by Flask
                          +            resp.headers.pop("content-type")
                          +        for v in values:
                          +            resp.headers.add_header(k, v)
                          +    return resp
                          +
                          @@ -55,7 +91,6 @@

                          Classes

                          (app: App)
                          -
                          Expand source code @@ -80,12 +115,33 @@

                          Classes

                          return make_response("Not Found", 404)
                          +

                          Methods

                          def handle(self, req: flask.wrappers.Request) ‑> flask.wrappers.Response
                          +
                          + +Expand source code + +
                          def handle(self, req: Request) -> Response:
                          +    if req.method == "GET":
                          +        if self.app.oauth_flow is not None:
                          +            oauth_flow: OAuthFlow = self.app.oauth_flow
                          +            if req.path == oauth_flow.install_path:
                          +                bolt_resp = oauth_flow.handle_installation(to_bolt_request(req))
                          +                return to_flask_response(bolt_resp)
                          +            elif req.path == oauth_flow.redirect_uri_path:
                          +                bolt_resp = oauth_flow.handle_callback(to_bolt_request(req))
                          +                return to_flask_response(bolt_resp)
                          +    elif req.method == "POST":
                          +        bolt_resp = self.app.dispatch(to_bolt_request(req))
                          +        return to_flask_response(bolt_resp)
                          +
                          +    return make_response("Not Found", 404)
                          +
                          @@ -123,7 +179,7 @@

                          -

                          Generated by pdoc 0.11.3.

                          +

                          Generated by pdoc 0.11.5.

                          diff --git a/docs/static/api-docs/slack_bolt/adapter/flask/index.html b/docs/static/api-docs/slack_bolt/adapter/flask/index.html index 782743bc..7d4b6029 100644 --- a/docs/static/api-docs/slack_bolt/adapter/flask/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/flask/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.flask API documentation - + @@ -47,7 +58,6 @@

                          Classes

                          (app: App)
                          -
                          Expand source code @@ -72,12 +82,33 @@

                          Classes

                          return make_response("Not Found", 404)
                          +

                          Methods

                          def handle(self, req: flask.wrappers.Request) ‑> flask.wrappers.Response
                          +
                          + +Expand source code + +
                          def handle(self, req: Request) -> Response:
                          +    if req.method == "GET":
                          +        if self.app.oauth_flow is not None:
                          +            oauth_flow: OAuthFlow = self.app.oauth_flow
                          +            if req.path == oauth_flow.install_path:
                          +                bolt_resp = oauth_flow.handle_installation(to_bolt_request(req))
                          +                return to_flask_response(bolt_resp)
                          +            elif req.path == oauth_flow.redirect_uri_path:
                          +                bolt_resp = oauth_flow.handle_callback(to_bolt_request(req))
                          +                return to_flask_response(bolt_resp)
                          +    elif req.method == "POST":
                          +        bolt_resp = self.app.dispatch(to_bolt_request(req))
                          +        return to_flask_response(bolt_resp)
                          +
                          +    return make_response("Not Found", 404)
                          +
                          @@ -114,7 +145,7 @@

                          -

                          Generated by pdoc 0.11.3.

                          +

                          Generated by pdoc 0.11.5.

                          diff --git a/docs/static/api-docs/slack_bolt/adapter/google_cloud_functions/handler.html b/docs/static/api-docs/slack_bolt/adapter/google_cloud_functions/handler.html index 2a45c1a3..0b48a26a 100644 --- a/docs/static/api-docs/slack_bolt/adapter/google_cloud_functions/handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/google_cloud_functions/handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.google_cloud_functions.handler API documentation - + @@ -39,7 +50,6 @@

                          Classes

                          class NoopLazyListenerRunner
                          -
                          Expand source code @@ -52,6 +62,7 @@

                          Classes

                          "rewriting your code not to use lazy listeners." )
                          +

                          Ancestors

                          • LazyListenerRunner
                          • @@ -60,6 +71,7 @@

                            Inherited members

                            • LazyListenerRunner: @@ -71,7 +83,6 @@

                              Inherited members

                              (app: App)
                              -
                              Expand source code @@ -99,12 +110,32 @@

                              Inherited members

                              return make_response("Not Found", 404)
                              +

                              Methods

                              def handle(self, req: flask.wrappers.Request) ‑> flask.wrappers.Response
                              +
                              + +Expand source code + +
                              def handle(self, req: Request) -> Response:
                              +    if req.method == "GET" and self.app.oauth_flow is not None:
                              +        bolt_req = to_bolt_request(req)
                              +        if "code" in req.args or "error" in req.args or "state" in req.args:
                              +            bolt_resp = self.app.oauth_flow.handle_callback(bolt_req)
                              +            return to_flask_response(bolt_resp)
                              +        else:
                              +            bolt_resp = self.app.oauth_flow.handle_installation(bolt_req)
                              +            return to_flask_response(bolt_resp)
                              +    elif req.method == "POST":
                              +        bolt_resp = self.app.dispatch(to_bolt_request(req))
                              +        return to_flask_response(bolt_resp)
                              +
                              +    return make_response("Not Found", 404)
                              +
                              @@ -139,7 +170,7 @@

                              -

                              Generated by pdoc 0.11.3.

                              +

                              Generated by pdoc 0.11.5.

                              diff --git a/docs/static/api-docs/slack_bolt/adapter/google_cloud_functions/index.html b/docs/static/api-docs/slack_bolt/adapter/google_cloud_functions/index.html index 8a905fb5..3ad305b8 100644 --- a/docs/static/api-docs/slack_bolt/adapter/google_cloud_functions/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/google_cloud_functions/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.google_cloud_functions API documentation - + @@ -47,7 +58,6 @@

                              Classes

                              (app: App)
                              -
                              Expand source code @@ -75,12 +85,32 @@

                              Classes

                              return make_response("Not Found", 404)
                              +

                              Methods

                              def handle(self, req: flask.wrappers.Request) ‑> flask.wrappers.Response
                              +
                              + +Expand source code + +
                              def handle(self, req: Request) -> Response:
                              +    if req.method == "GET" and self.app.oauth_flow is not None:
                              +        bolt_req = to_bolt_request(req)
                              +        if "code" in req.args or "error" in req.args or "state" in req.args:
                              +            bolt_resp = self.app.oauth_flow.handle_callback(bolt_req)
                              +            return to_flask_response(bolt_resp)
                              +        else:
                              +            bolt_resp = self.app.oauth_flow.handle_installation(bolt_req)
                              +            return to_flask_response(bolt_resp)
                              +    elif req.method == "POST":
                              +        bolt_resp = self.app.dispatch(to_bolt_request(req))
                              +        return to_flask_response(bolt_resp)
                              +
                              +    return make_response("Not Found", 404)
                              +
                              @@ -117,7 +147,7 @@

                              -

                              Generated by pdoc 0.11.3.

                              +

                              Generated by pdoc 0.11.5.

                              diff --git a/docs/static/api-docs/slack_bolt/adapter/index.html b/docs/static/api-docs/slack_bolt/adapter/index.html index 75b5c9d5..78ef4a2f 100644 --- a/docs/static/api-docs/slack_bolt/adapter/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter API documentation - + @@ -137,7 +148,7 @@

                              Sub-modules

                              diff --git a/docs/static/api-docs/slack_bolt/adapter/pyramid/handler.html b/docs/static/api-docs/slack_bolt/adapter/pyramid/handler.html index cc45e56c..2f26bbc3 100644 --- a/docs/static/api-docs/slack_bolt/adapter/pyramid/handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/pyramid/handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.pyramid.handler API documentation - + @@ -37,12 +48,47 @@

                              Functions

                              def to_bolt_request(request: pyramid.request.Request) ‑> BoltRequest
                              +
                              + +Expand source code + +
                              def to_bolt_request(request: Request) -> BoltRequest:
                              +    body: str = ""
                              +    if request.body is not None:
                              +        if isinstance(request.body, bytes):
                              +            body = request.body.decode("utf-8")
                              +        else:
                              +            body = request.body
                              +    bolt_req = BoltRequest(
                              +        body=body,
                              +        query=request.query_string,
                              +        headers=request.headers,
                              +    )
                              +    return bolt_req
                              +
                              def to_pyramid_response(bolt_resp: BoltResponse) ‑> pyramid.response.Response
                              +
                              + +Expand source code + +
                              def to_pyramid_response(bolt_resp: BoltResponse) -> Response:
                              +    headers: List[Tuple[str, str]] = []
                              +    for k, vs in bolt_resp.headers.items():
                              +        for v in vs:
                              +            headers.append((k, v))
                              +
                              +    return Response(
                              +        status=bolt_resp.status,
                              +        body=bolt_resp.body or "",
                              +        headerlist=headers,
                              +        charset="utf-8",
                              +    )
                              +
                              @@ -55,7 +101,6 @@

                              Classes

                              (app: App)
                              -
                              Expand source code @@ -83,12 +128,36 @@

                              Classes

                              return Response(status=404, body="Not found")
                              +

                              Methods

                              def handle(self, request: pyramid.request.Request) ‑> pyramid.response.Response
                              +
                              + +Expand source code + +
                              def handle(self, request: Request) -> Response:
                              +    if request.method == "GET":
                              +        if self.app.oauth_flow is not None:
                              +            oauth_flow: OAuthFlow = self.app.oauth_flow
                              +            if request.path == oauth_flow.install_path:
                              +                bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
                              +                bolt_resp = oauth_flow.handle_installation(bolt_req)
                              +                return to_pyramid_response(bolt_resp)
                              +            elif request.path == oauth_flow.redirect_uri_path:
                              +                bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
                              +                bolt_resp = oauth_flow.handle_callback(bolt_req)
                              +                return to_pyramid_response(bolt_resp)
                              +    elif request.method == "POST":
                              +        bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
                              +        bolt_resp = self.app.dispatch(bolt_req)
                              +        return to_pyramid_response(bolt_resp)
                              +
                              +    return Response(status=404, body="Not found")
                              +
                              @@ -126,7 +195,7 @@

                              diff --git a/docs/static/api-docs/slack_bolt/adapter/pyramid/index.html b/docs/static/api-docs/slack_bolt/adapter/pyramid/index.html index ce6ba815..30d3685e 100644 --- a/docs/static/api-docs/slack_bolt/adapter/pyramid/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/pyramid/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.pyramid API documentation - + @@ -47,7 +58,6 @@

                              Classes

                              (app: App)
                              -
                              Expand source code @@ -75,12 +85,36 @@

                              Classes

                              return Response(status=404, body="Not found")
                              +

                              Methods

                              def handle(self, request: pyramid.request.Request) ‑> pyramid.response.Response
                              +
                              + +Expand source code + +
                              def handle(self, request: Request) -> Response:
                              +    if request.method == "GET":
                              +        if self.app.oauth_flow is not None:
                              +            oauth_flow: OAuthFlow = self.app.oauth_flow
                              +            if request.path == oauth_flow.install_path:
                              +                bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
                              +                bolt_resp = oauth_flow.handle_installation(bolt_req)
                              +                return to_pyramid_response(bolt_resp)
                              +            elif request.path == oauth_flow.redirect_uri_path:
                              +                bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
                              +                bolt_resp = oauth_flow.handle_callback(bolt_req)
                              +                return to_pyramid_response(bolt_resp)
                              +    elif request.method == "POST":
                              +        bolt_req = _attach_pyramid_request_to_context(to_bolt_request(request), request)
                              +        bolt_resp = self.app.dispatch(bolt_req)
                              +        return to_pyramid_response(bolt_resp)
                              +
                              +    return Response(status=404, body="Not found")
                              +
                              @@ -117,7 +151,7 @@

                              -

                              Generated by pdoc 0.11.3.

                              +

                              Generated by pdoc 0.11.5.

                              diff --git a/docs/static/api-docs/slack_bolt/adapter/sanic/async_handler.html b/docs/static/api-docs/slack_bolt/adapter/sanic/async_handler.html index 97b04ce1..37945775 100644 --- a/docs/static/api-docs/slack_bolt/adapter/sanic/async_handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/sanic/async_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.sanic.async_handler API documentation - + @@ -37,12 +48,60 @@

                              Functions

                              def to_async_bolt_request(req: sanic.request.types.Request,
                              addition_context_properties: Dict[str, Any] | None = None) ‑> AsyncBoltRequest
                              +
                              + +Expand source code + +
                              def to_async_bolt_request(req: Request, addition_context_properties: Optional[Dict[str, Any]] = None) -> AsyncBoltRequest:
                              +    request = AsyncBoltRequest(
                              +        body=req.body.decode("utf-8"),
                              +        query=req.query_string,
                              +        headers=req.headers,  # type: ignore[arg-type]
                              +    )
                              +
                              +    if addition_context_properties is not None:
                              +        for k, v in addition_context_properties.items():
                              +            request.context[k] = v
                              +
                              +    return request
                              +
                              def to_sanic_response(bolt_resp: BoltResponse) ‑> sanic.response.types.HTTPResponse
                              +
                              + +Expand source code + +
                              def to_sanic_response(bolt_resp: BoltResponse) -> HTTPResponse:
                              +    resp = HTTPResponse(
                              +        status=bolt_resp.status,
                              +        body=bolt_resp.body,
                              +        headers=bolt_resp.first_headers_without_set_cookie(),
                              +    )
                              +
                              +    for cookie in bolt_resp.cookies():
                              +        for key, c in cookie.items():
                              +            expire_value = c.get("expires")
                              +            expires = datetime.strptime(expire_value, "%a, %d %b %Y %H:%M:%S %Z") if expire_value else None
                              +            max_age = int(c["max-age"]) if c.get("max-age") else None
                              +            path = str(c.get("path")) if c.get("path") else "/"
                              +            domain = str(c.get("domain")) if c.get("domain") else None
                              +            resp.add_cookie(
                              +                key=key,
                              +                value=c.value,
                              +                expires=expires,
                              +                path=path,
                              +                domain=domain,
                              +                max_age=max_age,
                              +                secure=True,
                              +                httponly=True,
                              +            )
                              +
                              +    return resp
                              +
                              @@ -55,7 +114,6 @@

                              Classes

                              (app: AsyncApp)
                              -
                              Expand source code @@ -84,12 +142,37 @@

                              Classes

                              body="Not found", )
                              +

                              Methods

                              async def handle(self,
                              req: sanic.request.types.Request,
                              addition_context_properties: Dict[str, Any] | None = None) ‑> sanic.response.types.HTTPResponse
                              +
                              + +Expand source code + +
                              async def handle(self, req: Request, addition_context_properties: Optional[Dict[str, Any]] = None) -> HTTPResponse:
                              +    if req.method == "GET":
                              +        if self.app.oauth_flow is not None:
                              +            oauth_flow: AsyncOAuthFlow = self.app.oauth_flow
                              +            if req.path == oauth_flow.install_path:
                              +                bolt_resp = await oauth_flow.handle_installation(to_async_bolt_request(req, addition_context_properties))
                              +                return to_sanic_response(bolt_resp)
                              +            elif req.path == oauth_flow.redirect_uri_path:
                              +                bolt_resp = await oauth_flow.handle_callback(to_async_bolt_request(req, addition_context_properties))
                              +                return to_sanic_response(bolt_resp)
                              +
                              +    elif req.method == "POST":
                              +        bolt_resp = await self.app.async_dispatch(to_async_bolt_request(req, addition_context_properties))
                              +        return to_sanic_response(bolt_resp)
                              +
                              +    return HTTPResponse(
                              +        status=404,
                              +        body="Not found",
                              +    )
                              +
                              @@ -127,7 +210,7 @@

                              -

                              Generated by pdoc 0.11.3.

                              +

                              Generated by pdoc 0.11.5.

                              diff --git a/docs/static/api-docs/slack_bolt/adapter/sanic/index.html b/docs/static/api-docs/slack_bolt/adapter/sanic/index.html index 6885f989..1ae23450 100644 --- a/docs/static/api-docs/slack_bolt/adapter/sanic/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/sanic/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.sanic API documentation - + @@ -47,7 +58,6 @@

                              Classes

                              (app: AsyncApp)
                              -
                              Expand source code @@ -76,12 +86,37 @@

                              Classes

                              body="Not found", )
                              +

                              Methods

                              async def handle(self,
                              req: sanic.request.types.Request,
                              addition_context_properties: Dict[str, Any] | None = None) ‑> sanic.response.types.HTTPResponse
                              +
                              + +Expand source code + +
                              async def handle(self, req: Request, addition_context_properties: Optional[Dict[str, Any]] = None) -> HTTPResponse:
                              +    if req.method == "GET":
                              +        if self.app.oauth_flow is not None:
                              +            oauth_flow: AsyncOAuthFlow = self.app.oauth_flow
                              +            if req.path == oauth_flow.install_path:
                              +                bolt_resp = await oauth_flow.handle_installation(to_async_bolt_request(req, addition_context_properties))
                              +                return to_sanic_response(bolt_resp)
                              +            elif req.path == oauth_flow.redirect_uri_path:
                              +                bolt_resp = await oauth_flow.handle_callback(to_async_bolt_request(req, addition_context_properties))
                              +                return to_sanic_response(bolt_resp)
                              +
                              +    elif req.method == "POST":
                              +        bolt_resp = await self.app.async_dispatch(to_async_bolt_request(req, addition_context_properties))
                              +        return to_sanic_response(bolt_resp)
                              +
                              +    return HTTPResponse(
                              +        status=404,
                              +        body="Not found",
                              +    )
                              +
                              @@ -118,7 +153,7 @@

                              -

                              Generated by pdoc 0.11.3.

                              +

                              Generated by pdoc 0.11.5.

                              diff --git a/docs/static/api-docs/slack_bolt/adapter/socket_mode/aiohttp/index.html b/docs/static/api-docs/slack_bolt/adapter/socket_mode/aiohttp/index.html index be06a800..f9d24087 100644 --- a/docs/static/api-docs/slack_bolt/adapter/socket_mode/aiohttp/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/socket_mode/aiohttp/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.socket_mode.aiohttp API documentation - + @@ -41,7 +52,6 @@

                              Classes

                              (app: AsyncApp,
                              app_token: str | None = None,
                              logger: logging.Logger | None = None,
                              web_client: slack_sdk.web.async_client.AsyncWebClient | None = None,
                              proxy: str | None = None,
                              ping_interval: float = 10,
                              loop: asyncio.events.AbstractEventLoop | None = None)
                              -
                              Expand source code @@ -78,29 +88,24 @@

                              Classes

                              bolt_resp: BoltResponse = await run_async_bolt_app(self.app, req) await send_async_response(client, req, bolt_resp, start)
                              +

                              Ancestors

                              Class variables

                              -
                              var appAsyncApp
                              -
                              -
                              -
                              var app_token : str
                              -
                              -
                              -
                              var client : slack_sdk.socket_mode.aiohttp.SocketModeClient
                              -
                              -
                              +

                              The type of the None singleton.

                              Inherited members

                              • AsyncBaseSocketModeHandler:
                                  +
                                • app
                                • +
                                • client
                                • close_async
                                • connect_async
                                • disconnect_async
                                • @@ -115,22 +120,6 @@

                                  Inherited members

                                  (app: App,
                                  app_token: str | None = None,
                                  logger: logging.Logger | None = None,
                                  web_client: slack_sdk.web.async_client.AsyncWebClient | None = None,
                                  proxy: str | None = None,
                                  ping_interval: float = 10)
                                  -

                                  Socket Mode adapter for Bolt apps

                                  -

                                  Args

                                  -
                                  -
                                  app
                                  -
                                  The Bolt app
                                  -
                                  app_token
                                  -
                                  App-level token starting with xapp-
                                  -
                                  logger
                                  -
                                  Custom logger
                                  -
                                  web_client
                                  -
                                  custom slack_sdk.web.WebClient instance
                                  -
                                  proxy
                                  -
                                  HTTP proxy URL
                                  -
                                  ping_interval
                                  -
                                  The ping-pong internal (seconds)
                                  -
                                  Expand source code @@ -175,29 +164,39 @@

                                  Args

                                  bolt_resp: BoltResponse = run_bolt_app(self.app, req) await send_async_response(client, req, bolt_resp, start)
                                  +

                                  Socket Mode adapter for Bolt apps

                                  +

                                  Args

                                  +
                                  +
                                  app
                                  +
                                  The Bolt app
                                  +
                                  app_token
                                  +
                                  App-level token starting with xapp-
                                  +
                                  logger
                                  +
                                  Custom logger
                                  +
                                  web_client
                                  +
                                  custom slack_sdk.web.WebClient instance
                                  +
                                  proxy
                                  +
                                  HTTP proxy URL
                                  +
                                  ping_interval
                                  +
                                  The ping-pong internal (seconds)
                                  +

                                  Ancestors

                                  Class variables

                                  -
                                  var appApp
                                  -
                                  -
                                  -
                                  var app_token : str
                                  -
                                  -
                                  -
                                  var client : slack_sdk.socket_mode.aiohttp.SocketModeClient
                                  -
                                  -
                                  +

                                  The type of the None singleton.

                                  Inherited members

                                  • AsyncBaseSocketModeHandler: @@ -244,7 +239,7 @@

                                    diff --git a/docs/static/api-docs/slack_bolt/adapter/socket_mode/async_base_handler.html b/docs/static/api-docs/slack_bolt/adapter/socket_mode/async_base_handler.html index d1b60ac6..31b681b3 100644 --- a/docs/static/api-docs/slack_bolt/adapter/socket_mode/async_base_handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/socket_mode/async_base_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.socket_mode.async_base_handler API documentation - + @@ -40,7 +51,6 @@

                                    Classes

                                    class AsyncBaseSocketModeHandler
                                    -
                                    Expand source code @@ -82,6 +92,7 @@

                                    Classes

                                    self.app.logger.info(get_boot_message()) await asyncio.sleep(float("inf"))
                                    +

                                    Subclasses

                                    • AsyncSocketModeHandler
                                    • @@ -93,11 +104,11 @@

                                      Class variables

                                      var appApp | AsyncApp
                                      -
                                      +

                                      The type of the None singleton.

                                      var client : slack_sdk.socket_mode.async_client.AsyncBaseSocketModeClient
                                      -
                                      +

                                      The type of the None singleton.

                                      Methods

                                      @@ -106,24 +117,61 @@

                                      Methods

                                      async def close_async(self)
                                      +
                                      + +Expand source code + +
                                      async def close_async(self):
                                      +    """Disconnects from the Socket Mode server and cleans the resources this instance holds up"""
                                      +    await self.client.close()
                                      +

                                      Disconnects from the Socket Mode server and cleans the resources this instance holds up

                                      async def connect_async(self)
                                      +
                                      + +Expand source code + +
                                      async def connect_async(self):
                                      +    """Establishes a new connection with the Socket Mode server"""
                                      +    await self.client.connect()
                                      +

                                      Establishes a new connection with the Socket Mode server

                                      async def disconnect_async(self)
                                      +
                                      + +Expand source code + +
                                      async def disconnect_async(self):
                                      +    """Disconnects the current WebSocket connection with the Socket Mode server"""
                                      +    await self.client.disconnect()
                                      +

                                      Disconnects the current WebSocket connection with the Socket Mode server

                                      async def handle(self,
                                      client: slack_sdk.socket_mode.async_client.AsyncBaseSocketModeClient,
                                      req: slack_sdk.socket_mode.request.SocketModeRequest) ‑> None
                                      +
                                      + +Expand source code + +
                                      async def handle(self, client: AsyncBaseSocketModeClient, req: SocketModeRequest) -> None:
                                      +    """Handles Socket Mode envelope requests through a WebSocket connection.
                                      +
                                      +    Args:
                                      +        client: this Socket Mode client instance
                                      +        req: the request data
                                      +    """
                                      +    raise NotImplementedError()
                                      +

                                      Handles Socket Mode envelope requests through a WebSocket connection.

                                      Args

                                      @@ -137,6 +185,22 @@

                                      Args

                                      async def start_async(self)
                                      +
                                      + +Expand source code + +
                                      async def start_async(self):
                                      +    """Establishes a new connection and then starts infinite sleep
                                      +    to prevent the termination of this process.
                                      +    If you don't want to have the sleep, use `#connect()` method instead.
                                      +    """
                                      +    await self.connect_async()
                                      +    if self.app.logger.level > logging.INFO:
                                      +        print(get_boot_message())
                                      +    else:
                                      +        self.app.logger.info(get_boot_message())
                                      +    await asyncio.sleep(float("inf"))
                                      +

                                      Establishes a new connection and then starts infinite sleep to prevent the termination of this process. If you don't want to have the sleep, use #connect() method instead.

                                      @@ -176,7 +240,7 @@

                                      -

                                      Generated by pdoc 0.11.3.

                                      +

                                      Generated by pdoc 0.11.5.

                                      diff --git a/docs/static/api-docs/slack_bolt/adapter/socket_mode/async_handler.html b/docs/static/api-docs/slack_bolt/adapter/socket_mode/async_handler.html index 8dedfa3b..5093f128 100644 --- a/docs/static/api-docs/slack_bolt/adapter/socket_mode/async_handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/socket_mode/async_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.socket_mode.async_handler API documentation - + @@ -41,7 +52,6 @@

                                      Classes

                                      (app: AsyncApp,
                                      app_token: str | None = None,
                                      logger: logging.Logger | None = None,
                                      web_client: slack_sdk.web.async_client.AsyncWebClient | None = None,
                                      proxy: str | None = None,
                                      ping_interval: float = 10,
                                      loop: asyncio.events.AbstractEventLoop | None = None)
                                      -
                                      Expand source code @@ -78,29 +88,24 @@

                                      Classes

                                      bolt_resp: BoltResponse = await run_async_bolt_app(self.app, req) await send_async_response(client, req, bolt_resp, start)
                                      +

                                      Ancestors

                                      Class variables

                                      -
                                      var appAsyncApp
                                      -
                                      -
                                      -
                                      var app_token : str
                                      -
                                      -
                                      -
                                      var client : slack_sdk.socket_mode.aiohttp.SocketModeClient
                                      -
                                      -
                                      +

                                      The type of the None singleton.

                                      Inherited members

                                      • AsyncBaseSocketModeHandler: @@ -139,7 +142,7 @@

                                        -

                                        Generated by pdoc 0.11.3.

                                        +

                                        Generated by pdoc 0.11.5.

                                        diff --git a/docs/static/api-docs/slack_bolt/adapter/socket_mode/async_internals.html b/docs/static/api-docs/slack_bolt/adapter/socket_mode/async_internals.html index a8cab1e0..5b776948 100644 --- a/docs/static/api-docs/slack_bolt/adapter/socket_mode/async_internals.html +++ b/docs/static/api-docs/slack_bolt/adapter/socket_mode/async_internals.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.socket_mode.async_internals API documentation - + @@ -38,12 +49,51 @@

                                        Functions

                                        async def run_async_bolt_app(app: AsyncApp,
                                        req: slack_sdk.socket_mode.request.SocketModeRequest)
                                        +
                                        + +Expand source code + +
                                        async def run_async_bolt_app(app: AsyncApp, req: SocketModeRequest):
                                        +    bolt_req: AsyncBoltRequest = AsyncBoltRequest(mode="socket_mode", body=req.payload)
                                        +    bolt_resp: BoltResponse = await app.async_dispatch(bolt_req)
                                        +    return bolt_resp
                                        +
                                        async def send_async_response(client: slack_sdk.socket_mode.async_client.AsyncBaseSocketModeClient,
                                        req: slack_sdk.socket_mode.request.SocketModeRequest,
                                        bolt_resp: BoltResponse,
                                        start_time: float)
                                        +
                                        + +Expand source code + +
                                        async def send_async_response(
                                        +    client: AsyncBaseSocketModeClient,
                                        +    req: SocketModeRequest,
                                        +    bolt_resp: BoltResponse,
                                        +    start_time: float,
                                        +):
                                        +    if bolt_resp.status == 200:
                                        +        content_type = bolt_resp.headers.get("content-type", [""])[0]
                                        +        if bolt_resp.body is None or len(bolt_resp.body) == 0:
                                        +            await client.send_socket_mode_response(SocketModeResponse(envelope_id=req.envelope_id))
                                        +        elif content_type.startswith("application/json"):
                                        +            dict_body = json.loads(bolt_resp.body)
                                        +            await client.send_socket_mode_response(SocketModeResponse(envelope_id=req.envelope_id, payload=dict_body))
                                        +        else:
                                        +            await client.send_socket_mode_response(
                                        +                SocketModeResponse(
                                        +                    envelope_id=req.envelope_id,
                                        +                    payload={"text": bolt_resp.body},
                                        +                )
                                        +            )
                                        +        if client.logger.level <= logging.DEBUG:
                                        +            spent_time = int((time() - start_time) * 1000)
                                        +            client.logger.debug(f"Response time: {spent_time} milliseconds")
                                        +    else:
                                        +        client.logger.info(f"Unsuccessful Bolt execution result (status: {bolt_resp.status}, body: {bolt_resp.body})")
                                        +

                                      @@ -71,7 +121,7 @@

                                      Functions

                                      diff --git a/docs/static/api-docs/slack_bolt/adapter/socket_mode/base_handler.html b/docs/static/api-docs/slack_bolt/adapter/socket_mode/base_handler.html index 0fc07f7e..b5715692 100644 --- a/docs/static/api-docs/slack_bolt/adapter/socket_mode/base_handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/socket_mode/base_handler.html @@ -3,20 +3,31 @@ - + slack_bolt.adapter.socket_mode.base_handler API documentation - + @@ -42,7 +53,6 @@

                                      Classes

                                      class BaseSocketModeHandler
                                      -
                                      Expand source code @@ -90,6 +100,7 @@

                                      Classes

                                      Event().wait()
                                      +

                                      Subclasses

                                      • SocketModeHandler
                                      • @@ -99,11 +110,11 @@

                                        Class variables

                                        var appApp
                                        -
                                        +

                                        The type of the None singleton.

                                        var client : slack_sdk.socket_mode.client.BaseSocketModeClient
                                        -
                                        +

                                        The type of the None singleton.

                                        Methods

                                        @@ -112,24 +123,61 @@

                                        Methods

                                        def close(self)
                                        +
                                        + +Expand source code + +
                                        def close(self):
                                        +    """Disconnects from the Socket Mode server and cleans the resources this instance holds up"""
                                        +    self.client.close()
                                        +

                                        Disconnects from the Socket Mode server and cleans the resources this instance holds up

                                        def connect(self)
                                        +
                                        + +Expand source code + +
                                        def connect(self):
                                        +    """Establishes a new connection with the Socket Mode server"""
                                        +    self.client.connect()
                                        +

                                        Establishes a new connection with the Socket Mode server

                                        def disconnect(self)
                                        +
                                        + +Expand source code + +
                                        def disconnect(self):
                                        +    """Disconnects the current WebSocket connection with the Socket Mode server"""
                                        +    self.client.disconnect()
                                        +

                                        Disconnects the current WebSocket connection with the Socket Mode server

                                        def handle(self,
                                        client: slack_sdk.socket_mode.client.BaseSocketModeClient,
                                        req: slack_sdk.socket_mode.request.SocketModeRequest) ‑> None
                                        +
                                        + +Expand source code + +
                                        def handle(self, client: BaseSocketModeClient, req: SocketModeRequest) -> None:
                                        +    """Handles Socket Mode envelope requests through a WebSocket connection.
                                        +
                                        +    Args:
                                        +        client: this Socket Mode client instance
                                        +        req: the request data
                                        +    """
                                        +    raise NotImplementedError()
                                        +

                                        Handles Socket Mode envelope requests through a WebSocket connection.

                                        Args

                                        @@ -143,6 +191,28 @@

                                        Args

                                        def start(self)
                                        +
                                        + +Expand source code + +
                                        def start(self):
                                        +    """Establishes a new connection and then blocks the current thread
                                        +    to prevent the termination of this process.
                                        +    If you don't want to block the current thread, use `#connect()` method instead.
                                        +    """
                                        +    self.connect()
                                        +    if self.app.logger.level > logging.INFO:
                                        +        print(get_boot_message())
                                        +    else:
                                        +        self.app.logger.info(get_boot_message())
                                        +
                                        +    if sys.platform == "win32":
                                        +        # Ctrl+C etc does not work on Windows OS
                                        +        # see https://bugs.python.org/issue35935 for details
                                        +        signal.signal(signal.SIGINT, signal.SIG_DFL)
                                        +
                                        +    Event().wait()
                                        +

                                        Establishes a new connection and then blocks the current thread to prevent the termination of this process. If you don't want to block the current thread, use #connect() method instead.

                                        @@ -182,7 +252,7 @@

                                        -

                                        Generated by pdoc 0.11.3.

                                        +

                                        Generated by pdoc 0.11.5.

                                        diff --git a/docs/static/api-docs/slack_bolt/adapter/socket_mode/builtin/index.html b/docs/static/api-docs/slack_bolt/adapter/socket_mode/builtin/index.html index 5a6a6dda..ab1837ae 100644 --- a/docs/static/api-docs/slack_bolt/adapter/socket_mode/builtin/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/socket_mode/builtin/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.socket_mode.builtin API documentation - + @@ -41,36 +52,6 @@

                                        Classes

                                        (app: App,
                                        app_token: str | None = None,
                                        logger: logging.Logger | None = None,
                                        web_client: slack_sdk.web.client.WebClient | None = None,
                                        proxy: str | None = None,
                                        proxy_headers: Dict[str, str] | None = None,
                                        auto_reconnect_enabled: bool = True,
                                        trace_enabled: bool = False,
                                        all_message_trace_enabled: bool = False,
                                        ping_pong_trace_enabled: bool = False,
                                        ping_interval: float = 10,
                                        receive_buffer_size: int = 1024,
                                        concurrency: int = 10)
                                        -

                                        Socket Mode adapter for Bolt apps

                                        -

                                        Args

                                        -
                                        -
                                        app
                                        -
                                        The Bolt app
                                        -
                                        app_token
                                        -
                                        App-level token starting with xapp-
                                        -
                                        logger
                                        -
                                        Custom logger
                                        -
                                        web_client
                                        -
                                        custom slack_sdk.web.WebClient instance
                                        -
                                        proxy
                                        -
                                        HTTP proxy URL
                                        -
                                        proxy_headers
                                        -
                                        Additional request header for proxy connections
                                        -
                                        auto_reconnect_enabled
                                        -
                                        True if the auto-reconnect logic works
                                        -
                                        trace_enabled
                                        -
                                        True if trace-level logging is enabled
                                        -
                                        all_message_trace_enabled
                                        -
                                        True if trace-logging for all received WebSocket messages is enabled
                                        -
                                        ping_pong_trace_enabled
                                        -
                                        True if trace-logging for all ping-pong communications
                                        -
                                        ping_interval
                                        -
                                        The ping-pong internal (seconds)
                                        -
                                        receive_buffer_size
                                        -
                                        The data length for a single socket recv operation
                                        -
                                        concurrency
                                        -
                                        The size of the underlying thread pool
                                        -
                                        Expand source code @@ -136,29 +117,53 @@

                                        Args

                                        bolt_resp: BoltResponse = run_bolt_app(self.app, req) send_response(client, req, bolt_resp, start)
                                        +

                                        Socket Mode adapter for Bolt apps

                                        +

                                        Args

                                        +
                                        +
                                        app
                                        +
                                        The Bolt app
                                        +
                                        app_token
                                        +
                                        App-level token starting with xapp-
                                        +
                                        logger
                                        +
                                        Custom logger
                                        +
                                        web_client
                                        +
                                        custom slack_sdk.web.WebClient instance
                                        +
                                        proxy
                                        +
                                        HTTP proxy URL
                                        +
                                        proxy_headers
                                        +
                                        Additional request header for proxy connections
                                        +
                                        auto_reconnect_enabled
                                        +
                                        True if the auto-reconnect logic works
                                        +
                                        trace_enabled
                                        +
                                        True if trace-level logging is enabled
                                        +
                                        all_message_trace_enabled
                                        +
                                        True if trace-logging for all received WebSocket messages is enabled
                                        +
                                        ping_pong_trace_enabled
                                        +
                                        True if trace-logging for all ping-pong communications
                                        +
                                        ping_interval
                                        +
                                        The ping-pong internal (seconds)
                                        +
                                        receive_buffer_size
                                        +
                                        The data length for a single socket recv operation
                                        +
                                        concurrency
                                        +
                                        The size of the underlying thread pool
                                        +

                                        Ancestors

                                        Class variables

                                        -
                                        var appApp
                                        -
                                        -
                                        -
                                        var app_token : str
                                        -
                                        -
                                        -
                                        var client : slack_sdk.socket_mode.builtin.client.SocketModeClient
                                        -
                                        -
                                        +

                                        The type of the None singleton.

                                        Inherited members

                                        • BaseSocketModeHandler: @@ -197,7 +200,7 @@

                                          diff --git a/docs/static/api-docs/slack_bolt/adapter/socket_mode/index.html b/docs/static/api-docs/slack_bolt/adapter/socket_mode/index.html index 7fd56eb3..cb26a212 100644 --- a/docs/static/api-docs/slack_bolt/adapter/socket_mode/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/socket_mode/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.socket_mode API documentation - + @@ -88,36 +99,6 @@

                                          Classes

                                          (app: App,
                                          app_token: str | None = None,
                                          logger: logging.Logger | None = None,
                                          web_client: slack_sdk.web.client.WebClient | None = None,
                                          proxy: str | None = None,
                                          proxy_headers: Dict[str, str] | None = None,
                                          auto_reconnect_enabled: bool = True,
                                          trace_enabled: bool = False,
                                          all_message_trace_enabled: bool = False,
                                          ping_pong_trace_enabled: bool = False,
                                          ping_interval: float = 10,
                                          receive_buffer_size: int = 1024,
                                          concurrency: int = 10)
                                          -

                                          Socket Mode adapter for Bolt apps

                                          -

                                          Args

                                          -
                                          -
                                          app
                                          -
                                          The Bolt app
                                          -
                                          app_token
                                          -
                                          App-level token starting with xapp-
                                          -
                                          logger
                                          -
                                          Custom logger
                                          -
                                          web_client
                                          -
                                          custom slack_sdk.web.WebClient instance
                                          -
                                          proxy
                                          -
                                          HTTP proxy URL
                                          -
                                          proxy_headers
                                          -
                                          Additional request header for proxy connections
                                          -
                                          auto_reconnect_enabled
                                          -
                                          True if the auto-reconnect logic works
                                          -
                                          trace_enabled
                                          -
                                          True if trace-level logging is enabled
                                          -
                                          all_message_trace_enabled
                                          -
                                          True if trace-logging for all received WebSocket messages is enabled
                                          -
                                          ping_pong_trace_enabled
                                          -
                                          True if trace-logging for all ping-pong communications
                                          -
                                          ping_interval
                                          -
                                          The ping-pong internal (seconds)
                                          -
                                          receive_buffer_size
                                          -
                                          The data length for a single socket recv operation
                                          -
                                          concurrency
                                          -
                                          The size of the underlying thread pool
                                          -
                                          Expand source code @@ -183,29 +164,53 @@

                                          Args

                                          bolt_resp: BoltResponse = run_bolt_app(self.app, req) send_response(client, req, bolt_resp, start)
                                          +

                                          Socket Mode adapter for Bolt apps

                                          +

                                          Args

                                          +
                                          +
                                          app
                                          +
                                          The Bolt app
                                          +
                                          app_token
                                          +
                                          App-level token starting with xapp-
                                          +
                                          logger
                                          +
                                          Custom logger
                                          +
                                          web_client
                                          +
                                          custom slack_sdk.web.WebClient instance
                                          +
                                          proxy
                                          +
                                          HTTP proxy URL
                                          +
                                          proxy_headers
                                          +
                                          Additional request header for proxy connections
                                          +
                                          auto_reconnect_enabled
                                          +
                                          True if the auto-reconnect logic works
                                          +
                                          trace_enabled
                                          +
                                          True if trace-level logging is enabled
                                          +
                                          all_message_trace_enabled
                                          +
                                          True if trace-logging for all received WebSocket messages is enabled
                                          +
                                          ping_pong_trace_enabled
                                          +
                                          True if trace-logging for all ping-pong communications
                                          +
                                          ping_interval
                                          +
                                          The ping-pong internal (seconds)
                                          +
                                          receive_buffer_size
                                          +
                                          The data length for a single socket recv operation
                                          +
                                          concurrency
                                          +
                                          The size of the underlying thread pool
                                          +

                                          Ancestors

                                          Class variables

                                          -
                                          var appApp
                                          -
                                          -
                                          -
                                          var app_token : str
                                          -
                                          -
                                          -
                                          var client : slack_sdk.socket_mode.builtin.client.SocketModeClient
                                          -
                                          -
                                          +

                                          The type of the None singleton.

                                          Inherited members

                                          • BaseSocketModeHandler: @@ -257,7 +260,7 @@

                                            -

                                            Generated by pdoc 0.11.3.

                                            +

                                            Generated by pdoc 0.11.5.

                                            diff --git a/docs/static/api-docs/slack_bolt/adapter/socket_mode/internals.html b/docs/static/api-docs/slack_bolt/adapter/socket_mode/internals.html index 2c40965a..7c1a7a81 100644 --- a/docs/static/api-docs/slack_bolt/adapter/socket_mode/internals.html +++ b/docs/static/api-docs/slack_bolt/adapter/socket_mode/internals.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.socket_mode.internals API documentation - + @@ -38,12 +49,49 @@

                                            Functions

                                            def run_bolt_app(app: App,
                                            req: slack_sdk.socket_mode.request.SocketModeRequest)
                                            +
                                            + +Expand source code + +
                                            def run_bolt_app(app: App, req: SocketModeRequest):
                                            +    bolt_req: BoltRequest = BoltRequest(mode="socket_mode", body=req.payload)
                                            +    bolt_resp: BoltResponse = app.dispatch(bolt_req)
                                            +    return bolt_resp
                                            +
                                            def send_response(client: slack_sdk.socket_mode.client.BaseSocketModeClient,
                                            req: slack_sdk.socket_mode.request.SocketModeRequest,
                                            bolt_resp: BoltResponse,
                                            start_time: float)
                                            +
                                            + +Expand source code + +
                                            def send_response(
                                            +    client: BaseSocketModeClient,
                                            +    req: SocketModeRequest,
                                            +    bolt_resp: BoltResponse,
                                            +    start_time: float,
                                            +):
                                            +    if bolt_resp.status == 200:
                                            +        content_type = bolt_resp.headers.get("content-type", [""])[0]
                                            +        if bolt_resp.body is None or len(bolt_resp.body) == 0:
                                            +            client.send_socket_mode_response(SocketModeResponse(envelope_id=req.envelope_id))
                                            +        elif content_type.startswith("application/json"):
                                            +            dict_body = json.loads(bolt_resp.body)
                                            +            client.send_socket_mode_response(SocketModeResponse(envelope_id=req.envelope_id, payload=dict_body))
                                            +        else:
                                            +            client.send_socket_mode_response(
                                            +                SocketModeResponse(envelope_id=req.envelope_id, payload={"text": bolt_resp.body})
                                            +            )
                                            +
                                            +        if client.logger.level <= logging.DEBUG:
                                            +            spent_time = int((time() - start_time) * 1000)
                                            +            client.logger.debug(f"Response time: {spent_time} milliseconds")
                                            +    else:
                                            +        client.logger.info(f"Unsuccessful Bolt execution result (status: {bolt_resp.status}, body: {bolt_resp.body})")
                                            +

                                        @@ -71,7 +119,7 @@

                                        Functions

                                        diff --git a/docs/static/api-docs/slack_bolt/adapter/socket_mode/websocket_client/index.html b/docs/static/api-docs/slack_bolt/adapter/socket_mode/websocket_client/index.html index ff14fe4a..d6a4b50b 100644 --- a/docs/static/api-docs/slack_bolt/adapter/socket_mode/websocket_client/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/socket_mode/websocket_client/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.socket_mode.websocket_client API documentation - + @@ -41,32 +52,6 @@

                                        Classes

                                        (app: App,
                                        app_token: str | None = None,
                                        logger: logging.Logger | None = None,
                                        web_client: slack_sdk.web.client.WebClient | None = None,
                                        ping_interval: float = 10,
                                        concurrency: int = 10,
                                        http_proxy_host: str | None = None,
                                        http_proxy_port: int | None = None,
                                        http_proxy_auth: Tuple[str, str] | None = None,
                                        proxy_type: str | None = None,
                                        trace_enabled: bool = False)
                                        -

                                        Socket Mode adapter for Bolt apps

                                        -

                                        Args

                                        -
                                        -
                                        app
                                        -
                                        The Bolt app
                                        -
                                        app_token
                                        -
                                        App-level token starting with xapp-
                                        -
                                        logger
                                        -
                                        Custom logger
                                        -
                                        web_client
                                        -
                                        custom slack_sdk.web.WebClient instance
                                        -
                                        ping_interval
                                        -
                                        The ping-pong internal (seconds)
                                        -
                                        concurrency
                                        -
                                        The size of the underlying thread pool
                                        -
                                        http_proxy_host
                                        -
                                        HTTP proxy host
                                        -
                                        http_proxy_port
                                        -
                                        HTTP proxy port
                                        -
                                        http_proxy_auth
                                        -
                                        HTTP proxy authentication (username, password)
                                        -
                                        proxy_type
                                        -
                                        Proxy type
                                        -
                                        trace_enabled
                                        -
                                        True if trace-level logging is enabled
                                        -
                                        Expand source code @@ -126,29 +111,49 @@

                                        Args

                                        bolt_resp: BoltResponse = run_bolt_app(self.app, req) send_response(client, req, bolt_resp, start)
                                        +

                                        Socket Mode adapter for Bolt apps

                                        +

                                        Args

                                        +
                                        +
                                        app
                                        +
                                        The Bolt app
                                        +
                                        app_token
                                        +
                                        App-level token starting with xapp-
                                        +
                                        logger
                                        +
                                        Custom logger
                                        +
                                        web_client
                                        +
                                        custom slack_sdk.web.WebClient instance
                                        +
                                        ping_interval
                                        +
                                        The ping-pong internal (seconds)
                                        +
                                        concurrency
                                        +
                                        The size of the underlying thread pool
                                        +
                                        http_proxy_host
                                        +
                                        HTTP proxy host
                                        +
                                        http_proxy_port
                                        +
                                        HTTP proxy port
                                        +
                                        http_proxy_auth
                                        +
                                        HTTP proxy authentication (username, password)
                                        +
                                        proxy_type
                                        +
                                        Proxy type
                                        +
                                        trace_enabled
                                        +
                                        True if trace-level logging is enabled
                                        +

                                        Ancestors

                                        Class variables

                                        -
                                        var appApp
                                        -
                                        -
                                        -
                                        var app_token : str
                                        -
                                        -
                                        -
                                        var client : slack_sdk.socket_mode.websocket_client.SocketModeClient
                                        -
                                        -
                                        +

                                        The type of the None singleton.

                                        Inherited members

                                        • BaseSocketModeHandler: @@ -187,7 +190,7 @@

                                          -

                                          Generated by pdoc 0.11.3.

                                          +

                                          Generated by pdoc 0.11.5.

                                          diff --git a/docs/static/api-docs/slack_bolt/adapter/socket_mode/websockets/index.html b/docs/static/api-docs/slack_bolt/adapter/socket_mode/websockets/index.html index c00f83fd..2b7e9f49 100644 --- a/docs/static/api-docs/slack_bolt/adapter/socket_mode/websockets/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/socket_mode/websockets/index.html @@ -3,20 +3,31 @@ - + slack_bolt.adapter.socket_mode.websockets API documentation - + @@ -43,7 +54,6 @@

                                          Classes

                                          (app: AsyncApp,
                                          app_token: str | None = None,
                                          logger: logging.Logger | None = None,
                                          web_client: slack_sdk.web.async_client.AsyncWebClient | None = None,
                                          ping_interval: float = 10)
                                          -
                                          Expand source code @@ -76,29 +86,24 @@

                                          Classes

                                          bolt_resp: BoltResponse = await run_async_bolt_app(self.app, req) await send_async_response(client, req, bolt_resp, start)
                                          +

                                          Ancestors

                                          Class variables

                                          -
                                          var appAsyncApp
                                          -
                                          -
                                          -
                                          var app_token : str
                                          -
                                          -
                                          -
                                          var client : slack_sdk.socket_mode.websockets.SocketModeClient
                                          -
                                          -
                                          +

                                          The type of the None singleton.

                                          Inherited members

                                          • AsyncBaseSocketModeHandler:
                                              +
                                            • app
                                            • +
                                            • client
                                            • close_async
                                            • connect_async
                                            • disconnect_async
                                            • @@ -113,23 +118,6 @@

                                              Inherited members

                                              (app: App,
                                              app_token: str | None = None,
                                              logger: logging.Logger | None = None,
                                              web_client: slack_sdk.web.async_client.AsyncWebClient | None = None,
                                              ping_interval: float = 10)
                                              -

                                              Socket Mode adapter for Bolt apps.

                                              -

                                              Please note that this adapter does not support proxy configuration -as the underlying websockets module does not support proxy-wired connections. -If you use proxy, consider using one of the other Socket Mode adapters.

                                              -

                                              Args

                                              -
                                              -
                                              app
                                              -
                                              The Bolt app
                                              -
                                              app_token
                                              -
                                              App-level token starting with xapp-
                                              -
                                              logger
                                              -
                                              Custom logger
                                              -
                                              web_client
                                              -
                                              custom slack_sdk.web.WebClient instance
                                              -
                                              ping_interval
                                              -
                                              The ping-pong internal (seconds)
                                              -
                                              Expand source code @@ -175,29 +163,40 @@

                                              Args

                                              bolt_resp: BoltResponse = run_bolt_app(self.app, req) await send_async_response(client, req, bolt_resp, start)
                                              +

                                              Socket Mode adapter for Bolt apps.

                                              +

                                              Please note that this adapter does not support proxy configuration +as the underlying websockets module does not support proxy-wired connections. +If you use proxy, consider using one of the other Socket Mode adapters.

                                              +

                                              Args

                                              +
                                              +
                                              app
                                              +
                                              The Bolt app
                                              +
                                              app_token
                                              +
                                              App-level token starting with xapp-
                                              +
                                              logger
                                              +
                                              Custom logger
                                              +
                                              web_client
                                              +
                                              custom slack_sdk.web.WebClient instance
                                              +
                                              ping_interval
                                              +
                                              The ping-pong internal (seconds)
                                              +

                                              Ancestors

                                              Class variables

                                              -
                                              var appApp
                                              -
                                              -
                                              -
                                              var app_token : str
                                              -
                                              -
                                              -
                                              var client : slack_sdk.socket_mode.websockets.SocketModeClient
                                              -
                                              -
                                              +

                                              The type of the None singleton.

                                              Inherited members

                                              • AsyncBaseSocketModeHandler: @@ -244,7 +239,7 @@

                                                diff --git a/docs/static/api-docs/slack_bolt/adapter/starlette/async_handler.html b/docs/static/api-docs/slack_bolt/adapter/starlette/async_handler.html index 07e19c9b..e8e596f2 100644 --- a/docs/static/api-docs/slack_bolt/adapter/starlette/async_handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/starlette/async_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.starlette.async_handler API documentation - + @@ -37,12 +48,55 @@

                                                Functions

                                                def to_async_bolt_request(req: starlette.requests.Request,
                                                body: bytes,
                                                addition_context_properties: Dict[str, Any] | None = None) ‑> AsyncBoltRequest
                                                +
                                                + +Expand source code + +
                                                def to_async_bolt_request(
                                                +    req: Request,
                                                +    body: bytes,
                                                +    addition_context_properties: Optional[Dict[str, Any]] = None,
                                                +) -> AsyncBoltRequest:
                                                +    request = AsyncBoltRequest(
                                                +        body=body.decode("utf-8"),
                                                +        query=req.query_params,  # type: ignore[arg-type]
                                                +        headers=req.headers,  # type: ignore[arg-type]
                                                +    )
                                                +    if addition_context_properties is not None:
                                                +        for k, v in addition_context_properties.items():
                                                +            request.context[k] = v
                                                +    return request
                                                +
                                                def to_starlette_response(bolt_resp: BoltResponse) ‑> starlette.responses.Response
                                                +
                                                + +Expand source code + +
                                                def to_starlette_response(bolt_resp: BoltResponse) -> Response:
                                                +    resp = Response(
                                                +        status_code=bolt_resp.status,
                                                +        content=bolt_resp.body,
                                                +        headers=bolt_resp.first_headers_without_set_cookie(),
                                                +    )
                                                +    for cookie in bolt_resp.cookies():
                                                +        for name, c in cookie.items():
                                                +            resp.set_cookie(
                                                +                key=name,
                                                +                value=c.value,
                                                +                max_age=c.get("max-age"),
                                                +                expires=c.get("expires"),
                                                +                path=c.get("path"),
                                                +                domain=c.get("domain"),
                                                +                secure=True,
                                                +                httponly=True,
                                                +            )
                                                +    return resp
                                                +
                                                @@ -55,7 +109,6 @@

                                                Classes

                                                (app: AsyncApp)
                                                -
                                                Expand source code @@ -88,12 +141,41 @@

                                                Classes

                                                content="Not found", )
                                                +

                                                Methods

                                                async def handle(self,
                                                req: starlette.requests.Request,
                                                addition_context_properties: Dict[str, Any] | None = None) ‑> starlette.responses.Response
                                                +
                                                + +Expand source code + +
                                                async def handle(self, req: Request, addition_context_properties: Optional[Dict[str, Any]] = None) -> Response:
                                                +    body = await req.body()
                                                +    if req.method == "GET":
                                                +        if self.app.oauth_flow is not None:
                                                +            oauth_flow: AsyncOAuthFlow = self.app.oauth_flow
                                                +            if req.url.path == oauth_flow.install_path:
                                                +                bolt_resp = await oauth_flow.handle_installation(
                                                +                    to_async_bolt_request(req, body, addition_context_properties)
                                                +                )
                                                +                return to_starlette_response(bolt_resp)
                                                +            elif req.url.path == oauth_flow.redirect_uri_path:
                                                +                bolt_resp = await oauth_flow.handle_callback(
                                                +                    to_async_bolt_request(req, body, addition_context_properties)
                                                +                )
                                                +                return to_starlette_response(bolt_resp)
                                                +    elif req.method == "POST":
                                                +        bolt_resp = await self.app.async_dispatch(to_async_bolt_request(req, body, addition_context_properties))
                                                +        return to_starlette_response(bolt_resp)
                                                +
                                                +    return Response(
                                                +        status_code=404,
                                                +        content="Not found",
                                                +    )
                                                +
                                                @@ -131,7 +213,7 @@

                                                -

                                                Generated by pdoc 0.11.3.

                                                +

                                                Generated by pdoc 0.11.5.

                                                diff --git a/docs/static/api-docs/slack_bolt/adapter/starlette/handler.html b/docs/static/api-docs/slack_bolt/adapter/starlette/handler.html index a4982758..5171240f 100644 --- a/docs/static/api-docs/slack_bolt/adapter/starlette/handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/starlette/handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.starlette.handler API documentation - + @@ -37,12 +48,55 @@

                                                Functions

                                                def to_bolt_request(req: starlette.requests.Request,
                                                body: bytes,
                                                addition_context_properties: Dict[str, Any] | None = None) ‑> BoltRequest
                                                +
                                                + +Expand source code + +
                                                def to_bolt_request(
                                                +    req: Request,
                                                +    body: bytes,
                                                +    addition_context_properties: Optional[Dict[str, Any]] = None,
                                                +) -> BoltRequest:
                                                +    request = BoltRequest(
                                                +        body=body.decode("utf-8"),
                                                +        query=req.query_params,  # type: ignore[arg-type]
                                                +        headers=req.headers,  # type: ignore[arg-type]
                                                +    )
                                                +    if addition_context_properties is not None:
                                                +        for k, v in addition_context_properties.items():
                                                +            request.context[k] = v
                                                +    return request
                                                +
                                                def to_starlette_response(bolt_resp: BoltResponse) ‑> starlette.responses.Response
                                                +
                                                + +Expand source code + +
                                                def to_starlette_response(bolt_resp: BoltResponse) -> Response:
                                                +    resp = Response(
                                                +        status_code=bolt_resp.status,
                                                +        content=bolt_resp.body,
                                                +        headers=bolt_resp.first_headers_without_set_cookie(),
                                                +    )
                                                +    for cookie in bolt_resp.cookies():
                                                +        for name, c in cookie.items():
                                                +            resp.set_cookie(
                                                +                key=name,
                                                +                value=c.value,
                                                +                max_age=c.get("max-age"),
                                                +                expires=c.get("expires"),
                                                +                path=c.get("path"),
                                                +                domain=c.get("domain"),
                                                +                secure=True,
                                                +                httponly=True,
                                                +            )
                                                +    return resp
                                                +
                                                @@ -55,7 +109,6 @@

                                                Classes

                                                (app: App)
                                                -
                                                Expand source code @@ -84,12 +137,37 @@

                                                Classes

                                                content="Not found", )
                                                +

                                                Methods

                                                async def handle(self,
                                                req: starlette.requests.Request,
                                                addition_context_properties: Dict[str, Any] | None = None) ‑> starlette.responses.Response
                                                +
                                                + +Expand source code + +
                                                async def handle(self, req: Request, addition_context_properties: Optional[Dict[str, Any]] = None) -> Response:
                                                +    body = await req.body()
                                                +    if req.method == "GET":
                                                +        if self.app.oauth_flow is not None:
                                                +            oauth_flow: OAuthFlow = self.app.oauth_flow
                                                +            if req.url.path == oauth_flow.install_path:
                                                +                bolt_resp = oauth_flow.handle_installation(to_bolt_request(req, body, addition_context_properties))
                                                +                return to_starlette_response(bolt_resp)
                                                +            elif req.url.path == oauth_flow.redirect_uri_path:
                                                +                bolt_resp = oauth_flow.handle_callback(to_bolt_request(req, body, addition_context_properties))
                                                +                return to_starlette_response(bolt_resp)
                                                +    elif req.method == "POST":
                                                +        bolt_resp = self.app.dispatch(to_bolt_request(req, body, addition_context_properties))
                                                +        return to_starlette_response(bolt_resp)
                                                +
                                                +    return Response(
                                                +        status_code=404,
                                                +        content="Not found",
                                                +    )
                                                +
                                                @@ -127,7 +205,7 @@

                                                diff --git a/docs/static/api-docs/slack_bolt/adapter/starlette/index.html b/docs/static/api-docs/slack_bolt/adapter/starlette/index.html index fddd172f..3af38253 100644 --- a/docs/static/api-docs/slack_bolt/adapter/starlette/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/starlette/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.starlette API documentation - + @@ -51,7 +62,6 @@

                                                Classes

                                                (app: App)
                                                -
                                                Expand source code @@ -80,12 +90,37 @@

                                                Classes

                                                content="Not found", )
                                                +

                                                Methods

                                                async def handle(self,
                                                req: starlette.requests.Request,
                                                addition_context_properties: Dict[str, Any] | None = None) ‑> starlette.responses.Response
                                                +
                                                + +Expand source code + +
                                                async def handle(self, req: Request, addition_context_properties: Optional[Dict[str, Any]] = None) -> Response:
                                                +    body = await req.body()
                                                +    if req.method == "GET":
                                                +        if self.app.oauth_flow is not None:
                                                +            oauth_flow: OAuthFlow = self.app.oauth_flow
                                                +            if req.url.path == oauth_flow.install_path:
                                                +                bolt_resp = oauth_flow.handle_installation(to_bolt_request(req, body, addition_context_properties))
                                                +                return to_starlette_response(bolt_resp)
                                                +            elif req.url.path == oauth_flow.redirect_uri_path:
                                                +                bolt_resp = oauth_flow.handle_callback(to_bolt_request(req, body, addition_context_properties))
                                                +                return to_starlette_response(bolt_resp)
                                                +    elif req.method == "POST":
                                                +        bolt_resp = self.app.dispatch(to_bolt_request(req, body, addition_context_properties))
                                                +        return to_starlette_response(bolt_resp)
                                                +
                                                +    return Response(
                                                +        status_code=404,
                                                +        content="Not found",
                                                +    )
                                                +
                                                @@ -123,7 +158,7 @@

                                                -

                                                Generated by pdoc 0.11.3.

                                                +

                                                Generated by pdoc 0.11.5.

                                                diff --git a/docs/static/api-docs/slack_bolt/adapter/tornado/async_handler.html b/docs/static/api-docs/slack_bolt/adapter/tornado/async_handler.html index 14de45e7..b7d81342 100644 --- a/docs/static/api-docs/slack_bolt/adapter/tornado/async_handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/tornado/async_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.tornado.async_handler API documentation - + @@ -37,6 +48,17 @@

                                                Functions

                                                def to_async_bolt_request(req: tornado.httputil.HTTPServerRequest) ‑> AsyncBoltRequest
                                                +
                                                + +Expand source code + +
                                                def to_async_bolt_request(req: HTTPServerRequest) -> AsyncBoltRequest:
                                                +    return AsyncBoltRequest(
                                                +        body=req.body.decode("utf-8") if req.body else "",
                                                +        query=req.query,
                                                +        headers=req.headers,  # type: ignore[arg-type]
                                                +    )
                                                +
                                                @@ -49,12 +71,6 @@

                                                Classes

                                                (application: Application,
                                                request: tornado.httputil.HTTPServerRequest,
                                                **kwargs: Any)
                                                -

                                                Base class for HTTP request handlers.

                                                -

                                                Subclasses must define at least one of the methods defined in the -"Entry points" section below.

                                                -

                                                Applications should not construct RequestHandler objects -directly and subclasses should not override __init__ (override -~RequestHandler.initialize instead).

                                                Expand source code @@ -68,6 +84,12 @@

                                                Classes

                                                set_response(self, bolt_resp) return
                                                +

                                                Base class for HTTP request handlers.

                                                +

                                                Subclasses must define at least one of the methods defined in the +"Entry points" section below.

                                                +

                                                Applications should not construct RequestHandler objects +directly and subclasses should not override __init__ (override +~RequestHandler.initialize instead).

                                                Ancestors

                                                • tornado.web.RequestHandler
                                                • @@ -78,12 +100,28 @@

                                                  Methods

                                                  def initialize(self,
                                                  app: AsyncApp)
                                                  +
                                                  + +Expand source code + +
                                                  def initialize(self, app: AsyncApp):
                                                  +    self.app = app
                                                  +
                                                  async def post(self)
                                                  +
                                                  + +Expand source code + +
                                                  async def post(self):
                                                  +    bolt_resp: BoltResponse = await self.app.async_dispatch(to_async_bolt_request(self.request))
                                                  +    set_response(self, bolt_resp)
                                                  +    return
                                                  +
                                                  @@ -93,12 +131,6 @@

                                                  Methods

                                                  (application: Application,
                                                  request: tornado.httputil.HTTPServerRequest,
                                                  **kwargs: Any)
                                                  -

                                                  Base class for HTTP request handlers.

                                                  -

                                                  Subclasses must define at least one of the methods defined in the -"Entry points" section below.

                                                  -

                                                  Applications should not construct RequestHandler objects -directly and subclasses should not override __init__ (override -~RequestHandler.initialize instead).

                                                  Expand source code @@ -120,6 +152,12 @@

                                                  Methods

                                                  return self.set_status(404)
                                                  +

                                                  Base class for HTTP request handlers.

                                                  +

                                                  Subclasses must define at least one of the methods defined in the +"Entry points" section below.

                                                  +

                                                  Applications should not construct RequestHandler objects +directly and subclasses should not override __init__ (override +~RequestHandler.initialize instead).

                                                  Ancestors

                                                  • tornado.web.RequestHandler
                                                  • @@ -130,12 +168,36 @@

                                                    Methods

                                                    async def get(self)
                                                    +
                                                    + +Expand source code + +
                                                    async def get(self):
                                                    +    if self.app.oauth_flow is not None:
                                                    +        oauth_flow: AsyncOAuthFlow = self.app.oauth_flow
                                                    +        if self.request.path == oauth_flow.install_path:
                                                    +            bolt_resp = await oauth_flow.handle_installation(to_async_bolt_request(self.request))
                                                    +            set_response(self, bolt_resp)
                                                    +            return
                                                    +        elif self.request.path == oauth_flow.redirect_uri_path:
                                                    +            bolt_resp = await oauth_flow.handle_callback(to_async_bolt_request(self.request))
                                                    +            set_response(self, bolt_resp)
                                                    +            return
                                                    +    self.set_status(404)
                                                    +
                                                    def initialize(self,
                                                    app: AsyncApp)
                                                    +
                                                    + +Expand source code + +
                                                    def initialize(self, app: AsyncApp):
                                                    +    self.app = app
                                                    +
                                                    @@ -180,7 +242,7 @@

                                                    -

                                                    Generated by pdoc 0.11.3.

                                                    +

                                                    Generated by pdoc 0.11.5.

                                                    diff --git a/docs/static/api-docs/slack_bolt/adapter/tornado/handler.html b/docs/static/api-docs/slack_bolt/adapter/tornado/handler.html index 3d0fb7ec..1149311a 100644 --- a/docs/static/api-docs/slack_bolt/adapter/tornado/handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/tornado/handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.tornado.handler API documentation - + @@ -37,12 +48,47 @@

                                                    Functions

                                                    def set_response(self, bolt_resp) ‑> None
                                                    +
                                                    + +Expand source code + +
                                                    def set_response(self, bolt_resp) -> None:
                                                    +    self.set_status(bolt_resp.status)
                                                    +    self.write(bolt_resp.body)
                                                    +    for name, value in bolt_resp.first_headers_without_set_cookie().items():
                                                    +        self.set_header(name, value)
                                                    +    for cookie in bolt_resp.cookies():
                                                    +        for name, c in cookie.items():
                                                    +            expire_value = c.get("expires")
                                                    +            expire = datetime.strptime(expire_value, "%a, %d %b %Y %H:%M:%S %Z") if expire_value else None
                                                    +            self.set_cookie(
                                                    +                name=name,
                                                    +                value=c.value,
                                                    +                max_age=c.get("max-age"),
                                                    +                expires=expire,
                                                    +                path=c.get("path"),
                                                    +                domain=c.get("domain"),
                                                    +                secure=True,
                                                    +                httponly=True,
                                                    +            )
                                                    +
                                                    def to_bolt_request(req: tornado.httputil.HTTPServerRequest) ‑> BoltRequest
                                                    +
                                                    + +Expand source code + +
                                                    def to_bolt_request(req: HTTPServerRequest) -> BoltRequest:
                                                    +    return BoltRequest(
                                                    +        body=req.body.decode("utf-8") if req.body else "",
                                                    +        query=req.query,
                                                    +        headers=req.headers,  # type: ignore[arg-type]
                                                    +    )
                                                    +
                                                    @@ -55,12 +101,6 @@

                                                    Classes

                                                    (application: Application,
                                                    request: tornado.httputil.HTTPServerRequest,
                                                    **kwargs: Any)
                                                    -

                                                    Base class for HTTP request handlers.

                                                    -

                                                    Subclasses must define at least one of the methods defined in the -"Entry points" section below.

                                                    -

                                                    Applications should not construct RequestHandler objects -directly and subclasses should not override __init__ (override -~RequestHandler.initialize instead).

                                                    Expand source code @@ -74,6 +114,12 @@

                                                    Classes

                                                    set_response(self, bolt_resp) return
                                                    +

                                                    Base class for HTTP request handlers.

                                                    +

                                                    Subclasses must define at least one of the methods defined in the +"Entry points" section below.

                                                    +

                                                    Applications should not construct RequestHandler objects +directly and subclasses should not override __init__ (override +~RequestHandler.initialize instead).

                                                    Ancestors

                                                    • tornado.web.RequestHandler
                                                    • @@ -84,12 +130,28 @@

                                                      Methods

                                                      def initialize(self,
                                                      app: App)
                                                      +
                                                      + +Expand source code + +
                                                      def initialize(self, app: App):
                                                      +    self.app = app
                                                      +
                                                      def post(self)
                                                      +
                                                      + +Expand source code + +
                                                      def post(self):
                                                      +    bolt_resp: BoltResponse = self.app.dispatch(to_bolt_request(self.request))
                                                      +    set_response(self, bolt_resp)
                                                      +    return
                                                      +
                                                      @@ -99,12 +161,6 @@

                                                      Methods

                                                      (application: Application,
                                                      request: tornado.httputil.HTTPServerRequest,
                                                      **kwargs: Any)
                                                      -

                                                      Base class for HTTP request handlers.

                                                      -

                                                      Subclasses must define at least one of the methods defined in the -"Entry points" section below.

                                                      -

                                                      Applications should not construct RequestHandler objects -directly and subclasses should not override __init__ (override -~RequestHandler.initialize instead).

                                                      Expand source code @@ -126,6 +182,12 @@

                                                      Methods

                                                      return self.set_status(404)
                                                      +

                                                      Base class for HTTP request handlers.

                                                      +

                                                      Subclasses must define at least one of the methods defined in the +"Entry points" section below.

                                                      +

                                                      Applications should not construct RequestHandler objects +directly and subclasses should not override __init__ (override +~RequestHandler.initialize instead).

                                                      Ancestors

                                                      • tornado.web.RequestHandler
                                                      • @@ -136,12 +198,36 @@

                                                        Methods

                                                        def get(self)
                                                        +
                                                        + +Expand source code + +
                                                        def get(self):
                                                        +    if self.app.oauth_flow is not None:
                                                        +        oauth_flow: OAuthFlow = self.app.oauth_flow
                                                        +        if self.request.path == oauth_flow.install_path:
                                                        +            bolt_resp = oauth_flow.handle_installation(to_bolt_request(self.request))
                                                        +            set_response(self, bolt_resp)
                                                        +            return
                                                        +        elif self.request.path == oauth_flow.redirect_uri_path:
                                                        +            bolt_resp = oauth_flow.handle_callback(to_bolt_request(self.request))
                                                        +            set_response(self, bolt_resp)
                                                        +            return
                                                        +    self.set_status(404)
                                                        +
                                                        def initialize(self,
                                                        app: App)
                                                        +
                                                        + +Expand source code + +
                                                        def initialize(self, app: App):
                                                        +    self.app = app
                                                        +
                                                        @@ -187,7 +273,7 @@

                                                        -

                                                        Generated by pdoc 0.11.3.

                                                        +

                                                        Generated by pdoc 0.11.5.

                                                        diff --git a/docs/static/api-docs/slack_bolt/adapter/tornado/index.html b/docs/static/api-docs/slack_bolt/adapter/tornado/index.html index f73b7a5d..dac1b6b7 100644 --- a/docs/static/api-docs/slack_bolt/adapter/tornado/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/tornado/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.tornado API documentation - + @@ -51,12 +62,6 @@

                                                        Classes

                                                        (application: Application,
                                                        request: tornado.httputil.HTTPServerRequest,
                                                        **kwargs: Any)
                                                        -

                                                        Base class for HTTP request handlers.

                                                        -

                                                        Subclasses must define at least one of the methods defined in the -"Entry points" section below.

                                                        -

                                                        Applications should not construct RequestHandler objects -directly and subclasses should not override __init__ (override -~RequestHandler.initialize instead).

                                                        Expand source code @@ -70,6 +75,12 @@

                                                        Classes

                                                        set_response(self, bolt_resp) return
                                                        +

                                                        Base class for HTTP request handlers.

                                                        +

                                                        Subclasses must define at least one of the methods defined in the +"Entry points" section below.

                                                        +

                                                        Applications should not construct RequestHandler objects +directly and subclasses should not override __init__ (override +~RequestHandler.initialize instead).

                                                        Ancestors

                                                        • tornado.web.RequestHandler
                                                        • @@ -80,12 +91,28 @@

                                                          Methods

                                                          def initialize(self,
                                                          app: App)
                                                          +
                                                          + +Expand source code + +
                                                          def initialize(self, app: App):
                                                          +    self.app = app
                                                          +
                                                          def post(self)
                                                          +
                                                          + +Expand source code + +
                                                          def post(self):
                                                          +    bolt_resp: BoltResponse = self.app.dispatch(to_bolt_request(self.request))
                                                          +    set_response(self, bolt_resp)
                                                          +    return
                                                          +
                                                          @@ -95,12 +122,6 @@

                                                          Methods

                                                          (application: Application,
                                                          request: tornado.httputil.HTTPServerRequest,
                                                          **kwargs: Any)
                                                          -

                                                          Base class for HTTP request handlers.

                                                          -

                                                          Subclasses must define at least one of the methods defined in the -"Entry points" section below.

                                                          -

                                                          Applications should not construct RequestHandler objects -directly and subclasses should not override __init__ (override -~RequestHandler.initialize instead).

                                                          Expand source code @@ -122,6 +143,12 @@

                                                          Methods

                                                          return self.set_status(404)
                                                          +

                                                          Base class for HTTP request handlers.

                                                          +

                                                          Subclasses must define at least one of the methods defined in the +"Entry points" section below.

                                                          +

                                                          Applications should not construct RequestHandler objects +directly and subclasses should not override __init__ (override +~RequestHandler.initialize instead).

                                                          Ancestors

                                                          • tornado.web.RequestHandler
                                                          • @@ -132,12 +159,36 @@

                                                            Methods

                                                            def get(self)
                                                            +
                                                            + +Expand source code + +
                                                            def get(self):
                                                            +    if self.app.oauth_flow is not None:
                                                            +        oauth_flow: OAuthFlow = self.app.oauth_flow
                                                            +        if self.request.path == oauth_flow.install_path:
                                                            +            bolt_resp = oauth_flow.handle_installation(to_bolt_request(self.request))
                                                            +            set_response(self, bolt_resp)
                                                            +            return
                                                            +        elif self.request.path == oauth_flow.redirect_uri_path:
                                                            +            bolt_resp = oauth_flow.handle_callback(to_bolt_request(self.request))
                                                            +            set_response(self, bolt_resp)
                                                            +            return
                                                            +    self.set_status(404)
                                                            +
                                                            def initialize(self,
                                                            app: App)
                                                            +
                                                            + +Expand source code + +
                                                            def initialize(self, app: App):
                                                            +    self.app = app
                                                            +
                                                            @@ -183,7 +234,7 @@

                                                            -

                                                            Generated by pdoc 0.11.3.

                                                            +

                                                            Generated by pdoc 0.11.5.

                                                            diff --git a/docs/static/api-docs/slack_bolt/adapter/wsgi/handler.html b/docs/static/api-docs/slack_bolt/adapter/wsgi/handler.html index f76c4665..8369cb63 100644 --- a/docs/static/api-docs/slack_bolt/adapter/wsgi/handler.html +++ b/docs/static/api-docs/slack_bolt/adapter/wsgi/handler.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.wsgi.handler API documentation - + @@ -40,29 +51,6 @@

                                                            Classes

                                                            (app: App,
                                                            path: str = '/slack/events')
                                                            -

                                                            Setup Bolt as a WSGI web framework, this will make your application compatible with WSGI web servers. -This can be used for production deployments.

                                                            -

                                                            With the default settings, http://localhost:3000/slack/events -Run Bolt with gunicorn

                                                            -

                                                            Python

                                                            -
                                                            app = App()
                                                            -
                                                            -api = SlackRequestHandler(app)
                                                            -
                                                            -

                                                            bash

                                                            -
                                                            export SLACK_SIGNING_SECRET=***
                                                            -
                                                            -export SLACK_BOT_TOKEN=xoxb-***
                                                            -
                                                            -gunicorn app:api -b 0.0.0.0:3000 --log-level debug
                                                            -
                                                            -

                                                            Args

                                                            -
                                                            -
                                                            app
                                                            -
                                                            Your bolt application
                                                            -
                                                            path
                                                            -
                                                            The path to handle request from Slack (Default: /slack/events)
                                                            -
                                                            Expand source code @@ -141,24 +129,74 @@

                                                            Args

                                                            return response.get_body() raise TypeError(f"Unsupported SERVER_PROTOCOL: {request.protocol}")
                                                            +

                                                            Setup Bolt as a WSGI web framework, this will make your application compatible with WSGI web servers. +This can be used for production deployments.

                                                            +

                                                            With the default settings, http://localhost:3000/slack/events +Run Bolt with gunicorn

                                                            +

                                                            Python

                                                            +
                                                            app = App()
                                                            +
                                                            +api = SlackRequestHandler(app)
                                                            +
                                                            +

                                                            bash

                                                            +
                                                            export SLACK_SIGNING_SECRET=***
                                                            +
                                                            +export SLACK_BOT_TOKEN=xoxb-***
                                                            +
                                                            +gunicorn app:api -b 0.0.0.0:3000 --log-level debug
                                                            +
                                                            +

                                                            Args

                                                            +
                                                            +
                                                            app
                                                            +
                                                            Your bolt application
                                                            +
                                                            path
                                                            +
                                                            The path to handle request from Slack (Default: /slack/events)
                                                            +

                                                            Methods

                                                            def dispatch(self,
                                                            request: WsgiHttpRequest) ‑> BoltResponse
                                                            +
                                                            + +Expand source code + +
                                                            def dispatch(self, request: WsgiHttpRequest) -> BoltResponse:
                                                            +    return self.app.dispatch(
                                                            +        BoltRequest(body=request.get_body(), query=request.query_string, headers=request.get_headers())
                                                            +    )
                                                            +
                                                            def handle_callback(self,
                                                            request: WsgiHttpRequest) ‑> BoltResponse
                                                            +
                                                            + +Expand source code + +
                                                            def handle_callback(self, request: WsgiHttpRequest) -> BoltResponse:
                                                            +    return self.app.oauth_flow.handle_callback(  # type: ignore[union-attr]
                                                            +        BoltRequest(body=request.get_body(), query=request.query_string, headers=request.get_headers())
                                                            +    )
                                                            +
                                                            def handle_installation(self,
                                                            request: WsgiHttpRequest) ‑> BoltResponse
                                                            +
                                                            + +Expand source code + +
                                                            def handle_installation(self, request: WsgiHttpRequest) -> BoltResponse:
                                                            +    return self.app.oauth_flow.handle_installation(  # type: ignore[union-attr]
                                                            +        BoltRequest(body=request.get_body(), query=request.query_string, headers=request.get_headers())
                                                            +    )
                                                            +
                                                            @@ -192,7 +230,7 @@

                                                            -

                                                            Generated by pdoc 0.11.3.

                                                            +

                                                            Generated by pdoc 0.11.5.

                                                            diff --git a/docs/static/api-docs/slack_bolt/adapter/wsgi/http_request.html b/docs/static/api-docs/slack_bolt/adapter/wsgi/http_request.html index 37d38904..c4495e44 100644 --- a/docs/static/api-docs/slack_bolt/adapter/wsgi/http_request.html +++ b/docs/static/api-docs/slack_bolt/adapter/wsgi/http_request.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.wsgi.http_request API documentation - + @@ -40,9 +51,6 @@

                                                            Classes

                                                            (environ: Dict[str, Any])
                                                            -

                                                            This Class uses the PEP 3333 standard to extract request information -from the WSGI web server running the application

                                                            -

                                                            PEP 3333: https://peps.python.org/pep-3333/

                                                            Expand source code @@ -80,26 +88,214 @@

                                                            Classes

                                                            content_length = int(self.environ.get("CONTENT_LENGTH", 0)) return self.environ["wsgi.input"].read(content_length).decode(ENCODING)
                                                            +

                                                            This Class uses the PEP 3333 standard to extract request information +from the WSGI web server running the application

                                                            +

                                                            PEP 3333: https://peps.python.org/pep-3333/

                                                            Instance variables

                                                            var environ
                                                            +
                                                            + +Expand source code + +
                                                            class WsgiHttpRequest:
                                                            +    """This Class uses the PEP 3333 standard to extract request information
                                                            +    from the WSGI web server running the application
                                                            +
                                                            +    PEP 3333: https://peps.python.org/pep-3333/
                                                            +    """
                                                            +
                                                            +    __slots__ = ("method", "path", "query_string", "protocol", "environ")
                                                            +
                                                            +    def __init__(self, environ: Dict[str, Any]):
                                                            +        self.method: str = environ.get("REQUEST_METHOD", "GET")
                                                            +        self.path: str = environ.get("PATH_INFO", "")
                                                            +        self.query_string: str = environ.get("QUERY_STRING", "")
                                                            +        self.protocol: str = environ.get("SERVER_PROTOCOL", "")
                                                            +        self.environ = environ
                                                            +
                                                            +    def get_headers(self) -> Dict[str, Union[str, Sequence[str]]]:
                                                            +        headers = {}
                                                            +        for key, value in self.environ.items():
                                                            +            if key in {"CONTENT_LENGTH", "CONTENT_TYPE"}:
                                                            +                name = key.lower().replace("_", "-")
                                                            +                headers[name] = value
                                                            +            if key.startswith("HTTP_"):
                                                            +                name = key[len("HTTP_"):].lower().replace("_", "-")  # fmt: skip
                                                            +                headers[name] = value
                                                            +        return headers
                                                            +
                                                            +    def get_body(self) -> str:
                                                            +        if "wsgi.input" not in self.environ:
                                                            +            return ""
                                                            +        content_length = int(self.environ.get("CONTENT_LENGTH", 0))
                                                            +        return self.environ["wsgi.input"].read(content_length).decode(ENCODING)
                                                            +
                                                            var method
                                                            +
                                                            + +Expand source code + +
                                                            class WsgiHttpRequest:
                                                            +    """This Class uses the PEP 3333 standard to extract request information
                                                            +    from the WSGI web server running the application
                                                            +
                                                            +    PEP 3333: https://peps.python.org/pep-3333/
                                                            +    """
                                                            +
                                                            +    __slots__ = ("method", "path", "query_string", "protocol", "environ")
                                                            +
                                                            +    def __init__(self, environ: Dict[str, Any]):
                                                            +        self.method: str = environ.get("REQUEST_METHOD", "GET")
                                                            +        self.path: str = environ.get("PATH_INFO", "")
                                                            +        self.query_string: str = environ.get("QUERY_STRING", "")
                                                            +        self.protocol: str = environ.get("SERVER_PROTOCOL", "")
                                                            +        self.environ = environ
                                                            +
                                                            +    def get_headers(self) -> Dict[str, Union[str, Sequence[str]]]:
                                                            +        headers = {}
                                                            +        for key, value in self.environ.items():
                                                            +            if key in {"CONTENT_LENGTH", "CONTENT_TYPE"}:
                                                            +                name = key.lower().replace("_", "-")
                                                            +                headers[name] = value
                                                            +            if key.startswith("HTTP_"):
                                                            +                name = key[len("HTTP_"):].lower().replace("_", "-")  # fmt: skip
                                                            +                headers[name] = value
                                                            +        return headers
                                                            +
                                                            +    def get_body(self) -> str:
                                                            +        if "wsgi.input" not in self.environ:
                                                            +            return ""
                                                            +        content_length = int(self.environ.get("CONTENT_LENGTH", 0))
                                                            +        return self.environ["wsgi.input"].read(content_length).decode(ENCODING)
                                                            +
                                                            var path
                                                            +
                                                            + +Expand source code + +
                                                            class WsgiHttpRequest:
                                                            +    """This Class uses the PEP 3333 standard to extract request information
                                                            +    from the WSGI web server running the application
                                                            +
                                                            +    PEP 3333: https://peps.python.org/pep-3333/
                                                            +    """
                                                            +
                                                            +    __slots__ = ("method", "path", "query_string", "protocol", "environ")
                                                            +
                                                            +    def __init__(self, environ: Dict[str, Any]):
                                                            +        self.method: str = environ.get("REQUEST_METHOD", "GET")
                                                            +        self.path: str = environ.get("PATH_INFO", "")
                                                            +        self.query_string: str = environ.get("QUERY_STRING", "")
                                                            +        self.protocol: str = environ.get("SERVER_PROTOCOL", "")
                                                            +        self.environ = environ
                                                            +
                                                            +    def get_headers(self) -> Dict[str, Union[str, Sequence[str]]]:
                                                            +        headers = {}
                                                            +        for key, value in self.environ.items():
                                                            +            if key in {"CONTENT_LENGTH", "CONTENT_TYPE"}:
                                                            +                name = key.lower().replace("_", "-")
                                                            +                headers[name] = value
                                                            +            if key.startswith("HTTP_"):
                                                            +                name = key[len("HTTP_"):].lower().replace("_", "-")  # fmt: skip
                                                            +                headers[name] = value
                                                            +        return headers
                                                            +
                                                            +    def get_body(self) -> str:
                                                            +        if "wsgi.input" not in self.environ:
                                                            +            return ""
                                                            +        content_length = int(self.environ.get("CONTENT_LENGTH", 0))
                                                            +        return self.environ["wsgi.input"].read(content_length).decode(ENCODING)
                                                            +
                                                            var protocol
                                                            +
                                                            + +Expand source code + +
                                                            class WsgiHttpRequest:
                                                            +    """This Class uses the PEP 3333 standard to extract request information
                                                            +    from the WSGI web server running the application
                                                            +
                                                            +    PEP 3333: https://peps.python.org/pep-3333/
                                                            +    """
                                                            +
                                                            +    __slots__ = ("method", "path", "query_string", "protocol", "environ")
                                                            +
                                                            +    def __init__(self, environ: Dict[str, Any]):
                                                            +        self.method: str = environ.get("REQUEST_METHOD", "GET")
                                                            +        self.path: str = environ.get("PATH_INFO", "")
                                                            +        self.query_string: str = environ.get("QUERY_STRING", "")
                                                            +        self.protocol: str = environ.get("SERVER_PROTOCOL", "")
                                                            +        self.environ = environ
                                                            +
                                                            +    def get_headers(self) -> Dict[str, Union[str, Sequence[str]]]:
                                                            +        headers = {}
                                                            +        for key, value in self.environ.items():
                                                            +            if key in {"CONTENT_LENGTH", "CONTENT_TYPE"}:
                                                            +                name = key.lower().replace("_", "-")
                                                            +                headers[name] = value
                                                            +            if key.startswith("HTTP_"):
                                                            +                name = key[len("HTTP_"):].lower().replace("_", "-")  # fmt: skip
                                                            +                headers[name] = value
                                                            +        return headers
                                                            +
                                                            +    def get_body(self) -> str:
                                                            +        if "wsgi.input" not in self.environ:
                                                            +            return ""
                                                            +        content_length = int(self.environ.get("CONTENT_LENGTH", 0))
                                                            +        return self.environ["wsgi.input"].read(content_length).decode(ENCODING)
                                                            +
                                                            var query_string
                                                            +
                                                            + +Expand source code + +
                                                            class WsgiHttpRequest:
                                                            +    """This Class uses the PEP 3333 standard to extract request information
                                                            +    from the WSGI web server running the application
                                                            +
                                                            +    PEP 3333: https://peps.python.org/pep-3333/
                                                            +    """
                                                            +
                                                            +    __slots__ = ("method", "path", "query_string", "protocol", "environ")
                                                            +
                                                            +    def __init__(self, environ: Dict[str, Any]):
                                                            +        self.method: str = environ.get("REQUEST_METHOD", "GET")
                                                            +        self.path: str = environ.get("PATH_INFO", "")
                                                            +        self.query_string: str = environ.get("QUERY_STRING", "")
                                                            +        self.protocol: str = environ.get("SERVER_PROTOCOL", "")
                                                            +        self.environ = environ
                                                            +
                                                            +    def get_headers(self) -> Dict[str, Union[str, Sequence[str]]]:
                                                            +        headers = {}
                                                            +        for key, value in self.environ.items():
                                                            +            if key in {"CONTENT_LENGTH", "CONTENT_TYPE"}:
                                                            +                name = key.lower().replace("_", "-")
                                                            +                headers[name] = value
                                                            +            if key.startswith("HTTP_"):
                                                            +                name = key[len("HTTP_"):].lower().replace("_", "-")  # fmt: skip
                                                            +                headers[name] = value
                                                            +        return headers
                                                            +
                                                            +    def get_body(self) -> str:
                                                            +        if "wsgi.input" not in self.environ:
                                                            +            return ""
                                                            +        content_length = int(self.environ.get("CONTENT_LENGTH", 0))
                                                            +        return self.environ["wsgi.input"].read(content_length).decode(ENCODING)
                                                            +
                                                            @@ -109,12 +305,37 @@

                                                            Methods

                                                            def get_body(self) ‑> str
                                                            +
                                                            + +Expand source code + +
                                                            def get_body(self) -> str:
                                                            +    if "wsgi.input" not in self.environ:
                                                            +        return ""
                                                            +    content_length = int(self.environ.get("CONTENT_LENGTH", 0))
                                                            +    return self.environ["wsgi.input"].read(content_length).decode(ENCODING)
                                                            +
                                                            def get_headers(self) ‑> Dict[str, str | Sequence[str]]
                                                            +
                                                            + +Expand source code + +
                                                            def get_headers(self) -> Dict[str, Union[str, Sequence[str]]]:
                                                            +    headers = {}
                                                            +    for key, value in self.environ.items():
                                                            +        if key in {"CONTENT_LENGTH", "CONTENT_TYPE"}:
                                                            +            name = key.lower().replace("_", "-")
                                                            +            headers[name] = value
                                                            +        if key.startswith("HTTP_"):
                                                            +            name = key[len("HTTP_"):].lower().replace("_", "-")  # fmt: skip
                                                            +            headers[name] = value
                                                            +    return headers
                                                            +
                                                            @@ -152,7 +373,7 @@

                                                            -

                                                            Generated by pdoc 0.11.3.

                                                            +

                                                            Generated by pdoc 0.11.5.

                                                            diff --git a/docs/static/api-docs/slack_bolt/adapter/wsgi/http_response.html b/docs/static/api-docs/slack_bolt/adapter/wsgi/http_response.html index 20759ad2..3ddc2350 100644 --- a/docs/static/api-docs/slack_bolt/adapter/wsgi/http_response.html +++ b/docs/static/api-docs/slack_bolt/adapter/wsgi/http_response.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.wsgi.http_response API documentation - + @@ -40,9 +51,6 @@

                                                            Classes

                                                            (status: int, headers: Dict[str, Sequence[str]] = {}, body: str = '')
                                                            -

                                                            This Class uses the PEP 3333 standard to adapt bolt response information -for the WSGI web server running the application

                                                            -

                                                            PEP 3333: https://peps.python.org/pep-3333/

                                                            Expand source code @@ -75,10 +83,45 @@

                                                            Classes

                                                            def get_body(self) -> Iterable[bytes]: return [self._body]
                                                            +

                                                            This Class uses the PEP 3333 standard to adapt bolt response information +for the WSGI web server running the application

                                                            +

                                                            PEP 3333: https://peps.python.org/pep-3333/

                                                            Instance variables

                                                            var status
                                                            +
                                                            + +Expand source code + +
                                                            class WsgiHttpResponse:
                                                            +    """This Class uses the PEP 3333 standard to adapt bolt response information
                                                            +    for the WSGI web server running the application
                                                            +
                                                            +    PEP 3333: https://peps.python.org/pep-3333/
                                                            +    """
                                                            +
                                                            +    __slots__ = ("status", "_headers", "_body")
                                                            +
                                                            +    def __init__(self, status: int, headers: Dict[str, Sequence[str]] = {}, body: str = ""):
                                                            +        _status = HTTPStatus(status)
                                                            +        self.status = f"{_status.value} {_status.phrase}"
                                                            +        self._headers = headers
                                                            +        self._body = bytes(body, ENCODING)
                                                            +
                                                            +    def get_headers(self) -> List[Tuple[str, str]]:
                                                            +        headers: List[Tuple[str, str]] = []
                                                            +        for key, value in self._headers.items():
                                                            +            if key.lower() == "content-length":
                                                            +                continue
                                                            +            headers.append((key, value[0]))
                                                            +
                                                            +        headers.append(("content-length", str(len(self._body))))
                                                            +        return headers
                                                            +
                                                            +    def get_body(self) -> Iterable[bytes]:
                                                            +        return [self._body]
                                                            +
                                                            @@ -88,12 +131,33 @@

                                                            Methods

                                                            def get_body(self) ‑> Iterable[bytes]
                                                            +
                                                            + +Expand source code + +
                                                            def get_body(self) -> Iterable[bytes]:
                                                            +    return [self._body]
                                                            +
                                                            def get_headers(self) ‑> List[Tuple[str, str]]
                                                            +
                                                            + +Expand source code + +
                                                            def get_headers(self) -> List[Tuple[str, str]]:
                                                            +    headers: List[Tuple[str, str]] = []
                                                            +    for key, value in self._headers.items():
                                                            +        if key.lower() == "content-length":
                                                            +            continue
                                                            +        headers.append((key, value[0]))
                                                            +
                                                            +    headers.append(("content-length", str(len(self._body))))
                                                            +    return headers
                                                            +
                                                            @@ -127,7 +191,7 @@

                                                            diff --git a/docs/static/api-docs/slack_bolt/adapter/wsgi/index.html b/docs/static/api-docs/slack_bolt/adapter/wsgi/index.html index c4df0004..49ab0d93 100644 --- a/docs/static/api-docs/slack_bolt/adapter/wsgi/index.html +++ b/docs/static/api-docs/slack_bolt/adapter/wsgi/index.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.wsgi API documentation - + @@ -59,29 +70,6 @@

                                                            Classes

                                                            (app: App,
                                                            path: str = '/slack/events')
                                                            -

                                                            Setup Bolt as a WSGI web framework, this will make your application compatible with WSGI web servers. -This can be used for production deployments.

                                                            -

                                                            With the default settings, http://localhost:3000/slack/events -Run Bolt with gunicorn

                                                            -

                                                            Python

                                                            -
                                                            app = App()
                                                            -
                                                            -api = SlackRequestHandler(app)
                                                            -
                                                            -

                                                            bash

                                                            -
                                                            export SLACK_SIGNING_SECRET=***
                                                            -
                                                            -export SLACK_BOT_TOKEN=xoxb-***
                                                            -
                                                            -gunicorn app:api -b 0.0.0.0:3000 --log-level debug
                                                            -
                                                            -

                                                            Args

                                                            -
                                                            -
                                                            app
                                                            -
                                                            Your bolt application
                                                            -
                                                            path
                                                            -
                                                            The path to handle request from Slack (Default: /slack/events)
                                                            -
                                                            Expand source code @@ -160,24 +148,74 @@

                                                            Args

                                                            return response.get_body() raise TypeError(f"Unsupported SERVER_PROTOCOL: {request.protocol}")
                                                            +

                                                            Setup Bolt as a WSGI web framework, this will make your application compatible with WSGI web servers. +This can be used for production deployments.

                                                            +

                                                            With the default settings, http://localhost:3000/slack/events +Run Bolt with gunicorn

                                                            +

                                                            Python

                                                            +
                                                            app = App()
                                                            +
                                                            +api = SlackRequestHandler(app)
                                                            +
                                                            +

                                                            bash

                                                            +
                                                            export SLACK_SIGNING_SECRET=***
                                                            +
                                                            +export SLACK_BOT_TOKEN=xoxb-***
                                                            +
                                                            +gunicorn app:api -b 0.0.0.0:3000 --log-level debug
                                                            +
                                                            +

                                                            Args

                                                            +
                                                            +
                                                            app
                                                            +
                                                            Your bolt application
                                                            +
                                                            path
                                                            +
                                                            The path to handle request from Slack (Default: /slack/events)
                                                            +

                                                            Methods

                                                            def dispatch(self,
                                                            request: WsgiHttpRequest) ‑> BoltResponse
                                                            +
                                                            + +Expand source code + +
                                                            def dispatch(self, request: WsgiHttpRequest) -> BoltResponse:
                                                            +    return self.app.dispatch(
                                                            +        BoltRequest(body=request.get_body(), query=request.query_string, headers=request.get_headers())
                                                            +    )
                                                            +
                                                            def handle_callback(self,
                                                            request: WsgiHttpRequest) ‑> BoltResponse
                                                            +
                                                            + +Expand source code + +
                                                            def handle_callback(self, request: WsgiHttpRequest) -> BoltResponse:
                                                            +    return self.app.oauth_flow.handle_callback(  # type: ignore[union-attr]
                                                            +        BoltRequest(body=request.get_body(), query=request.query_string, headers=request.get_headers())
                                                            +    )
                                                            +
                                                            def handle_installation(self,
                                                            request: WsgiHttpRequest) ‑> BoltResponse
                                                            +
                                                            + +Expand source code + +
                                                            def handle_installation(self, request: WsgiHttpRequest) -> BoltResponse:
                                                            +    return self.app.oauth_flow.handle_installation(  # type: ignore[union-attr]
                                                            +        BoltRequest(body=request.get_body(), query=request.query_string, headers=request.get_headers())
                                                            +    )
                                                            +
                                                            @@ -219,7 +257,7 @@

                                                            -

                                                            Generated by pdoc 0.11.3.

                                                            +

                                                            Generated by pdoc 0.11.5.

                                                            diff --git a/docs/static/api-docs/slack_bolt/adapter/wsgi/internals.html b/docs/static/api-docs/slack_bolt/adapter/wsgi/internals.html index 756cee78..addbae58 100644 --- a/docs/static/api-docs/slack_bolt/adapter/wsgi/internals.html +++ b/docs/static/api-docs/slack_bolt/adapter/wsgi/internals.html @@ -3,19 +3,30 @@ - + slack_bolt.adapter.wsgi.internals API documentation - + @@ -49,7 +60,7 @@

                                                            Module slack_bolt.adapter.wsgi.internals

                                                            diff --git a/docs/static/api-docs/slack_bolt/app/app.html b/docs/static/api-docs/slack_bolt/app/app.html index cdd50eb6..4584a03c 100644 --- a/docs/static/api-docs/slack_bolt/app/app.html +++ b/docs/static/api-docs/slack_bolt/app/app.html @@ -3,19 +3,30 @@ - + slack_bolt.app.app API documentation - + @@ -40,101 +51,6 @@

                                                            Classes

                                                            (*,
                                                            logger: logging.Logger | None = None,
                                                            name: str | None = None,
                                                            process_before_response: bool = False,
                                                            raise_error_for_unhandled_request: bool = False,
                                                            signing_secret: str | None = None,
                                                            token: str | None = None,
                                                            token_verification_enabled: bool = True,
                                                            client: slack_sdk.web.client.WebClient | None = None,
                                                            before_authorize: Middleware | Callable[..., Any] | None = None,
                                                            authorize: Callable[..., AuthorizeResult] | None = None,
                                                            user_facing_authorize_error_message: str | None = None,
                                                            installation_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore | None = None,
                                                            installation_store_bot_only: bool | None = None,
                                                            request_verification_enabled: bool = True,
                                                            ignoring_self_events_enabled: bool = True,
                                                            ignoring_self_assistant_message_events_enabled: bool = True,
                                                            ssl_check_enabled: bool = True,
                                                            url_verification_enabled: bool = True,
                                                            attaching_function_token_enabled: bool = True,
                                                            oauth_settings: OAuthSettings | None = None,
                                                            oauth_flow: OAuthFlow | None = None,
                                                            verification_token: str | None = None,
                                                            listener_executor: concurrent.futures._base.Executor | None = None,
                                                            assistant_thread_context_store: AssistantThreadContextStore | None = None)
                                                            -

                                                            Bolt App that provides functionalities to register middleware/listeners.

                                                            -
                                                            import os
                                                            -from slack_bolt import App
                                                            -
                                                            -# Initializes your app with your bot token and signing secret
                                                            -app = App(
                                                            -    token=os.environ.get("SLACK_BOT_TOKEN"),
                                                            -    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
                                                            -)
                                                            -
                                                            -# Listens to incoming messages that contain "hello"
                                                            -@app.message("hello")
                                                            -def message_hello(message, say):
                                                            -    # say() sends a message to the channel where the event was triggered
                                                            -    say(f"Hey there <@{message['user']}>!")
                                                            -
                                                            -# Start your app
                                                            -if __name__ == "__main__":
                                                            -    app.start(port=int(os.environ.get("PORT", 3000)))
                                                            -
                                                            -

                                                            Refer to https://slack.dev/bolt-python/tutorial/getting-started for details.

                                                            -

                                                            If you would like to build an OAuth app for enabling the app to run with multiple workspaces, -refer to https://slack.dev/bolt-python/concepts#authenticating-oauth to learn how to configure the app.

                                                            -

                                                            Args

                                                            -
                                                            -
                                                            logger
                                                            -
                                                            The custom logger that can be used in this app.
                                                            -
                                                            name
                                                            -
                                                            The application name that will be used in logging. If absent, the source file name will be used.
                                                            -
                                                            process_before_response
                                                            -
                                                            True if this app runs on Function as a Service. (Default: False)
                                                            -
                                                            raise_error_for_unhandled_request
                                                            -
                                                            True if you want to raise exceptions for unhandled requests -and use @app.error listeners instead of -the built-in handler, which pints warning logs and returns 404 to Slack (Default: False)
                                                            -
                                                            signing_secret
                                                            -
                                                            The Signing Secret value used for verifying requests from Slack.
                                                            -
                                                            token
                                                            -
                                                            The bot/user access token required only for single-workspace app.
                                                            -
                                                            token_verification_enabled
                                                            -
                                                            Verifies the validity of the given token if True.
                                                            -
                                                            client
                                                            -
                                                            The singleton slack_sdk.WebClient instance for this app.
                                                            -
                                                            before_authorize
                                                            -
                                                            A global middleware that can be executed right before authorize function
                                                            -
                                                            authorize
                                                            -
                                                            The function to authorize an incoming request from Slack -by checking if there is a team/user in the installation data.
                                                            -
                                                            user_facing_authorize_error_message
                                                            -
                                                            The user-facing error message to display -when the app is installed but the installation is not managed by this app's installation store
                                                            -
                                                            installation_store
                                                            -
                                                            The module offering save/find operations of installation data
                                                            -
                                                            installation_store_bot_only
                                                            -
                                                            Use InstallationStore#find_bot() if True (Default: False)
                                                            -
                                                            request_verification_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -RequestVerification is a built-in middleware that verifies the signature in HTTP Mode requests. -Make sure if it's safe enough when you turn a built-in middleware off. -We strongly recommend using RequestVerification for better security. -If you have a proxy that verifies request signature in front of the Bolt app, -it's totally fine to disable RequestVerification to avoid duplication of work. -Don't turn it off just for easiness of development.
                                                            -
                                                            ignoring_self_events_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -IgnoringSelfEvents is a built-in middleware that enables Bolt apps to easily skip the events -generated by this app's bot user (this is useful for avoiding code error causing an infinite loop).
                                                            -
                                                            ignoring_self_assistant_message_events_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware. -IgnoringSelfEvents for this app's bot user message events within an assistant thread -This is useful for avoiding code error causing an infinite loop; Default: True
                                                            -
                                                            url_verification_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -UrlVerification is a built-in middleware that handles url_verification requests -that verify the endpoint for Events API in HTTP Mode requests.
                                                            -
                                                            attaching_function_token_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -AttachingFunctionToken is a built-in middleware that injects the just-in-time workflow-execution tokens -when your app receives function_executed or interactivity events scoped to a custom step.
                                                            -
                                                            ssl_check_enabled
                                                            -
                                                            bool = False if you would like to disable the built-in middleware (Default: True). -SslCheck is a built-in middleware that handles ssl_check requests from Slack.
                                                            -
                                                            oauth_settings
                                                            -
                                                            The settings related to Slack app installation flow (OAuth flow)
                                                            -
                                                            oauth_flow
                                                            -
                                                            Instantiated OAuthFlow. This is always prioritized over oauth_settings.
                                                            -
                                                            verification_token
                                                            -
                                                            Deprecated verification mechanism. This can be used only for ssl_check requests.
                                                            -
                                                            listener_executor
                                                            -
                                                            Custom executor to run background tasks. If absent, the default ThreadPoolExecutor will -be used.
                                                            -
                                                            assistant_thread_context_store
                                                            -
                                                            Custom AssistantThreadContext store (Default: the built-in implementation, -which uses a parent message's metadata to store the latest context)
                                                            -
                                                            Expand source code @@ -1499,11 +1415,105 @@

                                                            Args

                                                            ) return value_to_return
                                                            +

                                                            Bolt App that provides functionalities to register middleware/listeners.

                                                            +
                                                            import os
                                                            +from slack_bolt import App
                                                            +
                                                            +# Initializes your app with your bot token and signing secret
                                                            +app = App(
                                                            +    token=os.environ.get("SLACK_BOT_TOKEN"),
                                                            +    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
                                                            +)
                                                            +
                                                            +# Listens to incoming messages that contain "hello"
                                                            +@app.message("hello")
                                                            +def message_hello(message, say):
                                                            +    # say() sends a message to the channel where the event was triggered
                                                            +    say(f"Hey there <@{message['user']}>!")
                                                            +
                                                            +# Start your app
                                                            +if __name__ == "__main__":
                                                            +    app.start(port=int(os.environ.get("PORT", 3000)))
                                                            +
                                                            +

                                                            Refer to https://slack.dev/bolt-python/tutorial/getting-started for details.

                                                            +

                                                            If you would like to build an OAuth app for enabling the app to run with multiple workspaces, +refer to https://slack.dev/bolt-python/concepts#authenticating-oauth to learn how to configure the app.

                                                            +

                                                            Args

                                                            +
                                                            +
                                                            logger
                                                            +
                                                            The custom logger that can be used in this app.
                                                            +
                                                            name
                                                            +
                                                            The application name that will be used in logging. If absent, the source file name will be used.
                                                            +
                                                            process_before_response
                                                            +
                                                            True if this app runs on Function as a Service. (Default: False)
                                                            +
                                                            raise_error_for_unhandled_request
                                                            +
                                                            True if you want to raise exceptions for unhandled requests +and use @app.error listeners instead of +the built-in handler, which pints warning logs and returns 404 to Slack (Default: False)
                                                            +
                                                            signing_secret
                                                            +
                                                            The Signing Secret value used for verifying requests from Slack.
                                                            +
                                                            token
                                                            +
                                                            The bot/user access token required only for single-workspace app.
                                                            +
                                                            token_verification_enabled
                                                            +
                                                            Verifies the validity of the given token if True.
                                                            +
                                                            client
                                                            +
                                                            The singleton slack_sdk.WebClient instance for this app.
                                                            +
                                                            before_authorize
                                                            +
                                                            A global middleware that can be executed right before authorize function
                                                            +
                                                            authorize
                                                            +
                                                            The function to authorize an incoming request from Slack +by checking if there is a team/user in the installation data.
                                                            +
                                                            user_facing_authorize_error_message
                                                            +
                                                            The user-facing error message to display +when the app is installed but the installation is not managed by this app's installation store
                                                            +
                                                            installation_store
                                                            +
                                                            The module offering save/find operations of installation data
                                                            +
                                                            installation_store_bot_only
                                                            +
                                                            Use InstallationStore#find_bot() if True (Default: False)
                                                            +
                                                            request_verification_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +RequestVerification is a built-in middleware that verifies the signature in HTTP Mode requests. +Make sure if it's safe enough when you turn a built-in middleware off. +We strongly recommend using RequestVerification for better security. +If you have a proxy that verifies request signature in front of the Bolt app, +it's totally fine to disable RequestVerification to avoid duplication of work. +Don't turn it off just for easiness of development.
                                                            +
                                                            ignoring_self_events_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +IgnoringSelfEvents is a built-in middleware that enables Bolt apps to easily skip the events +generated by this app's bot user (this is useful for avoiding code error causing an infinite loop).
                                                            +
                                                            ignoring_self_assistant_message_events_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware. +IgnoringSelfEvents for this app's bot user message events within an assistant thread +This is useful for avoiding code error causing an infinite loop; Default: True
                                                            +
                                                            url_verification_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +UrlVerification is a built-in middleware that handles url_verification requests +that verify the endpoint for Events API in HTTP Mode requests.
                                                            +
                                                            attaching_function_token_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +AttachingFunctionToken is a built-in middleware that injects the just-in-time workflow-execution tokens +when your app receives function_executed or interactivity events scoped to a custom step.
                                                            +
                                                            ssl_check_enabled
                                                            +
                                                            bool = False if you would like to disable the built-in middleware (Default: True). +SslCheck is a built-in middleware that handles ssl_check requests from Slack.
                                                            +
                                                            oauth_settings
                                                            +
                                                            The settings related to Slack app installation flow (OAuth flow)
                                                            +
                                                            oauth_flow
                                                            +
                                                            Instantiated OAuthFlow. This is always prioritized over oauth_settings.
                                                            +
                                                            verification_token
                                                            +
                                                            Deprecated verification mechanism. This can be used only for ssl_check requests.
                                                            +
                                                            listener_executor
                                                            +
                                                            Custom executor to run background tasks. If absent, the default ThreadPoolExecutor will +be used.
                                                            +
                                                            assistant_thread_context_store
                                                            +
                                                            Custom AssistantThreadContext store (Default: the built-in implementation, +which uses a parent message's metadata to store the latest context)
                                                            +

                                                            Instance variables

                                                            prop client : slack_sdk.web.client.WebClient
                                                            -

                                                            The singleton slack_sdk.WebClient instance in this app.

                                                            Expand source code @@ -1513,10 +1523,10 @@

                                                            Instance variables

                                                            """The singleton `slack_sdk.WebClient` instance in this app.""" return self._client
                                                            +

                                                            The singleton slack_sdk.WebClient instance in this app.

                                                            prop installation_store : slack_sdk.oauth.installation_store.installation_store.InstallationStore | None
                                                            -

                                                            The slack_sdk.oauth.InstallationStore that can be used in the authorize middleware.

                                                            Expand source code @@ -1526,10 +1536,10 @@

                                                            Instance variables

                                                            """The `slack_sdk.oauth.InstallationStore` that can be used in the `authorize` middleware.""" return self._installation_store
                                                            +

                                                            The slack_sdk.oauth.InstallationStore that can be used in the authorize middleware.

                                                            prop listener_runnerThreadListenerRunner
                                                            -

                                                            The thread executor for asynchronously running listeners.

                                                            Expand source code @@ -1539,10 +1549,10 @@

                                                            Instance variables

                                                            """The thread executor for asynchronously running listeners.""" return self._listener_runner
                                                            +

                                                            The thread executor for asynchronously running listeners.

                                                            prop logger : logging.Logger
                                                            -

                                                            The logger this app uses.

                                                            Expand source code @@ -1552,10 +1562,10 @@

                                                            Instance variables

                                                            """The logger this app uses.""" return self._framework_logger
                                                            +

                                                            The logger this app uses.

                                                            prop name : str
                                                            -

                                                            The name of this app (default: the filename)

                                                            Expand source code @@ -1565,10 +1575,10 @@

                                                            Instance variables

                                                            """The name of this app (default: the filename)""" return self._name
                                                            +

                                                            The name of this app (default: the filename)

                                                            prop oauth_flowOAuthFlow | None
                                                            -

                                                            Configured OAuthFlow object if exists.

                                                            Expand source code @@ -1578,10 +1588,10 @@

                                                            Instance variables

                                                            """Configured `OAuthFlow` object if exists.""" return self._oauth_flow
                                                            +

                                                            Configured OAuthFlow object if exists.

                                                            prop process_before_response : bool
                                                            -
                                                            Expand source code @@ -1590,6 +1600,7 @@

                                                            Instance variables

                                                            def process_before_response(self) -> bool: return self._process_before_response or False
                                                            +

                                                            Methods

                                                            @@ -1598,6 +1609,47 @@

                                                            Methods

                                                            def action(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def action(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new action listener. This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.action("approve_button")
                                                            +        def update_message(ack):
                                                            +            ack()
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.action("approve_button")(update_message)
                                                            +
                                                            +    * Refer to https://api.slack.com/reference/interaction-payloads/block-actions for actions in `blocks`.
                                                            +    * Refer to https://api.slack.com/legacy/message-buttons for actions in `attachments`.
                                                            +    * Refer to https://api.slack.com/dialogs for actions in dialogs.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        constraints: The conditions that match a request payload
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.action(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new action listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                             @app.action("approve_button")
                                                            @@ -1629,12 +1681,39 @@ 

                                                            Args

                                                            def assistant(self,
                                                            assistant: Assistant) ‑> Callable | None
                                                            +
                                                            + +Expand source code + +
                                                            def assistant(self, assistant: Assistant) -> Optional[Callable]:
                                                            +    return self.middleware(assistant)
                                                            +
                                                            def attachment_action(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def attachment_action(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `interactive_message` action listener.
                                                            +    Refer to https://api.slack.com/legacy/message-buttons for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.attachment_action(callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new interactive_message action listener. Refer to https://api.slack.com/legacy/message-buttons for details.

                                                            @@ -1642,6 +1721,27 @@

                                                            Args

                                                            def block_action(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def block_action(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `block_actions` action listener.
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/block-actions for details.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.block_action(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new block_actions action listener. Refer to https://api.slack.com/reference/interaction-payloads/block-actions for details.

                                                            @@ -1649,12 +1749,73 @@

                                                            Args

                                                            def block_suggestion(self,
                                                            action_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def block_suggestion(
                                                            +    self,
                                                            +    action_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `block_suggestion` listener."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.block_suggestion(action_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new block_suggestion listener.

                                                            def command(self,
                                                            command: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def command(
                                                            +    self,
                                                            +    command: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new slash command listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.command("/echo")
                                                            +        def repeat_text(ack, say, command):
                                                            +            # Acknowledge command request
                                                            +            ack()
                                                            +            say(f"{command['text']}")
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.command("/echo")(repeat_text)
                                                            +
                                                            +    Refer to https://api.slack.com/interactivity/slash-commands for details of Slash Commands.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        command: The conditions that match a request payload
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.command(command, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new slash command listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1685,18 +1846,60 @@ 

                                                            Args

                                                            def default_app_uninstalled_event_listener(self) ‑> Callable[..., BoltResponse | None]
                                                            +
                                                            + +Expand source code + +
                                                            def default_app_uninstalled_event_listener(
                                                            +    self,
                                                            +) -> Callable[..., Optional[BoltResponse]]:
                                                            +    if self._tokens_revocation_listeners is None:
                                                            +        raise BoltError(error_installation_store_required_for_builtin_listeners())
                                                            +    return self._tokens_revocation_listeners.handle_app_uninstalled_events
                                                            +
                                                            def default_tokens_revoked_event_listener(self) ‑> Callable[..., BoltResponse | None]
                                                            +
                                                            + +Expand source code + +
                                                            def default_tokens_revoked_event_listener(
                                                            +    self,
                                                            +) -> Callable[..., Optional[BoltResponse]]:
                                                            +    if self._tokens_revocation_listeners is None:
                                                            +        raise BoltError(error_installation_store_required_for_builtin_listeners())
                                                            +    return self._tokens_revocation_listeners.handle_tokens_revoked_events
                                                            +
                                                            def dialog_cancellation(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def dialog_cancellation(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `dialog_cancellation` listener.
                                                            +    Refer to https://api.slack.com/dialogs for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.dialog_cancellation(callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new dialog_cancellation listener. Refer to https://api.slack.com/dialogs for details.

                                                            @@ -1704,6 +1907,26 @@

                                                            Args

                                                            def dialog_submission(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def dialog_submission(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `dialog_submission` listener.
                                                            +    Refer to https://api.slack.com/dialogs for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.dialog_submission(callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new dialog_submission listener. Refer to https://api.slack.com/dialogs for details.

                                                            @@ -1711,6 +1934,26 @@

                                                            Args

                                                            def dialog_suggestion(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def dialog_suggestion(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `dialog_suggestion` listener.
                                                            +    Refer to https://api.slack.com/dialogs for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.dialog_suggestion(callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new dialog_suggestion listener. Refer to https://api.slack.com/dialogs for details.

                                                            @@ -1718,6 +1961,118 @@

                                                            Args

                                                            def dispatch(self,
                                                            req: BoltRequest) ‑> BoltResponse
                                                            +
                                                            + +Expand source code + +
                                                            def dispatch(self, req: BoltRequest) -> BoltResponse:
                                                            +    """Applies all middleware and dispatches an incoming request from Slack to the right code path.
                                                            +
                                                            +    Args:
                                                            +        req: An incoming request from Slack
                                                            +
                                                            +    Returns:
                                                            +        The response generated by this Bolt app
                                                            +    """
                                                            +    starting_time = time.time()
                                                            +    self._init_context(req)
                                                            +
                                                            +    resp: Optional[BoltResponse] = BoltResponse(status=200, body="")
                                                            +    middleware_state = {"next_called": False}
                                                            +
                                                            +    def middleware_next():
                                                            +        middleware_state["next_called"] = True
                                                            +
                                                            +    try:
                                                            +        for middleware in self._middleware_list:
                                                            +            middleware_state["next_called"] = False
                                                            +            if self._framework_logger.level <= logging.DEBUG:
                                                            +                self._framework_logger.debug(debug_applying_middleware(middleware.name))
                                                            +            resp = middleware.process(req=req, resp=resp, next=middleware_next)  # type: ignore[arg-type]
                                                            +            if not middleware_state["next_called"]:
                                                            +                if resp is None:
                                                            +                    # next() method was not called without providing the response to return to Slack
                                                            +                    # This should not be an intentional handling in usual use cases.
                                                            +                    resp = BoltResponse(status=404, body={"error": "no next() calls in middleware"})
                                                            +                    if self._raise_error_for_unhandled_request is True:
                                                            +                        try:
                                                            +                            raise BoltUnhandledRequestError(
                                                            +                                request=req,
                                                            +                                current_response=resp,
                                                            +                                last_global_middleware_name=middleware.name,
                                                            +                            )
                                                            +                        except BoltUnhandledRequestError as e:
                                                            +                            self._listener_runner.listener_error_handler.handle(
                                                            +                                error=e,
                                                            +                                request=req,
                                                            +                                response=resp,
                                                            +                            )
                                                            +                        return resp
                                                            +                    self._framework_logger.warning(warning_unhandled_by_global_middleware(middleware.name, req))
                                                            +                    return resp
                                                            +                return resp
                                                            +
                                                            +        for listener in self._listeners:
                                                            +            listener_name = get_name_for_callable(listener.ack_function)
                                                            +            self._framework_logger.debug(debug_checking_listener(listener_name))
                                                            +            if listener.matches(req=req, resp=resp):  # type: ignore[arg-type]
                                                            +                # run all the middleware attached to this listener first
                                                            +                middleware_resp, next_was_not_called = listener.run_middleware(
                                                            +                    req=req, resp=resp  # type: ignore[arg-type]
                                                            +                )
                                                            +                if next_was_not_called:
                                                            +                    if middleware_resp is not None:
                                                            +                        if self._framework_logger.level <= logging.DEBUG:
                                                            +                            debug_message = debug_return_listener_middleware_response(
                                                            +                                listener_name,
                                                            +                                middleware_resp.status,
                                                            +                                middleware_resp.body,
                                                            +                                starting_time,
                                                            +                            )
                                                            +                            self._framework_logger.debug(debug_message)
                                                            +                        return middleware_resp
                                                            +                    # The last listener middleware didn't call next() method.
                                                            +                    # This means the listener is not for this incoming request.
                                                            +                    continue
                                                            +
                                                            +                if middleware_resp is not None:
                                                            +                    resp = middleware_resp
                                                            +
                                                            +                self._framework_logger.debug(debug_running_listener(listener_name))
                                                            +                listener_response: Optional[BoltResponse] = self._listener_runner.run(
                                                            +                    request=req,
                                                            +                    response=resp,  # type: ignore[arg-type]
                                                            +                    listener_name=listener_name,
                                                            +                    listener=listener,
                                                            +                )
                                                            +                if listener_response is not None:
                                                            +                    return listener_response
                                                            +
                                                            +        if resp is None:
                                                            +            resp = BoltResponse(status=404, body={"error": "unhandled request"})
                                                            +        if self._raise_error_for_unhandled_request is True:
                                                            +            try:
                                                            +                raise BoltUnhandledRequestError(
                                                            +                    request=req,
                                                            +                    current_response=resp,
                                                            +                )
                                                            +            except BoltUnhandledRequestError as e:
                                                            +                self._listener_runner.listener_error_handler.handle(
                                                            +                    error=e,
                                                            +                    request=req,
                                                            +                    response=resp,
                                                            +                )
                                                            +            return resp
                                                            +        return self._handle_unmatched_requests(req, resp)
                                                            +    except Exception as error:
                                                            +        resp = BoltResponse(status=500, body="")
                                                            +        self._middleware_error_handler.handle(
                                                            +            error=error,
                                                            +            request=req,
                                                            +            response=resp,
                                                            +        )
                                                            +        return resp
                                                            +

                                                            Applies all middleware and dispatches an incoming request from Slack to the right code path.

                                                            Args

                                                            @@ -1731,12 +2086,52 @@

                                                            Returns

                                                            def enable_token_revocation_listeners(self) ‑> None
                                                            +
                                                            + +Expand source code + +
                                                            def enable_token_revocation_listeners(self) -> None:
                                                            +    self.event("tokens_revoked")(self.default_tokens_revoked_event_listener())
                                                            +    self.event("app_uninstalled")(self.default_app_uninstalled_event_listener())
                                                            +
                                                            def error(self,
                                                            func: Callable[..., BoltResponse | None]) ‑> Callable[..., BoltResponse | None]
                                                            +
                                                            + +Expand source code + +
                                                            def error(self, func: Callable[..., Optional[BoltResponse]]) -> Callable[..., Optional[BoltResponse]]:
                                                            +    """Updates the global error handler. This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.error
                                                            +        def custom_error_handler(error, body, logger):
                                                            +            logger.exception(f"Error: {error}")
                                                            +            logger.info(f"Request body: {body}")
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.error(custom_error_handler)
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        func: The function that is supposed to be executed
                                                            +            when getting an unhandled error in Bolt app.
                                                            +    """
                                                            +    self._listener_runner.listener_error_handler = CustomListenerErrorHandler(
                                                            +        logger=self._framework_logger,
                                                            +        func=func,
                                                            +    )
                                                            +    self._middleware_error_handler = CustomMiddlewareErrorHandler(
                                                            +        logger=self._framework_logger,
                                                            +        func=func,
                                                            +    )
                                                            +    return func
                                                            +

                                                            Updates the global error handler. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                             @app.error
                                                            @@ -1759,6 +2154,53 @@ 

                                                            Args

                                                            def event(self,
                                                            event: str | Pattern | Dict[str, str | Sequence[str | Pattern | None] | None],
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def event(
                                                            +    self,
                                                            +    event: Union[
                                                            +        str,
                                                            +        Pattern,
                                                            +        Dict[str, Optional[Union[str, Sequence[Optional[Union[str, Pattern]]]]]],
                                                            +    ],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new event listener. This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.event("team_join")
                                                            +        def ask_for_introduction(event, say):
                                                            +            welcome_channel_id = "C12345"
                                                            +            user_id = event["user"]
                                                            +            text = f"Welcome to the team, <@{user_id}>! :tada: You can introduce yourself in this channel."
                                                            +            say(text=text, channel=welcome_channel_id)
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.event("team_join")(ask_for_introduction)
                                                            +
                                                            +    Refer to https://api.slack.com/apis/connections/events-api for details of Events API.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        event: The conditions that match a request payload.
                                                            +            If you pass a dict for this, you can have type, subtype in the constraint.
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.event(event, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new event listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                             @app.event("team_join")
                                                            @@ -1790,6 +2232,54 @@ 

                                                            Args

                                                            def function(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None,
                                                            auto_acknowledge: bool = True) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def function(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +    auto_acknowledge: bool = True,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new Function listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.function("reverse")
                                                            +        def reverse_string(ack: Ack, inputs: dict, complete: Complete, fail: Fail):
                                                            +            try:
                                                            +                ack()
                                                            +                string_to_reverse = inputs["stringToReverse"]
                                                            +                complete(outputs={"reverseString": string_to_reverse[::-1]})
                                                            +            except Exception as e:
                                                            +                fail(f"Cannot reverse string (error: {e})")
                                                            +                raise e
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.function("reverse")(reverse_string)
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        callback_id: The callback id to identify the function
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    matchers = list(matchers) if matchers else []
                                                            +    middleware = list(middleware) if middleware else []
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.function_executed(callback_id=callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(functions, primary_matcher, matchers, middleware, auto_acknowledge)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new Function listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1823,12 +2313,93 @@ 

                                                            Args

                                                            def global_shortcut(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def global_shortcut(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new global shortcut listener."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.global_shortcut(callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new global shortcut listener.

                                                            def message(self,
                                                            keyword: str | Pattern = '',
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def message(
                                                            +    self,
                                                            +    keyword: Union[str, Pattern] = "",
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new message event listener. This method can be used as either a decorator or a method.
                                                            +    Check the `App#event` method's docstring for details.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.message(":wave:")
                                                            +        def say_hello(message, say):
                                                            +            user = message['user']
                                                            +            say(f"Hi there, <@{user}>!")
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.message(":wave:")(say_hello)
                                                            +
                                                            +    Refer to https://api.slack.com/events/message for details of `message` events.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        keyword: The keyword to match
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +    matchers = list(matchers) if matchers else []
                                                            +    middleware = list(middleware) if middleware else []
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        constraints = {
                                                            +            "type": "message",
                                                            +            "subtype": (
                                                            +                # In most cases, new message events come with no subtype.
                                                            +                None,
                                                            +                # As of Jan 2021, most bot messages no longer have the subtype bot_message.
                                                            +                # By contrast, messages posted using classic app's bot token still have the subtype.
                                                            +                "bot_message",
                                                            +                # If an end-user posts a message with "Also send to #channel" checked,
                                                            +                # the message event comes with this subtype.
                                                            +                "thread_broadcast",
                                                            +                # If an end-user posts a message with attached files,
                                                            +                # the message event comes with this subtype.
                                                            +                "file_share",
                                                            +            ),
                                                            +        }
                                                            +        primary_matcher = builtin_matchers.message_event(
                                                            +            keyword=keyword, constraints=constraints, base_logger=self._base_logger
                                                            +        )
                                                            +        middleware.insert(0, MessageListenerMatches(keyword))
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new message event listener. This method can be used as either a decorator or a method. Check the App#event method's docstring for details.

                                                            # Use this method as a decorator
                                                            @@ -1858,12 +2429,75 @@ 

                                                            Args

                                                            def message_shortcut(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def message_shortcut(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new message shortcut listener."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.message_shortcut(callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new message shortcut listener.

                                                            def middleware(self, *args) ‑> Callable | None
                                                            +
                                                            + +Expand source code + +
                                                            def middleware(self, *args) -> Optional[Callable]:
                                                            +    """Registers a new middleware to this app.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.middleware
                                                            +        def middleware_func(logger, body, next):
                                                            +            logger.info(f"request body: {body}")
                                                            +            next()
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.middleware(middleware_func)
                                                            +
                                                            +    Refer to https://slack.dev/bolt-python/concepts#global-middleware for details.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        *args: A function that works as a global middleware.
                                                            +    """
                                                            +    if len(args) > 0:
                                                            +        middleware_or_callable = args[0]
                                                            +        if isinstance(middleware_or_callable, Middleware):
                                                            +            middleware: Middleware = middleware_or_callable
                                                            +            self._middleware_list.append(middleware)
                                                            +            if isinstance(middleware, Assistant) and middleware.thread_context_store is not None:
                                                            +                self._assistant_thread_context_store = middleware.thread_context_store
                                                            +        elif callable(middleware_or_callable):
                                                            +            self._middleware_list.append(
                                                            +                CustomMiddleware(
                                                            +                    app_name=self.name,
                                                            +                    func=middleware_or_callable,
                                                            +                    base_logger=self._base_logger,
                                                            +                )
                                                            +            )
                                                            +            return middleware_or_callable
                                                            +        else:
                                                            +            raise BoltError(f"Unexpected type for a middleware ({type(middleware_or_callable)})")
                                                            +    return None
                                                            +

                                                            Registers a new middleware to this app. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1887,6 +2521,58 @@ 

                                                            Args

                                                            def options(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def options(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new options listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.options("menu_selection")
                                                            +        def show_menu_options(ack):
                                                            +            options = [
                                                            +                {
                                                            +                    "text": {"type": "plain_text", "text": "Option 1"},
                                                            +                    "value": "1-1",
                                                            +                },
                                                            +                {
                                                            +                    "text": {"type": "plain_text", "text": "Option 2"},
                                                            +                    "value": "1-2",
                                                            +                },
                                                            +            ]
                                                            +            ack(options=options)
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.options("menu_selection")(show_menu_options)
                                                            +
                                                            +    Refer to the following documents for details:
                                                            +
                                                            +    * https://api.slack.com/reference/block-kit/block-elements#external_select
                                                            +    * https://api.slack.com/reference/block-kit/block-elements#external_multi_select
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.options(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new options listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1927,6 +2613,54 @@ 

                                                            Args

                                                            def shortcut(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def shortcut(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new shortcut listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.shortcut("open_modal")
                                                            +        def open_modal(ack, body, client):
                                                            +            # Acknowledge the command request
                                                            +            ack()
                                                            +            # Call views_open with the built-in client
                                                            +            client.views_open(
                                                            +                # Pass a valid trigger_id within 3 seconds of receiving it
                                                            +                trigger_id=body["trigger_id"],
                                                            +                # View payload
                                                            +                view={ ... }
                                                            +            )
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.shortcut("open_modal")(open_modal)
                                                            +
                                                            +    Refer to https://api.slack.com/interactivity/shortcuts for details about Shortcuts.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        constraints: The conditions that match a request payload.
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.shortcut(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new shortcut listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1963,6 +2697,39 @@ 

                                                            Args

                                                            def start(self,
                                                            port: int = 3000,
                                                            path: str = '/slack/events',
                                                            http_server_logger_enabled: bool = True) ‑> None
                                                            +
                                                            + +Expand source code + +
                                                            def start(
                                                            +    self,
                                                            +    port: int = 3000,
                                                            +    path: str = "/slack/events",
                                                            +    http_server_logger_enabled: bool = True,
                                                            +) -> None:
                                                            +    """Starts a web server for local development.
                                                            +
                                                            +        # With the default settings, `http://localhost:3000/slack/events`
                                                            +        # is available for handling incoming requests from Slack
                                                            +        app.start()
                                                            +
                                                            +    This method internally starts a Web server process built with the `http.server` module.
                                                            +    For production, consider using a production-ready WSGI server such as Gunicorn.
                                                            +
                                                            +    Args:
                                                            +        port: The port to listen on (Default: 3000)
                                                            +        path: The path to handle request from Slack (Default: `/slack/events`)
                                                            +        http_server_logger_enabled: The flag to enable http.server logging if True (Default: True)
                                                            +    """
                                                            +    self._development_server = SlackAppDevelopmentServer(
                                                            +        port=port,
                                                            +        path=path,
                                                            +        app=self,
                                                            +        oauth_flow=self.oauth_flow,
                                                            +        http_server_logger_enabled=http_server_logger_enabled,
                                                            +    )
                                                            +    self._development_server.start()
                                                            +

                                                            Starts a web server for local development.

                                                            # With the default settings, `http://localhost:3000/slack/events`
                                                             # is available for handling incoming requests from Slack
                                                            @@ -1984,6 +2751,75 @@ 

                                                            Args

                                                            def step(self,
                                                            callback_id: str | Pattern | WorkflowStep | WorkflowStepBuilder,
                                                            edit: Callable[..., BoltResponse | None] | Listener | Sequence[Callable] | None = None,
                                                            save: Callable[..., BoltResponse | None] | Listener | Sequence[Callable] | None = None,
                                                            execute: Callable[..., BoltResponse | None] | Listener | Sequence[Callable] | None = None)
                                                            +
                                                            + +Expand source code + +
                                                            def step(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern, WorkflowStep, WorkflowStepBuilder],
                                                            +    edit: Optional[Union[Callable[..., Optional[BoltResponse]], Listener, Sequence[Callable]]] = None,
                                                            +    save: Optional[Union[Callable[..., Optional[BoltResponse]], Listener, Sequence[Callable]]] = None,
                                                            +    execute: Optional[Union[Callable[..., Optional[BoltResponse]], Listener, Sequence[Callable]]] = None,
                                                            +):
                                                            +    """
                                                            +    Deprecated:
                                                            +        Steps from apps for legacy workflows are now deprecated.
                                                            +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                            +
                                                            +    Registers a new step from app listener.
                                                            +
                                                            +    Unlike others, this method doesn't behave as a decorator.
                                                            +    If you want to register a step from app by a decorator, use `WorkflowStepBuilder`'s methods.
                                                            +
                                                            +        # Create a new WorkflowStep instance
                                                            +        from slack_bolt.workflows.step import WorkflowStep
                                                            +        ws = WorkflowStep(
                                                            +            callback_id="add_task",
                                                            +            edit=edit,
                                                            +            save=save,
                                                            +            execute=execute,
                                                            +        )
                                                            +        # Pass Step to set up listeners
                                                            +        app.step(ws)
                                                            +
                                                            +    Refer to https://api.slack.com/workflows/steps for details of steps from apps.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    For further information about WorkflowStep specific function arguments
                                                            +    such as `configure`, `update`, `complete`, and `fail`,
                                                            +    refer to `slack_bolt.workflows.step.utilities` API documents.
                                                            +
                                                            +    Args:
                                                            +        callback_id: The Callback ID for this step from app
                                                            +        edit: The function for displaying a modal in the Workflow Builder
                                                            +        save: The function for handling configuration in the Workflow Builder
                                                            +        execute: The function for handling the step execution
                                                            +    """
                                                            +    warnings.warn(
                                                            +        (
                                                            +            "Steps from apps for legacy workflows are now deprecated. "
                                                            +            "Use new custom steps: https://api.slack.com/automation/functions/custom-bolt"
                                                            +        ),
                                                            +        category=DeprecationWarning,
                                                            +    )
                                                            +    step = callback_id
                                                            +    if isinstance(callback_id, (str, Pattern)):
                                                            +        step = WorkflowStep(
                                                            +            callback_id=callback_id,
                                                            +            edit=edit,  # type: ignore[arg-type]
                                                            +            save=save,  # type: ignore[arg-type]
                                                            +            execute=execute,  # type: ignore[arg-type]
                                                            +            base_logger=self._base_logger,
                                                            +        )
                                                            +    elif isinstance(step, WorkflowStepBuilder):
                                                            +        step = step.build(base_logger=self._base_logger)
                                                            +    elif not isinstance(step, WorkflowStep):
                                                            +        raise BoltError(f"Invalid step object ({type(step)})")
                                                            +
                                                            +    self.use(WorkflowStepMiddleware(step))
                                                            +

                                                            Deprecated

                                                            Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                            @@ -2022,6 +2858,16 @@

                                                            Args

                                                            def use(self, *args) ‑> Callable | None
                                                            +
                                                            + +Expand source code + +
                                                            def use(self, *args) -> Optional[Callable]:
                                                            +    """Registers a new global middleware to this app. This method can be used as either a decorator or a method.
                                                            +
                                                            +    Refer to `App#middleware()` method's docstring for details."""
                                                            +    return self.middleware(*args)
                                                            +

                                                            Registers a new global middleware to this app. This method can be used as either a decorator or a method.

                                                            Refer to App#middleware() method's docstring for details.

                                                            @@ -2029,6 +2875,58 @@

                                                            Args

                                                            def view(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def view(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `view_submission`/`view_closed` event listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.view("view_1")
                                                            +        def handle_submission(ack, body, client, view):
                                                            +            # Assume there's an input block with `block_c` as the block_id and `dreamy_input`
                                                            +            hopes_and_dreams = view["state"]["values"]["block_c"]["dreamy_input"]
                                                            +            user = body["user"]["id"]
                                                            +            # Validate the inputs
                                                            +            errors = {}
                                                            +            if hopes_and_dreams is not None and len(hopes_and_dreams) <= 5:
                                                            +                errors["block_c"] = "The value must be longer than 5 characters"
                                                            +            if len(errors) > 0:
                                                            +                ack(response_action="errors", errors=errors)
                                                            +                return
                                                            +            # Acknowledge the view_submission event and close the modal
                                                            +            ack()
                                                            +            # Do whatever you want with the input data - here we're saving it to a DB
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.view("view_1")(handle_submission)
                                                            +
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/views for details of payloads.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        constraints: The conditions that match a request payload
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.view(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new view_submission/view_closed event listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -2069,6 +2967,26 @@ 

                                                            Args

                                                            def view_closed(self,
                                                            constraints: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def view_closed(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `view_closed` listener.
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/views#view_closed for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.view_closed(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new view_closed listener. Refer to https://api.slack.com/reference/interaction-payloads/views#view_closed for details.

                                                            @@ -2076,6 +2994,26 @@

                                                            Args

                                                            def view_submission(self,
                                                            constraints: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def view_submission(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `view_submission` listener.
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/views#view_submission for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.view_submission(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new view_submission listener. Refer to https://api.slack.com/reference/interaction-payloads/views#view_submission for details.

                                                            @@ -2086,26 +3024,6 @@

                                                            Args

                                                            (port: int,
                                                            path: str,
                                                            app: App,
                                                            oauth_flow: OAuthFlow | None = None,
                                                            http_server_logger_enabled: bool = True)
                                                            -

                                                            Slack App Development Server

                                                            -

                                                            This is a thin wrapper of http.server.HTTPServer and is good enough -for your local development or prototyping.

                                                            -

                                                            However, as mentioned in Python official documents, using http.server module in production -is not recommended. Please consider using an adapter (refer to slack_bolt.adapter.*) -along with a production-grade server when running the app for end users. -https://docs.python.org/3/library/http.server.html#http.server.HTTPServer

                                                            -

                                                            Args

                                                            -
                                                            -
                                                            port
                                                            -
                                                            the port number
                                                            -
                                                            path
                                                            -
                                                            the path to receive incoming requests
                                                            -
                                                            app
                                                            -
                                                            the App instance to execute
                                                            -
                                                            oauth_flow
                                                            -
                                                            the OAuthFlow instance to use for OAuth flow
                                                            -
                                                            http_server_logger_enabled
                                                            -
                                                            The flag to turn on/off http.server's logging
                                                            -
                                                            Expand source code @@ -2235,12 +3153,48 @@

                                                            Args

                                                            finally: self._server.server_close()
                                                            +

                                                            Slack App Development Server

                                                            +

                                                            This is a thin wrapper of http.server.HTTPServer and is good enough +for your local development or prototyping.

                                                            +

                                                            However, as mentioned in Python official documents, using http.server module in production +is not recommended. Please consider using an adapter (refer to slack_bolt.adapter.*) +along with a production-grade server when running the app for end users. +https://docs.python.org/3/library/http.server.html#http.server.HTTPServer

                                                            +

                                                            Args

                                                            +
                                                            +
                                                            port
                                                            +
                                                            the port number
                                                            +
                                                            path
                                                            +
                                                            the path to receive incoming requests
                                                            +
                                                            app
                                                            +
                                                            the App instance to execute
                                                            +
                                                            oauth_flow
                                                            +
                                                            the OAuthFlow instance to use for OAuth flow
                                                            +
                                                            http_server_logger_enabled
                                                            +
                                                            The flag to turn on/off http.server's logging
                                                            +

                                                            Methods

                                                            def start(self) ‑> None
                                                            +
                                                            + +Expand source code + +
                                                            def start(self) -> None:
                                                            +    """Starts a new web server process."""
                                                            +    if self._bolt_app.logger.level > logging.INFO:
                                                            +        print(get_boot_message(development_server=True))
                                                            +    else:
                                                            +        self._bolt_app.logger.info(get_boot_message(development_server=True))
                                                            +
                                                            +    try:
                                                            +        self._server.serve_forever(0.05)
                                                            +    finally:
                                                            +        self._server.server_close()
                                                            +

                                                            Starts a new web server process.

                                                            @@ -2312,7 +3266,7 @@

                                                            -

                                                            Generated by pdoc 0.11.3.

                                                            +

                                                            Generated by pdoc 0.11.5.

                                                            diff --git a/docs/static/api-docs/slack_bolt/app/async_app.html b/docs/static/api-docs/slack_bolt/app/async_app.html index a96fd470..f1bdcf2c 100644 --- a/docs/static/api-docs/slack_bolt/app/async_app.html +++ b/docs/static/api-docs/slack_bolt/app/async_app.html @@ -3,19 +3,30 @@ - + slack_bolt.app.async_app API documentation - + @@ -40,96 +51,6 @@

                                                            Classes

                                                            (*,
                                                            logger: logging.Logger | None = None,
                                                            name: str | None = None,
                                                            process_before_response: bool = False,
                                                            raise_error_for_unhandled_request: bool = False,
                                                            signing_secret: str | None = None,
                                                            token: str | None = None,
                                                            client: slack_sdk.web.async_client.AsyncWebClient | None = None,
                                                            before_authorize: AsyncMiddleware | Callable[..., Awaitable[Any]] | None = None,
                                                            authorize: Callable[..., Awaitable[AuthorizeResult]] | None = None,
                                                            user_facing_authorize_error_message: str | None = None,
                                                            installation_store: slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore | None = None,
                                                            installation_store_bot_only: bool | None = None,
                                                            request_verification_enabled: bool = True,
                                                            ignoring_self_events_enabled: bool = True,
                                                            ignoring_self_assistant_message_events_enabled: bool = True,
                                                            ssl_check_enabled: bool = True,
                                                            url_verification_enabled: bool = True,
                                                            attaching_function_token_enabled: bool = True,
                                                            oauth_settings: AsyncOAuthSettings | None = None,
                                                            oauth_flow: AsyncOAuthFlow | None = None,
                                                            verification_token: str | None = None,
                                                            assistant_thread_context_store: AsyncAssistantThreadContextStore | None = None)
                                                            -

                                                            Bolt App that provides functionalities to register middleware/listeners.

                                                            -
                                                            import os
                                                            -from slack_bolt.async_app import AsyncApp
                                                            -
                                                            -# Initializes your app with your bot token and signing secret
                                                            -app = AsyncApp(
                                                            -    token=os.environ.get("SLACK_BOT_TOKEN"),
                                                            -    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
                                                            -)
                                                            -
                                                            -# Listens to incoming messages that contain "hello"
                                                            -@app.message("hello")
                                                            -async def message_hello(message, say):  # async function
                                                            -    # say() sends a message to the channel where the event was triggered
                                                            -    await say(f"Hey there <@{message['user']}>!")
                                                            -
                                                            -# Start your app
                                                            -if __name__ == "__main__":
                                                            -    app.start(port=int(os.environ.get("PORT", 3000)))
                                                            -
                                                            -

                                                            Refer to https://slack.dev/bolt-python/concepts#async for details.

                                                            -

                                                            If you would like to build an OAuth app for enabling the app to run with multiple workspaces, -refer to https://slack.dev/bolt-python/concepts#authenticating-oauth to learn how to configure the app.

                                                            -

                                                            Args

                                                            -
                                                            -
                                                            logger
                                                            -
                                                            The custom logger that can be used in this app.
                                                            -
                                                            name
                                                            -
                                                            The application name that will be used in logging. If absent, the source file name will be used.
                                                            -
                                                            process_before_response
                                                            -
                                                            True if this app runs on Function as a Service. (Default: False)
                                                            -
                                                            raise_error_for_unhandled_request
                                                            -
                                                            True if you want to raise exceptions for unhandled requests -and use @app.error listeners instead of -the built-in handler, which pints warning logs and returns 404 to Slack (Default: False)
                                                            -
                                                            signing_secret
                                                            -
                                                            The Signing Secret value used for verifying requests from Slack.
                                                            -
                                                            token
                                                            -
                                                            The bot/user access token required only for single-workspace app.
                                                            -
                                                            client
                                                            -
                                                            The singleton slack_sdk.web.async_client.AsyncWebClient instance for this app.
                                                            -
                                                            before_authorize
                                                            -
                                                            A global middleware that can be executed right before authorize function
                                                            -
                                                            authorize
                                                            -
                                                            The function to authorize an incoming request from Slack -by checking if there is a team/user in the installation data.
                                                            -
                                                            user_facing_authorize_error_message
                                                            -
                                                            The user-facing error message to display -when the app is installed but the installation is not managed by this app's installation store
                                                            -
                                                            installation_store
                                                            -
                                                            The module offering save/find operations of installation data
                                                            -
                                                            installation_store_bot_only
                                                            -
                                                            Use AsyncInstallationStore#async_find_bot() if True (Default: False)
                                                            -
                                                            request_verification_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -AsyncRequestVerification is a built-in middleware that verifies the signature in HTTP Mode requests. -Make sure if it's safe enough when you turn a built-in middleware off. -We strongly recommend using RequestVerification for better security. -If you have a proxy that verifies request signature in front of the Bolt app, -it's totally fine to disable RequestVerification to avoid duplication of work. -Don't turn it off just for easiness of development.
                                                            -
                                                            ignoring_self_events_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -AsyncIgnoringSelfEvents is a built-in middleware that enables Bolt apps to easily skip the events -generated by this app's bot user (this is useful for avoiding code error causing an infinite loop).
                                                            -
                                                            ignoring_self_assistant_message_events_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware. -IgnoringSelfEvents for this app's bot user message events within an assistant thread -This is useful for avoiding code error causing an infinite loop; Default: True
                                                            -
                                                            url_verification_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -AsyncUrlVerification is a built-in middleware that handles url_verification requests -that verify the endpoint for Events API in HTTP Mode requests.
                                                            -
                                                            ssl_check_enabled
                                                            -
                                                            bool = False if you would like to disable the built-in middleware (Default: True). -AsyncSslCheck is a built-in middleware that handles ssl_check requests from Slack.
                                                            -
                                                            attaching_function_token_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -AsyncAttachingFunctionToken is a built-in middleware that injects the just-in-time workflow-execution token -when your app receives function_executed or interactivity events scoped to a custom step.
                                                            -
                                                            oauth_settings
                                                            -
                                                            The settings related to Slack app installation flow (OAuth flow)
                                                            -
                                                            oauth_flow
                                                            -
                                                            Instantiated slack_bolt.oauth.AsyncOAuthFlow. This is always prioritized over oauth_settings.
                                                            -
                                                            verification_token
                                                            -
                                                            Deprecated verification mechanism. This can be used only for ssl_check requests.
                                                            -
                                                            assistant_thread_context_store
                                                            -
                                                            Custom AssistantThreadContext store (Default: the built-in implementation, -which uses a parent message's metadata to store the latest context)
                                                            -
                                                            Expand source code @@ -1525,18 +1446,107 @@

                                                            Args

                                                            return value_to_return

                                                            +

                                                            Bolt App that provides functionalities to register middleware/listeners.

                                                            +
                                                            import os
                                                            +from slack_bolt.async_app import AsyncApp
                                                            +
                                                            +# Initializes your app with your bot token and signing secret
                                                            +app = AsyncApp(
                                                            +    token=os.environ.get("SLACK_BOT_TOKEN"),
                                                            +    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
                                                            +)
                                                            +
                                                            +# Listens to incoming messages that contain "hello"
                                                            +@app.message("hello")
                                                            +async def message_hello(message, say):  # async function
                                                            +    # say() sends a message to the channel where the event was triggered
                                                            +    await say(f"Hey there <@{message['user']}>!")
                                                            +
                                                            +# Start your app
                                                            +if __name__ == "__main__":
                                                            +    app.start(port=int(os.environ.get("PORT", 3000)))
                                                            +
                                                            +

                                                            Refer to https://slack.dev/bolt-python/concepts#async for details.

                                                            +

                                                            If you would like to build an OAuth app for enabling the app to run with multiple workspaces, +refer to https://slack.dev/bolt-python/concepts#authenticating-oauth to learn how to configure the app.

                                                            +

                                                            Args

                                                            +
                                                            +
                                                            logger
                                                            +
                                                            The custom logger that can be used in this app.
                                                            +
                                                            name
                                                            +
                                                            The application name that will be used in logging. If absent, the source file name will be used.
                                                            +
                                                            process_before_response
                                                            +
                                                            True if this app runs on Function as a Service. (Default: False)
                                                            +
                                                            raise_error_for_unhandled_request
                                                            +
                                                            True if you want to raise exceptions for unhandled requests +and use @app.error listeners instead of +the built-in handler, which pints warning logs and returns 404 to Slack (Default: False)
                                                            +
                                                            signing_secret
                                                            +
                                                            The Signing Secret value used for verifying requests from Slack.
                                                            +
                                                            token
                                                            +
                                                            The bot/user access token required only for single-workspace app.
                                                            +
                                                            client
                                                            +
                                                            The singleton slack_sdk.web.async_client.AsyncWebClient instance for this app.
                                                            +
                                                            before_authorize
                                                            +
                                                            A global middleware that can be executed right before authorize function
                                                            +
                                                            authorize
                                                            +
                                                            The function to authorize an incoming request from Slack +by checking if there is a team/user in the installation data.
                                                            +
                                                            user_facing_authorize_error_message
                                                            +
                                                            The user-facing error message to display +when the app is installed but the installation is not managed by this app's installation store
                                                            +
                                                            installation_store
                                                            +
                                                            The module offering save/find operations of installation data
                                                            +
                                                            installation_store_bot_only
                                                            +
                                                            Use AsyncInstallationStore#async_find_bot() if True (Default: False)
                                                            +
                                                            request_verification_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +AsyncRequestVerification is a built-in middleware that verifies the signature in HTTP Mode requests. +Make sure if it's safe enough when you turn a built-in middleware off. +We strongly recommend using RequestVerification for better security. +If you have a proxy that verifies request signature in front of the Bolt app, +it's totally fine to disable RequestVerification to avoid duplication of work. +Don't turn it off just for easiness of development.
                                                            +
                                                            ignoring_self_events_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +AsyncIgnoringSelfEvents is a built-in middleware that enables Bolt apps to easily skip the events +generated by this app's bot user (this is useful for avoiding code error causing an infinite loop).
                                                            +
                                                            ignoring_self_assistant_message_events_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware. +IgnoringSelfEvents for this app's bot user message events within an assistant thread +This is useful for avoiding code error causing an infinite loop; Default: True
                                                            +
                                                            url_verification_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +AsyncUrlVerification is a built-in middleware that handles url_verification requests +that verify the endpoint for Events API in HTTP Mode requests.
                                                            +
                                                            ssl_check_enabled
                                                            +
                                                            bool = False if you would like to disable the built-in middleware (Default: True). +AsyncSslCheck is a built-in middleware that handles ssl_check requests from Slack.
                                                            +
                                                            attaching_function_token_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +AsyncAttachingFunctionToken is a built-in middleware that injects the just-in-time workflow-execution token +when your app receives function_executed or interactivity events scoped to a custom step.
                                                            +
                                                            oauth_settings
                                                            +
                                                            The settings related to Slack app installation flow (OAuth flow)
                                                            +
                                                            oauth_flow
                                                            +
                                                            Instantiated slack_bolt.oauth.AsyncOAuthFlow. This is always prioritized over oauth_settings.
                                                            +
                                                            verification_token
                                                            +
                                                            Deprecated verification mechanism. This can be used only for ssl_check requests.
                                                            +
                                                            assistant_thread_context_store
                                                            +
                                                            Custom AssistantThreadContext store (Default: the built-in implementation, +which uses a parent message's metadata to store the latest context)
                                                            +

                                                            Class variables

                                                            var AsyncSlackAppServer
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            Instance variables

                                                            prop client : slack_sdk.web.async_client.AsyncWebClient
                                                            -

                                                            The singleton slack_sdk.web.async_client.AsyncWebClient instance in this app.

                                                            Expand source code @@ -1546,10 +1556,10 @@

                                                            Instance variables

                                                            """The singleton `slack_sdk.web.async_client.AsyncWebClient` instance in this app.""" return self._async_client
                                                            +

                                                            The singleton slack_sdk.web.async_client.AsyncWebClient instance in this app.

                                                            prop installation_store : slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore | None
                                                            -

                                                            The slack_sdk.oauth.AsyncInstallationStore that can be used in the authorize middleware.

                                                            Expand source code @@ -1559,10 +1569,10 @@

                                                            Instance variables

                                                            """The `slack_sdk.oauth.AsyncInstallationStore` that can be used in the `authorize` middleware.""" return self._async_installation_store
                                                            +

                                                            The slack_sdk.oauth.AsyncInstallationStore that can be used in the authorize middleware.

                                                            prop listener_runnerAsyncioListenerRunner
                                                            -

                                                            The asyncio-based executor for asynchronously running listeners.

                                                            Expand source code @@ -1572,10 +1582,10 @@

                                                            Instance variables

                                                            """The asyncio-based executor for asynchronously running listeners.""" return self._async_listener_runner
                                                            +

                                                            The asyncio-based executor for asynchronously running listeners.

                                                            prop logger : logging.Logger
                                                            -

                                                            The logger this app uses.

                                                            Expand source code @@ -1585,10 +1595,10 @@

                                                            Instance variables

                                                            """The logger this app uses.""" return self._framework_logger
                                                            +

                                                            The logger this app uses.

                                                            prop name : str
                                                            -

                                                            The name of this app (default: the filename)

                                                            Expand source code @@ -1598,10 +1608,10 @@

                                                            Instance variables

                                                            """The name of this app (default: the filename)""" return self._name
                                                            +

                                                            The name of this app (default: the filename)

                                                            prop oauth_flowAsyncOAuthFlow | None
                                                            -

                                                            Configured OAuthFlow object if exists.

                                                            Expand source code @@ -1611,10 +1621,10 @@

                                                            Instance variables

                                                            """Configured `OAuthFlow` object if exists.""" return self._async_oauth_flow
                                                            +

                                                            Configured OAuthFlow object if exists.

                                                            prop process_before_response : bool
                                                            -
                                                            Expand source code @@ -1623,6 +1633,7 @@

                                                            Instance variables

                                                            def process_before_response(self) -> bool: return self._process_before_response or False
                                                            +

                                                            Methods

                                                            @@ -1631,6 +1642,47 @@

                                                            Methods

                                                            def action(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def action(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new action listener. This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.action("approve_button")
                                                            +        async def update_message(ack):
                                                            +            await ack()
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.action("approve_button")(update_message)
                                                            +
                                                            +    * Refer to https://api.slack.com/reference/interaction-payloads/block-actions for actions in `blocks`.
                                                            +    * Refer to https://api.slack.com/legacy/message-buttons for actions in `attachments`.
                                                            +    * Refer to https://api.slack.com/dialogs for actions in dialogs.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        constraints: The conditions that match a request payload
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.action(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new action listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                             @app.action("approve_button")
                                                            @@ -1662,12 +1714,134 @@ 

                                                            Args

                                                            def assistant(self,
                                                            assistant: AsyncAssistant) ‑> Callable | None
                                                            +
                                                            + +Expand source code + +
                                                            def assistant(self, assistant: AsyncAssistant) -> Optional[Callable]:
                                                            +    return self.middleware(assistant)
                                                            +
                                                            async def async_dispatch(self,
                                                            req: AsyncBoltRequest) ‑> BoltResponse
                                                            +
                                                            + +Expand source code + +
                                                            async def async_dispatch(self, req: AsyncBoltRequest) -> BoltResponse:
                                                            +    """Applies all middleware and dispatches an incoming request from Slack to the right code path.
                                                            +
                                                            +    Args:
                                                            +        req: An incoming request from Slack.
                                                            +
                                                            +    Returns:
                                                            +        The response generated by this Bolt app.
                                                            +    """
                                                            +    starting_time = time.time()
                                                            +    self._init_context(req)
                                                            +
                                                            +    resp: Optional[BoltResponse] = BoltResponse(status=200, body="")
                                                            +    middleware_state = {"next_called": False}
                                                            +
                                                            +    async def async_middleware_next():
                                                            +        middleware_state["next_called"] = True
                                                            +
                                                            +    try:
                                                            +        for middleware in self._async_middleware_list:
                                                            +            middleware_state["next_called"] = False
                                                            +            if self._framework_logger.level <= logging.DEBUG:
                                                            +                self._framework_logger.debug(f"Applying {middleware.name}")
                                                            +            resp = await middleware.async_process(
                                                            +                req=req, resp=resp, next=async_middleware_next  # type: ignore[arg-type]
                                                            +            )
                                                            +            if not middleware_state["next_called"]:
                                                            +                if resp is None:
                                                            +                    # next() method was not called without providing the response to return to Slack
                                                            +                    # This should not be an intentional handling in usual use cases.
                                                            +                    resp = BoltResponse(status=404, body={"error": "no next() calls in middleware"})
                                                            +                    if self._raise_error_for_unhandled_request is True:
                                                            +                        try:
                                                            +                            raise BoltUnhandledRequestError(
                                                            +                                request=req,
                                                            +                                current_response=resp,
                                                            +                                last_global_middleware_name=middleware.name,
                                                            +                            )
                                                            +                        except BoltUnhandledRequestError as e:
                                                            +                            await self._async_listener_runner.listener_error_handler.handle(
                                                            +                                error=e,
                                                            +                                request=req,
                                                            +                                response=resp,
                                                            +                            )
                                                            +                        return resp
                                                            +                    self._framework_logger.warning(warning_unhandled_by_global_middleware(middleware.name, req))
                                                            +                    return resp
                                                            +                return resp
                                                            +
                                                            +        for listener in self._async_listeners:
                                                            +            listener_name = get_name_for_callable(listener.ack_function)
                                                            +            self._framework_logger.debug(debug_checking_listener(listener_name))
                                                            +            if await listener.async_matches(req=req, resp=resp):  # type: ignore[arg-type]
                                                            +                # run all the middleware attached to this listener first
                                                            +                (middleware_resp, next_was_not_called) = await listener.run_async_middleware(
                                                            +                    req=req, resp=resp  # type: ignore[arg-type]
                                                            +                )
                                                            +                if next_was_not_called:
                                                            +                    if middleware_resp is not None:
                                                            +                        if self._framework_logger.level <= logging.DEBUG:
                                                            +                            debug_message = debug_return_listener_middleware_response(
                                                            +                                listener_name,
                                                            +                                middleware_resp.status,
                                                            +                                middleware_resp.body,
                                                            +                                starting_time,
                                                            +                            )
                                                            +                            self._framework_logger.debug(debug_message)
                                                            +                        return middleware_resp
                                                            +                    # The last listener middleware didn't call next() method.
                                                            +                    # This means the listener is not for this incoming request.
                                                            +                    continue
                                                            +
                                                            +                if middleware_resp is not None:
                                                            +                    resp = middleware_resp
                                                            +
                                                            +                self._framework_logger.debug(debug_running_listener(listener_name))
                                                            +                listener_response: Optional[BoltResponse] = await self._async_listener_runner.run(
                                                            +                    request=req,
                                                            +                    response=resp,  # type: ignore[arg-type]
                                                            +                    listener_name=listener_name,
                                                            +                    listener=listener,
                                                            +                )
                                                            +                if listener_response is not None:
                                                            +                    return listener_response
                                                            +
                                                            +        if resp is None:
                                                            +            resp = BoltResponse(status=404, body={"error": "unhandled request"})
                                                            +        if self._raise_error_for_unhandled_request is True:
                                                            +            try:
                                                            +                raise BoltUnhandledRequestError(
                                                            +                    request=req,
                                                            +                    current_response=resp,
                                                            +                )
                                                            +            except BoltUnhandledRequestError as e:
                                                            +                await self._async_listener_runner.listener_error_handler.handle(
                                                            +                    error=e,
                                                            +                    request=req,
                                                            +                    response=resp,
                                                            +                )
                                                            +            return resp
                                                            +        return self._handle_unmatched_requests(req, resp)
                                                            +
                                                            +    except Exception as error:
                                                            +        resp = BoltResponse(status=500, body="")
                                                            +        await self._async_middleware_error_handler.handle(
                                                            +            error=error,
                                                            +            request=req,
                                                            +            response=resp,
                                                            +        )
                                                            +        return resp
                                                            +

                                                            Applies all middleware and dispatches an incoming request from Slack to the right code path.

                                                            Args

                                                            @@ -1681,6 +1855,26 @@

                                                            Returns

                                                            def attachment_action(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def attachment_action(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `interactive_message` action listener.
                                                            +    Refer to https://api.slack.com/legacy/message-buttons for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.attachment_action(callback_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new interactive_message action listener. Refer to https://api.slack.com/legacy/message-buttons for details.

                                                            @@ -1688,6 +1882,27 @@

                                                            Returns

                                                            def block_action(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def block_action(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `block_actions` action listener.
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/block-actions for details.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.block_action(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new block_actions action listener. Refer to https://api.slack.com/reference/interaction-payloads/block-actions for details.

                                                            @@ -1695,12 +1910,73 @@

                                                            Returns

                                                            def block_suggestion(self,
                                                            action_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def block_suggestion(
                                                            +    self,
                                                            +    action_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `block_suggestion` listener."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.block_suggestion(action_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new block_suggestion listener.

                                                            def command(self,
                                                            command: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def command(
                                                            +    self,
                                                            +    command: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new slash command listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.command("/echo")
                                                            +        async def repeat_text(ack, say, command):
                                                            +            # Acknowledge command request
                                                            +            await ack()
                                                            +            await say(f"{command['text']}")
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.command("/echo")(repeat_text)
                                                            +
                                                            +    Refer to https://api.slack.com/interactivity/slash-commands for details of Slash Commands.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        command: The conditions that match a request payload
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.command(command, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new slash command listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1731,18 +2007,60 @@ 

                                                            Args

                                                            def default_app_uninstalled_event_listener(self) ‑> Callable[..., Awaitable[BoltResponse | None]]
                                                            +
                                                            + +Expand source code + +
                                                            def default_app_uninstalled_event_listener(
                                                            +    self,
                                                            +) -> Callable[..., Awaitable[Optional[BoltResponse]]]:
                                                            +    if self._async_tokens_revocation_listeners is None:
                                                            +        raise BoltError(error_installation_store_required_for_builtin_listeners())
                                                            +    return self._async_tokens_revocation_listeners.handle_app_uninstalled_events
                                                            +
                                                            def default_tokens_revoked_event_listener(self) ‑> Callable[..., Awaitable[BoltResponse | None]]
                                                            +
                                                            + +Expand source code + +
                                                            def default_tokens_revoked_event_listener(
                                                            +    self,
                                                            +) -> Callable[..., Awaitable[Optional[BoltResponse]]]:
                                                            +    if self._async_tokens_revocation_listeners is None:
                                                            +        raise BoltError(error_installation_store_required_for_builtin_listeners())
                                                            +    return self._async_tokens_revocation_listeners.handle_tokens_revoked_events
                                                            +
                                                            def dialog_cancellation(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def dialog_cancellation(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `dialog_submission` listener.
                                                            +    Refer to https://api.slack.com/dialogs for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.dialog_cancellation(callback_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new dialog_submission listener. Refer to https://api.slack.com/dialogs for details.

                                                            @@ -1750,6 +2068,26 @@

                                                            Args

                                                            def dialog_submission(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def dialog_submission(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `dialog_submission` listener.
                                                            +    Refer to https://api.slack.com/dialogs for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.dialog_submission(callback_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new dialog_submission listener. Refer to https://api.slack.com/dialogs for details.

                                                            @@ -1757,6 +2095,26 @@

                                                            Args

                                                            def dialog_suggestion(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def dialog_suggestion(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `dialog_suggestion` listener.
                                                            +    Refer to https://api.slack.com/dialogs for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.dialog_suggestion(callback_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new dialog_suggestion listener. Refer to https://api.slack.com/dialogs for details.

                                                            @@ -1764,12 +2122,57 @@

                                                            Args

                                                            def enable_token_revocation_listeners(self) ‑> None
                                                            +
                                                            + +Expand source code + +
                                                            def enable_token_revocation_listeners(self) -> None:
                                                            +    self.event("tokens_revoked")(self.default_tokens_revoked_event_listener())
                                                            +    self.event("app_uninstalled")(self.default_app_uninstalled_event_listener())
                                                            +
                                                            def error(self,
                                                            func: Callable[..., Awaitable[BoltResponse | None]]) ‑> Callable[..., Awaitable[BoltResponse | None]]
                                                            +
                                                            + +Expand source code + +
                                                            def error(
                                                            +    self, func: Callable[..., Awaitable[Optional[BoltResponse]]]
                                                            +) -> Callable[..., Awaitable[Optional[BoltResponse]]]:
                                                            +    """Updates the global error handler. This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.error
                                                            +        async def custom_error_handler(error, body, logger):
                                                            +            logger.exception(f"Error: {error}")
                                                            +            logger.info(f"Request body: {body}")
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.error(custom_error_handler)
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        func: The function that is supposed to be executed
                                                            +            when getting an unhandled error in Bolt app.
                                                            +    """
                                                            +    if not is_callable_coroutine(func):
                                                            +        name = get_name_for_callable(func)
                                                            +        raise BoltError(error_listener_function_must_be_coro_func(name))
                                                            +    self._async_listener_runner.listener_error_handler = AsyncCustomListenerErrorHandler(
                                                            +        logger=self._framework_logger,
                                                            +        func=func,
                                                            +    )
                                                            +    self._async_middleware_error_handler = AsyncCustomMiddlewareErrorHandler(
                                                            +        logger=self._framework_logger,
                                                            +        func=func,
                                                            +    )
                                                            +    return func
                                                            +

                                                            Updates the global error handler. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                             @app.error
                                                            @@ -1792,6 +2195,53 @@ 

                                                            Args

                                                            def event(self,
                                                            event: str | Pattern | Dict[str, str | Sequence[str | Pattern | None] | None],
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def event(
                                                            +    self,
                                                            +    event: Union[
                                                            +        str,
                                                            +        Pattern,
                                                            +        Dict[str, Optional[Union[str, Sequence[Optional[Union[str, Pattern]]]]]],
                                                            +    ],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new event listener. This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.event("team_join")
                                                            +        async def ask_for_introduction(event, say):
                                                            +            welcome_channel_id = "C12345"
                                                            +            user_id = event["user"]
                                                            +            text = f"Welcome to the team, <@{user_id}>! :tada: You can introduce yourself in this channel."
                                                            +            await say(text=text, channel=welcome_channel_id)
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.event("team_join")(ask_for_introduction)
                                                            +
                                                            +    Refer to https://api.slack.com/apis/connections/events-api for details of Events API.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        event: The conditions that match a request payload.
                                                            +            If you pass a dict for this, you can have type, subtype in the constraint.
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.event(event, True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new event listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                             @app.event("team_join")
                                                            @@ -1823,6 +2273,56 @@ 

                                                            Args

                                                            def function(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None,
                                                            auto_acknowledge: bool = True) ‑> Callable[..., Callable[..., Awaitable[BoltResponse]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def function(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +    auto_acknowledge: bool = True,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[BoltResponse]]]]:
                                                            +    """Registers a new Function listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.function("reverse")
                                                            +        async def reverse_string(ack: AsyncAck, inputs: dict, complete: AsyncComplete, fail: AsyncFail):
                                                            +            try:
                                                            +                await ack()
                                                            +                string_to_reverse = inputs["stringToReverse"]
                                                            +                await complete({"reverseString": string_to_reverse[::-1]})
                                                            +            except Exception as e:
                                                            +                await fail(f"Cannot reverse string (error: {e})")
                                                            +                raise e
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.function("reverse")(reverse_string)
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        callback_id: The callback id to identify the function
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    matchers = list(matchers) if matchers else []
                                                            +    middleware = list(middleware) if middleware else []
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.function_executed(
                                                            +            callback_id=callback_id, base_logger=self._base_logger, asyncio=True
                                                            +        )
                                                            +        return self._register_listener(functions, primary_matcher, matchers, middleware, auto_acknowledge)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new Function listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1856,12 +2356,96 @@ 

                                                            Args

                                                            def global_shortcut(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def global_shortcut(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new global shortcut listener."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.global_shortcut(callback_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new global shortcut listener.

                                                            def message(self,
                                                            keyword: str | Pattern = '',
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def message(
                                                            +    self,
                                                            +    keyword: Union[str, Pattern] = "",
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new message event listener. This method can be used as either a decorator or a method.
                                                            +    Check the `App#event` method's docstring for details.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.message(":wave:")
                                                            +        async def say_hello(message, say):
                                                            +            user = message['user']
                                                            +            await say(f"Hi there, <@{user}>!")
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.message(":wave:")(say_hello)
                                                            +
                                                            +    Refer to https://api.slack.com/events/message for details of `message` events.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        keyword: The keyword to match
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +    matchers = list(matchers) if matchers else []
                                                            +    middleware = list(middleware) if middleware else []
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        constraints = {
                                                            +            "type": "message",
                                                            +            "subtype": (
                                                            +                # In most cases, new message events come with no subtype.
                                                            +                None,
                                                            +                # As of Jan 2021, most bot messages no longer have the subtype bot_message.
                                                            +                # By contrast, messages posted using classic app's bot token still have the subtype.
                                                            +                "bot_message",
                                                            +                # If an end-user posts a message with "Also send to #channel" checked,
                                                            +                # the message event comes with this subtype.
                                                            +                "thread_broadcast",
                                                            +                # If an end-user posts a message with attached files,
                                                            +                # the message event comes with this subtype.
                                                            +                "file_share",
                                                            +            ),
                                                            +        }
                                                            +        primary_matcher = builtin_matchers.message_event(
                                                            +            constraints=constraints,
                                                            +            keyword=keyword,
                                                            +            asyncio=True,
                                                            +            base_logger=self._base_logger,
                                                            +        )
                                                            +        middleware.insert(0, AsyncMessageListenerMatches(keyword))
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new message event listener. This method can be used as either a decorator or a method. Check the App#event method's docstring for details.

                                                            # Use this method as a decorator
                                                            @@ -1891,12 +2475,73 @@ 

                                                            Args

                                                            def message_shortcut(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def message_shortcut(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new message shortcut listener."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.message_shortcut(callback_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new message shortcut listener.

                                                            def middleware(self, *args) ‑> Callable | None
                                                            +
                                                            + +Expand source code + +
                                                            def middleware(self, *args) -> Optional[Callable]:
                                                            +    """Registers a new middleware to this app.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.middleware
                                                            +        async def middleware_func(logger, body, next):
                                                            +            logger.info(f"request body: {body}")
                                                            +            await next()
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.middleware(middleware_func)
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        *args: A function that works as a global middleware.
                                                            +    """
                                                            +    if len(args) > 0:
                                                            +        middleware_or_callable = args[0]
                                                            +        if isinstance(middleware_or_callable, AsyncMiddleware):
                                                            +            middleware: AsyncMiddleware = middleware_or_callable
                                                            +            self._async_middleware_list.append(middleware)
                                                            +            if isinstance(middleware, AsyncAssistant) and middleware.thread_context_store is not None:
                                                            +                self._assistant_thread_context_store = middleware.thread_context_store
                                                            +        elif callable(middleware_or_callable):
                                                            +            self._async_middleware_list.append(
                                                            +                AsyncCustomMiddleware(
                                                            +                    app_name=self.name,
                                                            +                    func=middleware_or_callable,
                                                            +                    base_logger=self._base_logger,
                                                            +                )
                                                            +            )
                                                            +            return middleware_or_callable
                                                            +        else:
                                                            +            raise BoltError(f"Unexpected type for a middleware ({type(middleware_or_callable)})")
                                                            +    return None
                                                            +

                                                            Registers a new middleware to this app. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1919,6 +2564,58 @@ 

                                                            Args

                                                            def options(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def options(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new options listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.options("menu_selection")
                                                            +        async def show_menu_options(ack):
                                                            +            options = [
                                                            +                {
                                                            +                    "text": {"type": "plain_text", "text": "Option 1"},
                                                            +                    "value": "1-1",
                                                            +                },
                                                            +                {
                                                            +                    "text": {"type": "plain_text", "text": "Option 2"},
                                                            +                    "value": "1-2",
                                                            +                },
                                                            +            ]
                                                            +            await ack(options=options)
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.options("menu_selection")(show_menu_options)
                                                            +
                                                            +    Refer to the following documents for details:
                                                            +
                                                            +    * https://api.slack.com/reference/block-kit/block-elements#external_select
                                                            +    * https://api.slack.com/reference/block-kit/block-elements#external_multi_select
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.options(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new options listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1959,6 +2656,33 @@ 

                                                            Args

                                                            def server(self, port: int = 3000, path: str = '/slack/events', host: str | None = None) ‑> AsyncSlackAppServer
                                                            +
                                                            + +Expand source code + +
                                                            def server(
                                                            +    self,
                                                            +    port: int = 3000,
                                                            +    path: str = "/slack/events",
                                                            +    host: Optional[str] = None,
                                                            +) -> AsyncSlackAppServer:
                                                            +    """Configure a web server using AIOHTTP.
                                                            +    Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.
                                                            +
                                                            +    Args:
                                                            +        port: The port to listen on (Default: 3000)
                                                            +        path: The path to handle request from Slack (Default: `/slack/events`)
                                                            +        host: The hostname to serve the web endpoints. (Default: 0.0.0.0)
                                                            +    """
                                                            +    if self._server is None or self._server.port != port or self._server.path != path:
                                                            +        self._server = AsyncSlackAppServer(
                                                            +            port=port,
                                                            +            path=path,
                                                            +            app=self,
                                                            +            host=host,
                                                            +        )
                                                            +    return self._server
                                                            +

                                                            Configure a web server using AIOHTTP. Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.

                                                            Args

                                                            @@ -1975,6 +2699,54 @@

                                                            Args

                                                            def shortcut(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def shortcut(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new shortcut listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.shortcut("open_modal")
                                                            +        async def open_modal(ack, body, client):
                                                            +            # Acknowledge the command request
                                                            +            await ack()
                                                            +            # Call views_open with the built-in client
                                                            +            await client.views_open(
                                                            +                # Pass a valid trigger_id within 3 seconds of receiving it
                                                            +                trigger_id=body["trigger_id"],
                                                            +                # View payload
                                                            +                view={ ... }
                                                            +            )
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.shortcut("open_modal")(open_modal)
                                                            +
                                                            +    Refer to https://api.slack.com/interactivity/shortcuts for details about Shortcuts.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        constraints: The conditions that match a request payload.
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.shortcut(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new shortcut listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -2011,6 +2783,21 @@ 

                                                            Args

                                                            def start(self, port: int = 3000, path: str = '/slack/events', host: str | None = None) ‑> None
                                                            +
                                                            + +Expand source code + +
                                                            def start(self, port: int = 3000, path: str = "/slack/events", host: Optional[str] = None) -> None:
                                                            +    """Start a web server using AIOHTTP.
                                                            +    Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.
                                                            +
                                                            +    Args:
                                                            +        port: The port to listen on (Default: 3000)
                                                            +        path: The path to handle request from Slack (Default: `/slack/events`)
                                                            +        host: The hostname to serve the web endpoints. (Default: 0.0.0.0)
                                                            +    """
                                                            +    self.server(port=port, path=path, host=host).start()
                                                            +

                                                            Start a web server using AIOHTTP. Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.

                                                            Args

                                                            @@ -2027,6 +2814,74 @@

                                                            Args

                                                            def step(self,
                                                            callback_id: str | Pattern | AsyncWorkflowStep | AsyncWorkflowStepBuilder,
                                                            edit: Callable[..., BoltResponse | None] | AsyncListener | Sequence[Callable] | None = None,
                                                            save: Callable[..., BoltResponse | None] | AsyncListener | Sequence[Callable] | None = None,
                                                            execute: Callable[..., BoltResponse | None] | AsyncListener | Sequence[Callable] | None = None)
                                                            +
                                                            + +Expand source code + +
                                                            def step(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern, AsyncWorkflowStep, AsyncWorkflowStepBuilder],
                                                            +    edit: Optional[Union[Callable[..., Optional[BoltResponse]], AsyncListener, Sequence[Callable]]] = None,
                                                            +    save: Optional[Union[Callable[..., Optional[BoltResponse]], AsyncListener, Sequence[Callable]]] = None,
                                                            +    execute: Optional[Union[Callable[..., Optional[BoltResponse]], AsyncListener, Sequence[Callable]]] = None,
                                                            +):
                                                            +    """
                                                            +    Deprecated:
                                                            +        Steps from apps for legacy workflows are now deprecated.
                                                            +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                            +
                                                            +    Registers a new step from app listener.
                                                            +
                                                            +    Unlike others, this method doesn't behave as a decorator.
                                                            +    If you want to register a step from app by a decorator, use `AsyncWorkflowStepBuilder`'s methods.
                                                            +
                                                            +        # Create a new WorkflowStep instance
                                                            +        from slack_bolt.workflows.async_step import AsyncWorkflowStep
                                                            +        ws = AsyncWorkflowStep(
                                                            +            callback_id="add_task",
                                                            +            edit=edit,
                                                            +            save=save,
                                                            +            execute=execute,
                                                            +        )
                                                            +        # Pass Step to set up listeners
                                                            +        app.step(ws)
                                                            +
                                                            +    Refer to https://api.slack.com/workflows/steps for details of steps from apps.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +    For further information about AsyncWorkflowStep specific function arguments
                                                            +    such as `configure`, `update`, `complete`, and `fail`,
                                                            +    refer to the `async` prefixed ones in `slack_bolt.workflows.step.utilities` API documents.
                                                            +
                                                            +    Args:
                                                            +        callback_id: The Callback ID for this step from app
                                                            +        edit: The function for displaying a modal in the Workflow Builder
                                                            +        save: The function for handling configuration in the Workflow Builder
                                                            +        execute: The function for handling the step execution
                                                            +    """
                                                            +    warnings.warn(
                                                            +        (
                                                            +            "Steps from apps for legacy workflows are now deprecated. "
                                                            +            "Use new custom steps: https://api.slack.com/automation/functions/custom-bolt"
                                                            +        ),
                                                            +        category=DeprecationWarning,
                                                            +    )
                                                            +    step = callback_id
                                                            +    if isinstance(callback_id, (str, Pattern)):
                                                            +        step = AsyncWorkflowStep(
                                                            +            callback_id=callback_id,
                                                            +            edit=edit,  # type: ignore[arg-type]
                                                            +            save=save,  # type: ignore[arg-type]
                                                            +            execute=execute,  # type: ignore[arg-type]
                                                            +            base_logger=self._base_logger,
                                                            +        )
                                                            +    elif isinstance(step, AsyncWorkflowStepBuilder):
                                                            +        step = step.build(base_logger=self._base_logger)
                                                            +    elif not isinstance(step, AsyncWorkflowStep):
                                                            +        raise BoltError(f"Invalid step object ({type(step)})")
                                                            +
                                                            +    self.use(AsyncWorkflowStepMiddleware(step))
                                                            +

                                                            Deprecated

                                                            Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                            @@ -2065,12 +2920,72 @@

                                                            Args

                                                            def use(self, *args) ‑> Callable | None
                                                            +
                                                            + +Expand source code + +
                                                            def use(self, *args) -> Optional[Callable]:
                                                            +    """Refer to `AsyncApp#middleware()` method's docstring for details."""
                                                            +    return self.middleware(*args)
                                                            +

                                                            Refer to AsyncApp#middleware() method's docstring for details.

                                                            def view(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def view(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `view_submission`/`view_closed` event listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.view("view_1")
                                                            +        async def handle_submission(ack, body, client, view):
                                                            +            # Assume there's an input block with `block_c` as the block_id and `dreamy_input`
                                                            +            hopes_and_dreams = view["state"]["values"]["block_c"]["dreamy_input"]
                                                            +            user = body["user"]["id"]
                                                            +            # Validate the inputs
                                                            +            errors = {}
                                                            +            if hopes_and_dreams is not None and len(hopes_and_dreams) <= 5:
                                                            +                errors["block_c"] = "The value must be longer than 5 characters"
                                                            +            if len(errors) > 0:
                                                            +                await ack(response_action="errors", errors=errors)
                                                            +                return
                                                            +            # Acknowledge the view_submission event and close the modal
                                                            +            await ack()
                                                            +            # Do whatever you want with the input data - here we're saving it to a DB
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.view("view_1")(handle_submission)
                                                            +
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/views for details of payloads.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        constraints: The conditions that match a request payload
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.view(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new view_submission/view_closed event listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -2111,6 +3026,26 @@ 

                                                            Args

                                                            def view_closed(self,
                                                            constraints: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def view_closed(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `view_closed` listener.
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/views#view_closed for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.view_closed(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new view_closed listener. Refer to https://api.slack.com/reference/interaction-payloads/views#view_closed for details.

                                                            @@ -2118,6 +3053,26 @@

                                                            Args

                                                            def view_submission(self,
                                                            constraints: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def view_submission(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `view_submission` listener.
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/views#view_submission for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.view_submission(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new view_submission listener. Refer to https://api.slack.com/reference/interaction-payloads/views#view_submission for details.

                                                            @@ -2125,6 +3080,32 @@

                                                            Args

                                                            def web_app(self, path: str = '/slack/events', port: int = 3000) ‑> aiohttp.web_app.Application
                                                            +
                                                            + +Expand source code + +
                                                            def web_app(self, path: str = "/slack/events", port: int = 3000) -> web.Application:
                                                            +    """Returns a `web.Application` instance for aiohttp-devtools users.
                                                            +
                                                            +        from slack_bolt.async_app import AsyncApp
                                                            +        app = AsyncApp()
                                                            +
                                                            +        @app.event("app_mention")
                                                            +        async def event_test(body, say, logger):
                                                            +            logger.info(body)
                                                            +            await say("What's up?")
                                                            +
                                                            +        def app_factory():
                                                            +            return app.web_app()
                                                            +
                                                            +        # adev runserver --port 3000 --app-factory app_factory async_app.py
                                                            +
                                                            +    Args:
                                                            +        path: The path to receive incoming requests from Slack
                                                            +        port: The port to listen on (Default: 3000)
                                                            +    """
                                                            +    return self.server(path=path, port=port).web_app
                                                            +

                                                            Returns a web.Application instance for aiohttp-devtools users.

                                                            from slack_bolt.async_app import AsyncApp
                                                             app = AsyncApp()
                                                            @@ -2213,7 +3194,7 @@ 

                                                            -

                                                            Generated by pdoc 0.11.3.

                                                            +

                                                            Generated by pdoc 0.11.5.

                                                            diff --git a/docs/static/api-docs/slack_bolt/app/async_server.html b/docs/static/api-docs/slack_bolt/app/async_server.html index a52a781e..25d28fed 100644 --- a/docs/static/api-docs/slack_bolt/app/async_server.html +++ b/docs/static/api-docs/slack_bolt/app/async_server.html @@ -3,19 +3,30 @@ - + slack_bolt.app.async_server API documentation - + @@ -40,19 +51,6 @@

                                                            Classes

                                                            (port: int, path: str, app: AsyncApp, host: str | None = None)
                                                            -

                                                            Standalone AIOHTTP Web Server. -Refer to https://docs.aiohttp.org/en/stable/web.html for details of AIOHTTP.

                                                            -

                                                            Args

                                                            -
                                                            -
                                                            port
                                                            -
                                                            The port to listen on
                                                            -
                                                            path
                                                            -
                                                            The path to receive incoming requests from Slack
                                                            -
                                                            app
                                                            -
                                                            The AsyncApp instance that is used for processing requests
                                                            -
                                                            host
                                                            -
                                                            The hostname to serve the web endpoints. (Default: 0.0.0.0)
                                                            -
                                                            Expand source code @@ -134,27 +132,40 @@

                                                            Args

                                                            _host = host if host is not None else self.host web.run_app(self.web_app, host=_host, port=self.port)

                                                            +

                                                            Standalone AIOHTTP Web Server. +Refer to https://docs.aiohttp.org/en/stable/web.html for details of AIOHTTP.

                                                            +

                                                            Args

                                                            +
                                                            +
                                                            port
                                                            +
                                                            The port to listen on
                                                            +
                                                            path
                                                            +
                                                            The path to receive incoming requests from Slack
                                                            +
                                                            app
                                                            +
                                                            The AsyncApp instance that is used for processing requests
                                                            +
                                                            host
                                                            +
                                                            The hostname to serve the web endpoints. (Default: 0.0.0.0)
                                                            +

                                                            Class variables

                                                            var bolt_app : AsyncApp
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            var host : str
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            var path : str
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            var port : int
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            var web_app : aiohttp.web_app.Application
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            Methods

                                                            @@ -163,18 +174,64 @@

                                                            Methods

                                                            async def handle_get_requests(self, request: aiohttp.web_request.Request) ‑> aiohttp.web_response.Response
                                                            +
                                                            + +Expand source code + +
                                                            async def handle_get_requests(self, request: web.Request) -> web.Response:
                                                            +    oauth_flow = self._bolt_oauth_flow
                                                            +    if oauth_flow:
                                                            +        if request.path == oauth_flow.install_path:
                                                            +            bolt_req = await to_bolt_request(request)
                                                            +            bolt_resp = await oauth_flow.handle_installation(bolt_req)
                                                            +            return await to_aiohttp_response(bolt_resp)
                                                            +        elif request.path == oauth_flow.redirect_uri_path:
                                                            +            bolt_req = await to_bolt_request(request)
                                                            +            bolt_resp = await oauth_flow.handle_callback(bolt_req)
                                                            +            return await to_aiohttp_response(bolt_resp)
                                                            +        else:
                                                            +            return web.Response(status=404)
                                                            +    else:
                                                            +        return web.Response(status=404)
                                                            +
                                                            async def handle_post_requests(self, request: aiohttp.web_request.Request) ‑> aiohttp.web_response.Response
                                                            +
                                                            + +Expand source code + +
                                                            async def handle_post_requests(self, request: web.Request) -> web.Response:
                                                            +    if self.path != request.path:
                                                            +        return web.Response(status=404)
                                                            +
                                                            +    bolt_req = await to_bolt_request(request)
                                                            +    bolt_resp: BoltResponse = await self.bolt_app.async_dispatch(bolt_req)
                                                            +    return await to_aiohttp_response(bolt_resp)
                                                            +
                                                            def start(self, host: str | None = None) ‑> None
                                                            +
                                                            + +Expand source code + +
                                                            def start(self, host: Optional[str] = None) -> None:
                                                            +    """Starts a new web server process."""
                                                            +    if self.bolt_app.logger.level > logging.INFO:
                                                            +        print(get_boot_message())
                                                            +    else:
                                                            +        self.bolt_app.logger.info(get_boot_message())
                                                            +
                                                            +    _host = host if host is not None else self.host
                                                            +    web.run_app(self.web_app, host=_host, port=self.port)
                                                            +

                                                            Starts a new web server process.

                                                            @@ -213,7 +270,7 @@

                                                            -

                                                            Generated by pdoc 0.11.3.

                                                            +

                                                            Generated by pdoc 0.11.5.

                                                            diff --git a/docs/static/api-docs/slack_bolt/app/index.html b/docs/static/api-docs/slack_bolt/app/index.html index ef174a0a..8d5cbe61 100644 --- a/docs/static/api-docs/slack_bolt/app/index.html +++ b/docs/static/api-docs/slack_bolt/app/index.html @@ -3,19 +3,30 @@ - + slack_bolt.app API documentation - + @@ -59,101 +70,6 @@

                                                            Classes

                                                            (*,
                                                            logger: logging.Logger | None = None,
                                                            name: str | None = None,
                                                            process_before_response: bool = False,
                                                            raise_error_for_unhandled_request: bool = False,
                                                            signing_secret: str | None = None,
                                                            token: str | None = None,
                                                            token_verification_enabled: bool = True,
                                                            client: slack_sdk.web.client.WebClient | None = None,
                                                            before_authorize: Middleware | Callable[..., Any] | None = None,
                                                            authorize: Callable[..., AuthorizeResult] | None = None,
                                                            user_facing_authorize_error_message: str | None = None,
                                                            installation_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore | None = None,
                                                            installation_store_bot_only: bool | None = None,
                                                            request_verification_enabled: bool = True,
                                                            ignoring_self_events_enabled: bool = True,
                                                            ignoring_self_assistant_message_events_enabled: bool = True,
                                                            ssl_check_enabled: bool = True,
                                                            url_verification_enabled: bool = True,
                                                            attaching_function_token_enabled: bool = True,
                                                            oauth_settings: OAuthSettings | None = None,
                                                            oauth_flow: OAuthFlow | None = None,
                                                            verification_token: str | None = None,
                                                            listener_executor: concurrent.futures._base.Executor | None = None,
                                                            assistant_thread_context_store: AssistantThreadContextStore | None = None)
                                                            -

                                                            Bolt App that provides functionalities to register middleware/listeners.

                                                            -
                                                            import os
                                                            -from slack_bolt import App
                                                            -
                                                            -# Initializes your app with your bot token and signing secret
                                                            -app = App(
                                                            -    token=os.environ.get("SLACK_BOT_TOKEN"),
                                                            -    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
                                                            -)
                                                            -
                                                            -# Listens to incoming messages that contain "hello"
                                                            -@app.message("hello")
                                                            -def message_hello(message, say):
                                                            -    # say() sends a message to the channel where the event was triggered
                                                            -    say(f"Hey there <@{message['user']}>!")
                                                            -
                                                            -# Start your app
                                                            -if __name__ == "__main__":
                                                            -    app.start(port=int(os.environ.get("PORT", 3000)))
                                                            -
                                                            -

                                                            Refer to https://slack.dev/bolt-python/tutorial/getting-started for details.

                                                            -

                                                            If you would like to build an OAuth app for enabling the app to run with multiple workspaces, -refer to https://slack.dev/bolt-python/concepts#authenticating-oauth to learn how to configure the app.

                                                            -

                                                            Args

                                                            -
                                                            -
                                                            logger
                                                            -
                                                            The custom logger that can be used in this app.
                                                            -
                                                            name
                                                            -
                                                            The application name that will be used in logging. If absent, the source file name will be used.
                                                            -
                                                            process_before_response
                                                            -
                                                            True if this app runs on Function as a Service. (Default: False)
                                                            -
                                                            raise_error_for_unhandled_request
                                                            -
                                                            True if you want to raise exceptions for unhandled requests -and use @app.error listeners instead of -the built-in handler, which pints warning logs and returns 404 to Slack (Default: False)
                                                            -
                                                            signing_secret
                                                            -
                                                            The Signing Secret value used for verifying requests from Slack.
                                                            -
                                                            token
                                                            -
                                                            The bot/user access token required only for single-workspace app.
                                                            -
                                                            token_verification_enabled
                                                            -
                                                            Verifies the validity of the given token if True.
                                                            -
                                                            client
                                                            -
                                                            The singleton slack_sdk.WebClient instance for this app.
                                                            -
                                                            before_authorize
                                                            -
                                                            A global middleware that can be executed right before authorize function
                                                            -
                                                            authorize
                                                            -
                                                            The function to authorize an incoming request from Slack -by checking if there is a team/user in the installation data.
                                                            -
                                                            user_facing_authorize_error_message
                                                            -
                                                            The user-facing error message to display -when the app is installed but the installation is not managed by this app's installation store
                                                            -
                                                            installation_store
                                                            -
                                                            The module offering save/find operations of installation data
                                                            -
                                                            installation_store_bot_only
                                                            -
                                                            Use InstallationStore#find_bot() if True (Default: False)
                                                            -
                                                            request_verification_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -RequestVerification is a built-in middleware that verifies the signature in HTTP Mode requests. -Make sure if it's safe enough when you turn a built-in middleware off. -We strongly recommend using RequestVerification for better security. -If you have a proxy that verifies request signature in front of the Bolt app, -it's totally fine to disable RequestVerification to avoid duplication of work. -Don't turn it off just for easiness of development.
                                                            -
                                                            ignoring_self_events_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -IgnoringSelfEvents is a built-in middleware that enables Bolt apps to easily skip the events -generated by this app's bot user (this is useful for avoiding code error causing an infinite loop).
                                                            -
                                                            ignoring_self_assistant_message_events_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware. -IgnoringSelfEvents for this app's bot user message events within an assistant thread -This is useful for avoiding code error causing an infinite loop; Default: True
                                                            -
                                                            url_verification_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -UrlVerification is a built-in middleware that handles url_verification requests -that verify the endpoint for Events API in HTTP Mode requests.
                                                            -
                                                            attaching_function_token_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -AttachingFunctionToken is a built-in middleware that injects the just-in-time workflow-execution tokens -when your app receives function_executed or interactivity events scoped to a custom step.
                                                            -
                                                            ssl_check_enabled
                                                            -
                                                            bool = False if you would like to disable the built-in middleware (Default: True). -SslCheck is a built-in middleware that handles ssl_check requests from Slack.
                                                            -
                                                            oauth_settings
                                                            -
                                                            The settings related to Slack app installation flow (OAuth flow)
                                                            -
                                                            oauth_flow
                                                            -
                                                            Instantiated OAuthFlow. This is always prioritized over oauth_settings.
                                                            -
                                                            verification_token
                                                            -
                                                            Deprecated verification mechanism. This can be used only for ssl_check requests.
                                                            -
                                                            listener_executor
                                                            -
                                                            Custom executor to run background tasks. If absent, the default ThreadPoolExecutor will -be used.
                                                            -
                                                            assistant_thread_context_store
                                                            -
                                                            Custom AssistantThreadContext store (Default: the built-in implementation, -which uses a parent message's metadata to store the latest context)
                                                            -
                                                            Expand source code @@ -1518,11 +1434,105 @@

                                                            Args

                                                            ) return value_to_return

                                                            +

                                                            Bolt App that provides functionalities to register middleware/listeners.

                                                            +
                                                            import os
                                                            +from slack_bolt import App
                                                            +
                                                            +# Initializes your app with your bot token and signing secret
                                                            +app = App(
                                                            +    token=os.environ.get("SLACK_BOT_TOKEN"),
                                                            +    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
                                                            +)
                                                            +
                                                            +# Listens to incoming messages that contain "hello"
                                                            +@app.message("hello")
                                                            +def message_hello(message, say):
                                                            +    # say() sends a message to the channel where the event was triggered
                                                            +    say(f"Hey there <@{message['user']}>!")
                                                            +
                                                            +# Start your app
                                                            +if __name__ == "__main__":
                                                            +    app.start(port=int(os.environ.get("PORT", 3000)))
                                                            +
                                                            +

                                                            Refer to https://slack.dev/bolt-python/tutorial/getting-started for details.

                                                            +

                                                            If you would like to build an OAuth app for enabling the app to run with multiple workspaces, +refer to https://slack.dev/bolt-python/concepts#authenticating-oauth to learn how to configure the app.

                                                            +

                                                            Args

                                                            +
                                                            +
                                                            logger
                                                            +
                                                            The custom logger that can be used in this app.
                                                            +
                                                            name
                                                            +
                                                            The application name that will be used in logging. If absent, the source file name will be used.
                                                            +
                                                            process_before_response
                                                            +
                                                            True if this app runs on Function as a Service. (Default: False)
                                                            +
                                                            raise_error_for_unhandled_request
                                                            +
                                                            True if you want to raise exceptions for unhandled requests +and use @app.error listeners instead of +the built-in handler, which pints warning logs and returns 404 to Slack (Default: False)
                                                            +
                                                            signing_secret
                                                            +
                                                            The Signing Secret value used for verifying requests from Slack.
                                                            +
                                                            token
                                                            +
                                                            The bot/user access token required only for single-workspace app.
                                                            +
                                                            token_verification_enabled
                                                            +
                                                            Verifies the validity of the given token if True.
                                                            +
                                                            client
                                                            +
                                                            The singleton slack_sdk.WebClient instance for this app.
                                                            +
                                                            before_authorize
                                                            +
                                                            A global middleware that can be executed right before authorize function
                                                            +
                                                            authorize
                                                            +
                                                            The function to authorize an incoming request from Slack +by checking if there is a team/user in the installation data.
                                                            +
                                                            user_facing_authorize_error_message
                                                            +
                                                            The user-facing error message to display +when the app is installed but the installation is not managed by this app's installation store
                                                            +
                                                            installation_store
                                                            +
                                                            The module offering save/find operations of installation data
                                                            +
                                                            installation_store_bot_only
                                                            +
                                                            Use InstallationStore#find_bot() if True (Default: False)
                                                            +
                                                            request_verification_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +RequestVerification is a built-in middleware that verifies the signature in HTTP Mode requests. +Make sure if it's safe enough when you turn a built-in middleware off. +We strongly recommend using RequestVerification for better security. +If you have a proxy that verifies request signature in front of the Bolt app, +it's totally fine to disable RequestVerification to avoid duplication of work. +Don't turn it off just for easiness of development.
                                                            +
                                                            ignoring_self_events_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +IgnoringSelfEvents is a built-in middleware that enables Bolt apps to easily skip the events +generated by this app's bot user (this is useful for avoiding code error causing an infinite loop).
                                                            +
                                                            ignoring_self_assistant_message_events_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware. +IgnoringSelfEvents for this app's bot user message events within an assistant thread +This is useful for avoiding code error causing an infinite loop; Default: True
                                                            +
                                                            url_verification_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +UrlVerification is a built-in middleware that handles url_verification requests +that verify the endpoint for Events API in HTTP Mode requests.
                                                            +
                                                            attaching_function_token_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +AttachingFunctionToken is a built-in middleware that injects the just-in-time workflow-execution tokens +when your app receives function_executed or interactivity events scoped to a custom step.
                                                            +
                                                            ssl_check_enabled
                                                            +
                                                            bool = False if you would like to disable the built-in middleware (Default: True). +SslCheck is a built-in middleware that handles ssl_check requests from Slack.
                                                            +
                                                            oauth_settings
                                                            +
                                                            The settings related to Slack app installation flow (OAuth flow)
                                                            +
                                                            oauth_flow
                                                            +
                                                            Instantiated OAuthFlow. This is always prioritized over oauth_settings.
                                                            +
                                                            verification_token
                                                            +
                                                            Deprecated verification mechanism. This can be used only for ssl_check requests.
                                                            +
                                                            listener_executor
                                                            +
                                                            Custom executor to run background tasks. If absent, the default ThreadPoolExecutor will +be used.
                                                            +
                                                            assistant_thread_context_store
                                                            +
                                                            Custom AssistantThreadContext store (Default: the built-in implementation, +which uses a parent message's metadata to store the latest context)
                                                            +

                                                            Instance variables

                                                            prop client : slack_sdk.web.client.WebClient
                                                            -

                                                            The singleton slack_sdk.WebClient instance in this app.

                                                            Expand source code @@ -1532,10 +1542,10 @@

                                                            Instance variables

                                                            """The singleton `slack_sdk.WebClient` instance in this app.""" return self._client
                                                            +

                                                            The singleton slack_sdk.WebClient instance in this app.

                                                            prop installation_store : slack_sdk.oauth.installation_store.installation_store.InstallationStore | None
                                                            -

                                                            The slack_sdk.oauth.InstallationStore that can be used in the authorize middleware.

                                                            Expand source code @@ -1545,10 +1555,10 @@

                                                            Instance variables

                                                            """The `slack_sdk.oauth.InstallationStore` that can be used in the `authorize` middleware.""" return self._installation_store
                                                            +

                                                            The slack_sdk.oauth.InstallationStore that can be used in the authorize middleware.

                                                            prop listener_runnerThreadListenerRunner
                                                            -

                                                            The thread executor for asynchronously running listeners.

                                                            Expand source code @@ -1558,10 +1568,10 @@

                                                            Instance variables

                                                            """The thread executor for asynchronously running listeners.""" return self._listener_runner
                                                            +

                                                            The thread executor for asynchronously running listeners.

                                                            prop logger : logging.Logger
                                                            -

                                                            The logger this app uses.

                                                            Expand source code @@ -1571,10 +1581,10 @@

                                                            Instance variables

                                                            """The logger this app uses.""" return self._framework_logger
                                                            +

                                                            The logger this app uses.

                                                            prop name : str
                                                            -

                                                            The name of this app (default: the filename)

                                                            Expand source code @@ -1584,10 +1594,10 @@

                                                            Instance variables

                                                            """The name of this app (default: the filename)""" return self._name
                                                            +

                                                            The name of this app (default: the filename)

                                                            prop oauth_flowOAuthFlow | None
                                                            -

                                                            Configured OAuthFlow object if exists.

                                                            Expand source code @@ -1597,10 +1607,10 @@

                                                            Instance variables

                                                            """Configured `OAuthFlow` object if exists.""" return self._oauth_flow
                                                            +

                                                            Configured OAuthFlow object if exists.

                                                            prop process_before_response : bool
                                                            -
                                                            Expand source code @@ -1609,6 +1619,7 @@

                                                            Instance variables

                                                            def process_before_response(self) -> bool: return self._process_before_response or False
                                                            +

                                                            Methods

                                                            @@ -1617,6 +1628,47 @@

                                                            Methods

                                                            def action(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def action(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new action listener. This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.action("approve_button")
                                                            +        def update_message(ack):
                                                            +            ack()
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.action("approve_button")(update_message)
                                                            +
                                                            +    * Refer to https://api.slack.com/reference/interaction-payloads/block-actions for actions in `blocks`.
                                                            +    * Refer to https://api.slack.com/legacy/message-buttons for actions in `attachments`.
                                                            +    * Refer to https://api.slack.com/dialogs for actions in dialogs.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        constraints: The conditions that match a request payload
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.action(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new action listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                             @app.action("approve_button")
                                                            @@ -1648,12 +1700,39 @@ 

                                                            Args

                                                            def assistant(self,
                                                            assistant: Assistant) ‑> Callable | None
                                                            +
                                                            + +Expand source code + +
                                                            def assistant(self, assistant: Assistant) -> Optional[Callable]:
                                                            +    return self.middleware(assistant)
                                                            +
                                                            def attachment_action(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def attachment_action(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `interactive_message` action listener.
                                                            +    Refer to https://api.slack.com/legacy/message-buttons for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.attachment_action(callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new interactive_message action listener. Refer to https://api.slack.com/legacy/message-buttons for details.

                                                            @@ -1661,6 +1740,27 @@

                                                            Args

                                                            def block_action(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def block_action(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `block_actions` action listener.
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/block-actions for details.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.block_action(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new block_actions action listener. Refer to https://api.slack.com/reference/interaction-payloads/block-actions for details.

                                                            @@ -1668,12 +1768,73 @@

                                                            Args

                                                            def block_suggestion(self,
                                                            action_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def block_suggestion(
                                                            +    self,
                                                            +    action_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `block_suggestion` listener."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.block_suggestion(action_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new block_suggestion listener.

                                                            def command(self,
                                                            command: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def command(
                                                            +    self,
                                                            +    command: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new slash command listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.command("/echo")
                                                            +        def repeat_text(ack, say, command):
                                                            +            # Acknowledge command request
                                                            +            ack()
                                                            +            say(f"{command['text']}")
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.command("/echo")(repeat_text)
                                                            +
                                                            +    Refer to https://api.slack.com/interactivity/slash-commands for details of Slash Commands.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        command: The conditions that match a request payload
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.command(command, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new slash command listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1704,18 +1865,60 @@ 

                                                            Args

                                                            def default_app_uninstalled_event_listener(self) ‑> Callable[..., BoltResponse | None]
                                                            +
                                                            + +Expand source code + +
                                                            def default_app_uninstalled_event_listener(
                                                            +    self,
                                                            +) -> Callable[..., Optional[BoltResponse]]:
                                                            +    if self._tokens_revocation_listeners is None:
                                                            +        raise BoltError(error_installation_store_required_for_builtin_listeners())
                                                            +    return self._tokens_revocation_listeners.handle_app_uninstalled_events
                                                            +
                                                            def default_tokens_revoked_event_listener(self) ‑> Callable[..., BoltResponse | None]
                                                            +
                                                            + +Expand source code + +
                                                            def default_tokens_revoked_event_listener(
                                                            +    self,
                                                            +) -> Callable[..., Optional[BoltResponse]]:
                                                            +    if self._tokens_revocation_listeners is None:
                                                            +        raise BoltError(error_installation_store_required_for_builtin_listeners())
                                                            +    return self._tokens_revocation_listeners.handle_tokens_revoked_events
                                                            +
                                                            def dialog_cancellation(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def dialog_cancellation(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `dialog_cancellation` listener.
                                                            +    Refer to https://api.slack.com/dialogs for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.dialog_cancellation(callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new dialog_cancellation listener. Refer to https://api.slack.com/dialogs for details.

                                                            @@ -1723,6 +1926,26 @@

                                                            Args

                                                            def dialog_submission(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def dialog_submission(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `dialog_submission` listener.
                                                            +    Refer to https://api.slack.com/dialogs for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.dialog_submission(callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new dialog_submission listener. Refer to https://api.slack.com/dialogs for details.

                                                            @@ -1730,6 +1953,26 @@

                                                            Args

                                                            def dialog_suggestion(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def dialog_suggestion(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `dialog_suggestion` listener.
                                                            +    Refer to https://api.slack.com/dialogs for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.dialog_suggestion(callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new dialog_suggestion listener. Refer to https://api.slack.com/dialogs for details.

                                                            @@ -1737,6 +1980,118 @@

                                                            Args

                                                            def dispatch(self,
                                                            req: BoltRequest) ‑> BoltResponse
                                                            +
                                                            + +Expand source code + +
                                                            def dispatch(self, req: BoltRequest) -> BoltResponse:
                                                            +    """Applies all middleware and dispatches an incoming request from Slack to the right code path.
                                                            +
                                                            +    Args:
                                                            +        req: An incoming request from Slack
                                                            +
                                                            +    Returns:
                                                            +        The response generated by this Bolt app
                                                            +    """
                                                            +    starting_time = time.time()
                                                            +    self._init_context(req)
                                                            +
                                                            +    resp: Optional[BoltResponse] = BoltResponse(status=200, body="")
                                                            +    middleware_state = {"next_called": False}
                                                            +
                                                            +    def middleware_next():
                                                            +        middleware_state["next_called"] = True
                                                            +
                                                            +    try:
                                                            +        for middleware in self._middleware_list:
                                                            +            middleware_state["next_called"] = False
                                                            +            if self._framework_logger.level <= logging.DEBUG:
                                                            +                self._framework_logger.debug(debug_applying_middleware(middleware.name))
                                                            +            resp = middleware.process(req=req, resp=resp, next=middleware_next)  # type: ignore[arg-type]
                                                            +            if not middleware_state["next_called"]:
                                                            +                if resp is None:
                                                            +                    # next() method was not called without providing the response to return to Slack
                                                            +                    # This should not be an intentional handling in usual use cases.
                                                            +                    resp = BoltResponse(status=404, body={"error": "no next() calls in middleware"})
                                                            +                    if self._raise_error_for_unhandled_request is True:
                                                            +                        try:
                                                            +                            raise BoltUnhandledRequestError(
                                                            +                                request=req,
                                                            +                                current_response=resp,
                                                            +                                last_global_middleware_name=middleware.name,
                                                            +                            )
                                                            +                        except BoltUnhandledRequestError as e:
                                                            +                            self._listener_runner.listener_error_handler.handle(
                                                            +                                error=e,
                                                            +                                request=req,
                                                            +                                response=resp,
                                                            +                            )
                                                            +                        return resp
                                                            +                    self._framework_logger.warning(warning_unhandled_by_global_middleware(middleware.name, req))
                                                            +                    return resp
                                                            +                return resp
                                                            +
                                                            +        for listener in self._listeners:
                                                            +            listener_name = get_name_for_callable(listener.ack_function)
                                                            +            self._framework_logger.debug(debug_checking_listener(listener_name))
                                                            +            if listener.matches(req=req, resp=resp):  # type: ignore[arg-type]
                                                            +                # run all the middleware attached to this listener first
                                                            +                middleware_resp, next_was_not_called = listener.run_middleware(
                                                            +                    req=req, resp=resp  # type: ignore[arg-type]
                                                            +                )
                                                            +                if next_was_not_called:
                                                            +                    if middleware_resp is not None:
                                                            +                        if self._framework_logger.level <= logging.DEBUG:
                                                            +                            debug_message = debug_return_listener_middleware_response(
                                                            +                                listener_name,
                                                            +                                middleware_resp.status,
                                                            +                                middleware_resp.body,
                                                            +                                starting_time,
                                                            +                            )
                                                            +                            self._framework_logger.debug(debug_message)
                                                            +                        return middleware_resp
                                                            +                    # The last listener middleware didn't call next() method.
                                                            +                    # This means the listener is not for this incoming request.
                                                            +                    continue
                                                            +
                                                            +                if middleware_resp is not None:
                                                            +                    resp = middleware_resp
                                                            +
                                                            +                self._framework_logger.debug(debug_running_listener(listener_name))
                                                            +                listener_response: Optional[BoltResponse] = self._listener_runner.run(
                                                            +                    request=req,
                                                            +                    response=resp,  # type: ignore[arg-type]
                                                            +                    listener_name=listener_name,
                                                            +                    listener=listener,
                                                            +                )
                                                            +                if listener_response is not None:
                                                            +                    return listener_response
                                                            +
                                                            +        if resp is None:
                                                            +            resp = BoltResponse(status=404, body={"error": "unhandled request"})
                                                            +        if self._raise_error_for_unhandled_request is True:
                                                            +            try:
                                                            +                raise BoltUnhandledRequestError(
                                                            +                    request=req,
                                                            +                    current_response=resp,
                                                            +                )
                                                            +            except BoltUnhandledRequestError as e:
                                                            +                self._listener_runner.listener_error_handler.handle(
                                                            +                    error=e,
                                                            +                    request=req,
                                                            +                    response=resp,
                                                            +                )
                                                            +            return resp
                                                            +        return self._handle_unmatched_requests(req, resp)
                                                            +    except Exception as error:
                                                            +        resp = BoltResponse(status=500, body="")
                                                            +        self._middleware_error_handler.handle(
                                                            +            error=error,
                                                            +            request=req,
                                                            +            response=resp,
                                                            +        )
                                                            +        return resp
                                                            +

                                                            Applies all middleware and dispatches an incoming request from Slack to the right code path.

                                                            Args

                                                            @@ -1750,12 +2105,52 @@

                                                            Returns

                                                            def enable_token_revocation_listeners(self) ‑> None
                                                            +
                                                            + +Expand source code + +
                                                            def enable_token_revocation_listeners(self) -> None:
                                                            +    self.event("tokens_revoked")(self.default_tokens_revoked_event_listener())
                                                            +    self.event("app_uninstalled")(self.default_app_uninstalled_event_listener())
                                                            +
                                                            def error(self,
                                                            func: Callable[..., BoltResponse | None]) ‑> Callable[..., BoltResponse | None]
                                                            +
                                                            + +Expand source code + +
                                                            def error(self, func: Callable[..., Optional[BoltResponse]]) -> Callable[..., Optional[BoltResponse]]:
                                                            +    """Updates the global error handler. This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.error
                                                            +        def custom_error_handler(error, body, logger):
                                                            +            logger.exception(f"Error: {error}")
                                                            +            logger.info(f"Request body: {body}")
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.error(custom_error_handler)
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        func: The function that is supposed to be executed
                                                            +            when getting an unhandled error in Bolt app.
                                                            +    """
                                                            +    self._listener_runner.listener_error_handler = CustomListenerErrorHandler(
                                                            +        logger=self._framework_logger,
                                                            +        func=func,
                                                            +    )
                                                            +    self._middleware_error_handler = CustomMiddlewareErrorHandler(
                                                            +        logger=self._framework_logger,
                                                            +        func=func,
                                                            +    )
                                                            +    return func
                                                            +

                                                            Updates the global error handler. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                             @app.error
                                                            @@ -1778,6 +2173,53 @@ 

                                                            Args

                                                            def event(self,
                                                            event: str | Pattern | Dict[str, str | Sequence[str | Pattern | None] | None],
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def event(
                                                            +    self,
                                                            +    event: Union[
                                                            +        str,
                                                            +        Pattern,
                                                            +        Dict[str, Optional[Union[str, Sequence[Optional[Union[str, Pattern]]]]]],
                                                            +    ],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new event listener. This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.event("team_join")
                                                            +        def ask_for_introduction(event, say):
                                                            +            welcome_channel_id = "C12345"
                                                            +            user_id = event["user"]
                                                            +            text = f"Welcome to the team, <@{user_id}>! :tada: You can introduce yourself in this channel."
                                                            +            say(text=text, channel=welcome_channel_id)
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.event("team_join")(ask_for_introduction)
                                                            +
                                                            +    Refer to https://api.slack.com/apis/connections/events-api for details of Events API.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        event: The conditions that match a request payload.
                                                            +            If you pass a dict for this, you can have type, subtype in the constraint.
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.event(event, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new event listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                             @app.event("team_join")
                                                            @@ -1809,6 +2251,54 @@ 

                                                            Args

                                                            def function(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None,
                                                            auto_acknowledge: bool = True) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def function(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +    auto_acknowledge: bool = True,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new Function listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.function("reverse")
                                                            +        def reverse_string(ack: Ack, inputs: dict, complete: Complete, fail: Fail):
                                                            +            try:
                                                            +                ack()
                                                            +                string_to_reverse = inputs["stringToReverse"]
                                                            +                complete(outputs={"reverseString": string_to_reverse[::-1]})
                                                            +            except Exception as e:
                                                            +                fail(f"Cannot reverse string (error: {e})")
                                                            +                raise e
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.function("reverse")(reverse_string)
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        callback_id: The callback id to identify the function
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    matchers = list(matchers) if matchers else []
                                                            +    middleware = list(middleware) if middleware else []
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.function_executed(callback_id=callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(functions, primary_matcher, matchers, middleware, auto_acknowledge)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new Function listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1842,12 +2332,93 @@ 

                                                            Args

                                                            def global_shortcut(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def global_shortcut(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new global shortcut listener."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.global_shortcut(callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new global shortcut listener.

                                                            def message(self,
                                                            keyword: str | Pattern = '',
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def message(
                                                            +    self,
                                                            +    keyword: Union[str, Pattern] = "",
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new message event listener. This method can be used as either a decorator or a method.
                                                            +    Check the `App#event` method's docstring for details.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.message(":wave:")
                                                            +        def say_hello(message, say):
                                                            +            user = message['user']
                                                            +            say(f"Hi there, <@{user}>!")
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.message(":wave:")(say_hello)
                                                            +
                                                            +    Refer to https://api.slack.com/events/message for details of `message` events.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        keyword: The keyword to match
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +    matchers = list(matchers) if matchers else []
                                                            +    middleware = list(middleware) if middleware else []
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        constraints = {
                                                            +            "type": "message",
                                                            +            "subtype": (
                                                            +                # In most cases, new message events come with no subtype.
                                                            +                None,
                                                            +                # As of Jan 2021, most bot messages no longer have the subtype bot_message.
                                                            +                # By contrast, messages posted using classic app's bot token still have the subtype.
                                                            +                "bot_message",
                                                            +                # If an end-user posts a message with "Also send to #channel" checked,
                                                            +                # the message event comes with this subtype.
                                                            +                "thread_broadcast",
                                                            +                # If an end-user posts a message with attached files,
                                                            +                # the message event comes with this subtype.
                                                            +                "file_share",
                                                            +            ),
                                                            +        }
                                                            +        primary_matcher = builtin_matchers.message_event(
                                                            +            keyword=keyword, constraints=constraints, base_logger=self._base_logger
                                                            +        )
                                                            +        middleware.insert(0, MessageListenerMatches(keyword))
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new message event listener. This method can be used as either a decorator or a method. Check the App#event method's docstring for details.

                                                            # Use this method as a decorator
                                                            @@ -1877,12 +2448,75 @@ 

                                                            Args

                                                            def message_shortcut(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def message_shortcut(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new message shortcut listener."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.message_shortcut(callback_id, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new message shortcut listener.

                                                            def middleware(self, *args) ‑> Callable | None
                                                            +
                                                            + +Expand source code + +
                                                            def middleware(self, *args) -> Optional[Callable]:
                                                            +    """Registers a new middleware to this app.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.middleware
                                                            +        def middleware_func(logger, body, next):
                                                            +            logger.info(f"request body: {body}")
                                                            +            next()
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.middleware(middleware_func)
                                                            +
                                                            +    Refer to https://slack.dev/bolt-python/concepts#global-middleware for details.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        *args: A function that works as a global middleware.
                                                            +    """
                                                            +    if len(args) > 0:
                                                            +        middleware_or_callable = args[0]
                                                            +        if isinstance(middleware_or_callable, Middleware):
                                                            +            middleware: Middleware = middleware_or_callable
                                                            +            self._middleware_list.append(middleware)
                                                            +            if isinstance(middleware, Assistant) and middleware.thread_context_store is not None:
                                                            +                self._assistant_thread_context_store = middleware.thread_context_store
                                                            +        elif callable(middleware_or_callable):
                                                            +            self._middleware_list.append(
                                                            +                CustomMiddleware(
                                                            +                    app_name=self.name,
                                                            +                    func=middleware_or_callable,
                                                            +                    base_logger=self._base_logger,
                                                            +                )
                                                            +            )
                                                            +            return middleware_or_callable
                                                            +        else:
                                                            +            raise BoltError(f"Unexpected type for a middleware ({type(middleware_or_callable)})")
                                                            +    return None
                                                            +

                                                            Registers a new middleware to this app. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1906,6 +2540,58 @@ 

                                                            Args

                                                            def options(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def options(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new options listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.options("menu_selection")
                                                            +        def show_menu_options(ack):
                                                            +            options = [
                                                            +                {
                                                            +                    "text": {"type": "plain_text", "text": "Option 1"},
                                                            +                    "value": "1-1",
                                                            +                },
                                                            +                {
                                                            +                    "text": {"type": "plain_text", "text": "Option 2"},
                                                            +                    "value": "1-2",
                                                            +                },
                                                            +            ]
                                                            +            ack(options=options)
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.options("menu_selection")(show_menu_options)
                                                            +
                                                            +    Refer to the following documents for details:
                                                            +
                                                            +    * https://api.slack.com/reference/block-kit/block-elements#external_select
                                                            +    * https://api.slack.com/reference/block-kit/block-elements#external_multi_select
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.options(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new options listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1946,6 +2632,54 @@ 

                                                            Args

                                                            def shortcut(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def shortcut(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new shortcut listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.shortcut("open_modal")
                                                            +        def open_modal(ack, body, client):
                                                            +            # Acknowledge the command request
                                                            +            ack()
                                                            +            # Call views_open with the built-in client
                                                            +            client.views_open(
                                                            +                # Pass a valid trigger_id within 3 seconds of receiving it
                                                            +                trigger_id=body["trigger_id"],
                                                            +                # View payload
                                                            +                view={ ... }
                                                            +            )
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.shortcut("open_modal")(open_modal)
                                                            +
                                                            +    Refer to https://api.slack.com/interactivity/shortcuts for details about Shortcuts.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        constraints: The conditions that match a request payload.
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.shortcut(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new shortcut listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1982,6 +2716,39 @@ 

                                                            Args

                                                            def start(self,
                                                            port: int = 3000,
                                                            path: str = '/slack/events',
                                                            http_server_logger_enabled: bool = True) ‑> None
                                                            +
                                                            + +Expand source code + +
                                                            def start(
                                                            +    self,
                                                            +    port: int = 3000,
                                                            +    path: str = "/slack/events",
                                                            +    http_server_logger_enabled: bool = True,
                                                            +) -> None:
                                                            +    """Starts a web server for local development.
                                                            +
                                                            +        # With the default settings, `http://localhost:3000/slack/events`
                                                            +        # is available for handling incoming requests from Slack
                                                            +        app.start()
                                                            +
                                                            +    This method internally starts a Web server process built with the `http.server` module.
                                                            +    For production, consider using a production-ready WSGI server such as Gunicorn.
                                                            +
                                                            +    Args:
                                                            +        port: The port to listen on (Default: 3000)
                                                            +        path: The path to handle request from Slack (Default: `/slack/events`)
                                                            +        http_server_logger_enabled: The flag to enable http.server logging if True (Default: True)
                                                            +    """
                                                            +    self._development_server = SlackAppDevelopmentServer(
                                                            +        port=port,
                                                            +        path=path,
                                                            +        app=self,
                                                            +        oauth_flow=self.oauth_flow,
                                                            +        http_server_logger_enabled=http_server_logger_enabled,
                                                            +    )
                                                            +    self._development_server.start()
                                                            +

                                                            Starts a web server for local development.

                                                            # With the default settings, `http://localhost:3000/slack/events`
                                                             # is available for handling incoming requests from Slack
                                                            @@ -2003,6 +2770,75 @@ 

                                                            Args

                                                            def step(self,
                                                            callback_id: str | Pattern | WorkflowStep | WorkflowStepBuilder,
                                                            edit: Callable[..., BoltResponse | None] | Listener | Sequence[Callable] | None = None,
                                                            save: Callable[..., BoltResponse | None] | Listener | Sequence[Callable] | None = None,
                                                            execute: Callable[..., BoltResponse | None] | Listener | Sequence[Callable] | None = None)
                                                            +
                                                            + +Expand source code + +
                                                            def step(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern, WorkflowStep, WorkflowStepBuilder],
                                                            +    edit: Optional[Union[Callable[..., Optional[BoltResponse]], Listener, Sequence[Callable]]] = None,
                                                            +    save: Optional[Union[Callable[..., Optional[BoltResponse]], Listener, Sequence[Callable]]] = None,
                                                            +    execute: Optional[Union[Callable[..., Optional[BoltResponse]], Listener, Sequence[Callable]]] = None,
                                                            +):
                                                            +    """
                                                            +    Deprecated:
                                                            +        Steps from apps for legacy workflows are now deprecated.
                                                            +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                            +
                                                            +    Registers a new step from app listener.
                                                            +
                                                            +    Unlike others, this method doesn't behave as a decorator.
                                                            +    If you want to register a step from app by a decorator, use `WorkflowStepBuilder`'s methods.
                                                            +
                                                            +        # Create a new WorkflowStep instance
                                                            +        from slack_bolt.workflows.step import WorkflowStep
                                                            +        ws = WorkflowStep(
                                                            +            callback_id="add_task",
                                                            +            edit=edit,
                                                            +            save=save,
                                                            +            execute=execute,
                                                            +        )
                                                            +        # Pass Step to set up listeners
                                                            +        app.step(ws)
                                                            +
                                                            +    Refer to https://api.slack.com/workflows/steps for details of steps from apps.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    For further information about WorkflowStep specific function arguments
                                                            +    such as `configure`, `update`, `complete`, and `fail`,
                                                            +    refer to `slack_bolt.workflows.step.utilities` API documents.
                                                            +
                                                            +    Args:
                                                            +        callback_id: The Callback ID for this step from app
                                                            +        edit: The function for displaying a modal in the Workflow Builder
                                                            +        save: The function for handling configuration in the Workflow Builder
                                                            +        execute: The function for handling the step execution
                                                            +    """
                                                            +    warnings.warn(
                                                            +        (
                                                            +            "Steps from apps for legacy workflows are now deprecated. "
                                                            +            "Use new custom steps: https://api.slack.com/automation/functions/custom-bolt"
                                                            +        ),
                                                            +        category=DeprecationWarning,
                                                            +    )
                                                            +    step = callback_id
                                                            +    if isinstance(callback_id, (str, Pattern)):
                                                            +        step = WorkflowStep(
                                                            +            callback_id=callback_id,
                                                            +            edit=edit,  # type: ignore[arg-type]
                                                            +            save=save,  # type: ignore[arg-type]
                                                            +            execute=execute,  # type: ignore[arg-type]
                                                            +            base_logger=self._base_logger,
                                                            +        )
                                                            +    elif isinstance(step, WorkflowStepBuilder):
                                                            +        step = step.build(base_logger=self._base_logger)
                                                            +    elif not isinstance(step, WorkflowStep):
                                                            +        raise BoltError(f"Invalid step object ({type(step)})")
                                                            +
                                                            +    self.use(WorkflowStepMiddleware(step))
                                                            +

                                                            Deprecated

                                                            Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                            @@ -2041,6 +2877,16 @@

                                                            Args

                                                            def use(self, *args) ‑> Callable | None
                                                            +
                                                            + +Expand source code + +
                                                            def use(self, *args) -> Optional[Callable]:
                                                            +    """Registers a new global middleware to this app. This method can be used as either a decorator or a method.
                                                            +
                                                            +    Refer to `App#middleware()` method's docstring for details."""
                                                            +    return self.middleware(*args)
                                                            +

                                                            Registers a new global middleware to this app. This method can be used as either a decorator or a method.

                                                            Refer to App#middleware() method's docstring for details.

                                                            @@ -2048,6 +2894,58 @@

                                                            Args

                                                            def view(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def view(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `view_submission`/`view_closed` event listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.view("view_1")
                                                            +        def handle_submission(ack, body, client, view):
                                                            +            # Assume there's an input block with `block_c` as the block_id and `dreamy_input`
                                                            +            hopes_and_dreams = view["state"]["values"]["block_c"]["dreamy_input"]
                                                            +            user = body["user"]["id"]
                                                            +            # Validate the inputs
                                                            +            errors = {}
                                                            +            if hopes_and_dreams is not None and len(hopes_and_dreams) <= 5:
                                                            +                errors["block_c"] = "The value must be longer than 5 characters"
                                                            +            if len(errors) > 0:
                                                            +                ack(response_action="errors", errors=errors)
                                                            +                return
                                                            +            # Acknowledge the view_submission event and close the modal
                                                            +            ack()
                                                            +            # Do whatever you want with the input data - here we're saving it to a DB
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.view("view_1")(handle_submission)
                                                            +
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/views for details of payloads.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        constraints: The conditions that match a request payload
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.view(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new view_submission/view_closed event listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -2088,6 +2986,26 @@ 

                                                            Args

                                                            def view_closed(self,
                                                            constraints: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def view_closed(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `view_closed` listener.
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/views#view_closed for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.view_closed(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new view_closed listener. Refer to https://api.slack.com/reference/interaction-payloads/views#view_closed for details.

                                                            @@ -2095,6 +3013,26 @@

                                                            Args

                                                            def view_submission(self,
                                                            constraints: str | Pattern,
                                                            matchers: Sequence[Callable[..., bool]] | None = None,
                                                            middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def view_submission(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                            +    """Registers a new `view_submission` listener.
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/views#view_submission for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.view_submission(constraints, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new view_submission listener. Refer to https://api.slack.com/reference/interaction-payloads/views#view_submission for details.

                                                            @@ -2168,7 +3106,7 @@

                                                            App diff --git a/docs/static/api-docs/slack_bolt/async_app.html b/docs/static/api-docs/slack_bolt/async_app.html index f3147b7d..ef311843 100644 --- a/docs/static/api-docs/slack_bolt/async_app.html +++ b/docs/static/api-docs/slack_bolt/async_app.html @@ -3,19 +3,30 @@ - + slack_bolt.async_app API documentation - + @@ -76,7 +87,6 @@

                                                            Classes

                                                            class AsyncAck
                                                            -
                                                            Expand source code @@ -118,11 +128,12 @@

                                                            Classes

                                                            view=view, )
                                                            +

                                                            Class variables

                                                            var responseBoltResponse | None
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            @@ -131,96 +142,6 @@

                                                            Class variables

                                                            (*,
                                                            logger: logging.Logger | None = None,
                                                            name: str | None = None,
                                                            process_before_response: bool = False,
                                                            raise_error_for_unhandled_request: bool = False,
                                                            signing_secret: str | None = None,
                                                            token: str | None = None,
                                                            client: slack_sdk.web.async_client.AsyncWebClient | None = None,
                                                            before_authorize: AsyncMiddleware | Callable[..., Awaitable[Any]] | None = None,
                                                            authorize: Callable[..., Awaitable[AuthorizeResult]] | None = None,
                                                            user_facing_authorize_error_message: str | None = None,
                                                            installation_store: slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore | None = None,
                                                            installation_store_bot_only: bool | None = None,
                                                            request_verification_enabled: bool = True,
                                                            ignoring_self_events_enabled: bool = True,
                                                            ignoring_self_assistant_message_events_enabled: bool = True,
                                                            ssl_check_enabled: bool = True,
                                                            url_verification_enabled: bool = True,
                                                            attaching_function_token_enabled: bool = True,
                                                            oauth_settings: AsyncOAuthSettings | None = None,
                                                            oauth_flow: AsyncOAuthFlow | None = None,
                                                            verification_token: str | None = None,
                                                            assistant_thread_context_store: AsyncAssistantThreadContextStore | None = None)
                                                            -

                                                            Bolt App that provides functionalities to register middleware/listeners.

                                                            -
                                                            import os
                                                            -from slack_bolt.async_app import AsyncApp
                                                            -
                                                            -# Initializes your app with your bot token and signing secret
                                                            -app = AsyncApp(
                                                            -    token=os.environ.get("SLACK_BOT_TOKEN"),
                                                            -    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
                                                            -)
                                                            -
                                                            -# Listens to incoming messages that contain "hello"
                                                            -@app.message("hello")
                                                            -async def message_hello(message, say):  # async function
                                                            -    # say() sends a message to the channel where the event was triggered
                                                            -    await say(f"Hey there <@{message['user']}>!")
                                                            -
                                                            -# Start your app
                                                            -if __name__ == "__main__":
                                                            -    app.start(port=int(os.environ.get("PORT", 3000)))
                                                            -
                                                            -

                                                            Refer to https://slack.dev/bolt-python/concepts#async for details.

                                                            -

                                                            If you would like to build an OAuth app for enabling the app to run with multiple workspaces, -refer to https://slack.dev/bolt-python/concepts#authenticating-oauth to learn how to configure the app.

                                                            -

                                                            Args

                                                            -
                                                            -
                                                            logger
                                                            -
                                                            The custom logger that can be used in this app.
                                                            -
                                                            name
                                                            -
                                                            The application name that will be used in logging. If absent, the source file name will be used.
                                                            -
                                                            process_before_response
                                                            -
                                                            True if this app runs on Function as a Service. (Default: False)
                                                            -
                                                            raise_error_for_unhandled_request
                                                            -
                                                            True if you want to raise exceptions for unhandled requests -and use @app.error listeners instead of -the built-in handler, which pints warning logs and returns 404 to Slack (Default: False)
                                                            -
                                                            signing_secret
                                                            -
                                                            The Signing Secret value used for verifying requests from Slack.
                                                            -
                                                            token
                                                            -
                                                            The bot/user access token required only for single-workspace app.
                                                            -
                                                            client
                                                            -
                                                            The singleton slack_sdk.web.async_client.AsyncWebClient instance for this app.
                                                            -
                                                            before_authorize
                                                            -
                                                            A global middleware that can be executed right before authorize function
                                                            -
                                                            authorize
                                                            -
                                                            The function to authorize an incoming request from Slack -by checking if there is a team/user in the installation data.
                                                            -
                                                            user_facing_authorize_error_message
                                                            -
                                                            The user-facing error message to display -when the app is installed but the installation is not managed by this app's installation store
                                                            -
                                                            installation_store
                                                            -
                                                            The module offering save/find operations of installation data
                                                            -
                                                            installation_store_bot_only
                                                            -
                                                            Use AsyncInstallationStore#async_find_bot() if True (Default: False)
                                                            -
                                                            request_verification_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -AsyncRequestVerification is a built-in middleware that verifies the signature in HTTP Mode requests. -Make sure if it's safe enough when you turn a built-in middleware off. -We strongly recommend using RequestVerification for better security. -If you have a proxy that verifies request signature in front of the Bolt app, -it's totally fine to disable RequestVerification to avoid duplication of work. -Don't turn it off just for easiness of development.
                                                            -
                                                            ignoring_self_events_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -AsyncIgnoringSelfEvents is a built-in middleware that enables Bolt apps to easily skip the events -generated by this app's bot user (this is useful for avoiding code error causing an infinite loop).
                                                            -
                                                            ignoring_self_assistant_message_events_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware. -IgnoringSelfEvents for this app's bot user message events within an assistant thread -This is useful for avoiding code error causing an infinite loop; Default: True
                                                            -
                                                            url_verification_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -AsyncUrlVerification is a built-in middleware that handles url_verification requests -that verify the endpoint for Events API in HTTP Mode requests.
                                                            -
                                                            ssl_check_enabled
                                                            -
                                                            bool = False if you would like to disable the built-in middleware (Default: True). -AsyncSslCheck is a built-in middleware that handles ssl_check requests from Slack.
                                                            -
                                                            attaching_function_token_enabled
                                                            -
                                                            False if you would like to disable the built-in middleware (Default: True). -AsyncAttachingFunctionToken is a built-in middleware that injects the just-in-time workflow-execution token -when your app receives function_executed or interactivity events scoped to a custom step.
                                                            -
                                                            oauth_settings
                                                            -
                                                            The settings related to Slack app installation flow (OAuth flow)
                                                            -
                                                            oauth_flow
                                                            -
                                                            Instantiated slack_bolt.oauth.AsyncOAuthFlow. This is always prioritized over oauth_settings.
                                                            -
                                                            verification_token
                                                            -
                                                            Deprecated verification mechanism. This can be used only for ssl_check requests.
                                                            -
                                                            assistant_thread_context_store
                                                            -
                                                            Custom AssistantThreadContext store (Default: the built-in implementation, -which uses a parent message's metadata to store the latest context)
                                                            -
                                                            Expand source code @@ -1616,18 +1537,107 @@

                                                            Args

                                                            return value_to_return
                                                            +

                                                            Bolt App that provides functionalities to register middleware/listeners.

                                                            +
                                                            import os
                                                            +from slack_bolt.async_app import AsyncApp
                                                            +
                                                            +# Initializes your app with your bot token and signing secret
                                                            +app = AsyncApp(
                                                            +    token=os.environ.get("SLACK_BOT_TOKEN"),
                                                            +    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
                                                            +)
                                                            +
                                                            +# Listens to incoming messages that contain "hello"
                                                            +@app.message("hello")
                                                            +async def message_hello(message, say):  # async function
                                                            +    # say() sends a message to the channel where the event was triggered
                                                            +    await say(f"Hey there <@{message['user']}>!")
                                                            +
                                                            +# Start your app
                                                            +if __name__ == "__main__":
                                                            +    app.start(port=int(os.environ.get("PORT", 3000)))
                                                            +
                                                            +

                                                            Refer to https://slack.dev/bolt-python/concepts#async for details.

                                                            +

                                                            If you would like to build an OAuth app for enabling the app to run with multiple workspaces, +refer to https://slack.dev/bolt-python/concepts#authenticating-oauth to learn how to configure the app.

                                                            +

                                                            Args

                                                            +
                                                            +
                                                            logger
                                                            +
                                                            The custom logger that can be used in this app.
                                                            +
                                                            name
                                                            +
                                                            The application name that will be used in logging. If absent, the source file name will be used.
                                                            +
                                                            process_before_response
                                                            +
                                                            True if this app runs on Function as a Service. (Default: False)
                                                            +
                                                            raise_error_for_unhandled_request
                                                            +
                                                            True if you want to raise exceptions for unhandled requests +and use @app.error listeners instead of +the built-in handler, which pints warning logs and returns 404 to Slack (Default: False)
                                                            +
                                                            signing_secret
                                                            +
                                                            The Signing Secret value used for verifying requests from Slack.
                                                            +
                                                            token
                                                            +
                                                            The bot/user access token required only for single-workspace app.
                                                            +
                                                            client
                                                            +
                                                            The singleton slack_sdk.web.async_client.AsyncWebClient instance for this app.
                                                            +
                                                            before_authorize
                                                            +
                                                            A global middleware that can be executed right before authorize function
                                                            +
                                                            authorize
                                                            +
                                                            The function to authorize an incoming request from Slack +by checking if there is a team/user in the installation data.
                                                            +
                                                            user_facing_authorize_error_message
                                                            +
                                                            The user-facing error message to display +when the app is installed but the installation is not managed by this app's installation store
                                                            +
                                                            installation_store
                                                            +
                                                            The module offering save/find operations of installation data
                                                            +
                                                            installation_store_bot_only
                                                            +
                                                            Use AsyncInstallationStore#async_find_bot() if True (Default: False)
                                                            +
                                                            request_verification_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +AsyncRequestVerification is a built-in middleware that verifies the signature in HTTP Mode requests. +Make sure if it's safe enough when you turn a built-in middleware off. +We strongly recommend using RequestVerification for better security. +If you have a proxy that verifies request signature in front of the Bolt app, +it's totally fine to disable RequestVerification to avoid duplication of work. +Don't turn it off just for easiness of development.
                                                            +
                                                            ignoring_self_events_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +AsyncIgnoringSelfEvents is a built-in middleware that enables Bolt apps to easily skip the events +generated by this app's bot user (this is useful for avoiding code error causing an infinite loop).
                                                            +
                                                            ignoring_self_assistant_message_events_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware. +IgnoringSelfEvents for this app's bot user message events within an assistant thread +This is useful for avoiding code error causing an infinite loop; Default: True
                                                            +
                                                            url_verification_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +AsyncUrlVerification is a built-in middleware that handles url_verification requests +that verify the endpoint for Events API in HTTP Mode requests.
                                                            +
                                                            ssl_check_enabled
                                                            +
                                                            bool = False if you would like to disable the built-in middleware (Default: True). +AsyncSslCheck is a built-in middleware that handles ssl_check requests from Slack.
                                                            +
                                                            attaching_function_token_enabled
                                                            +
                                                            False if you would like to disable the built-in middleware (Default: True). +AsyncAttachingFunctionToken is a built-in middleware that injects the just-in-time workflow-execution token +when your app receives function_executed or interactivity events scoped to a custom step.
                                                            +
                                                            oauth_settings
                                                            +
                                                            The settings related to Slack app installation flow (OAuth flow)
                                                            +
                                                            oauth_flow
                                                            +
                                                            Instantiated slack_bolt.oauth.AsyncOAuthFlow. This is always prioritized over oauth_settings.
                                                            +
                                                            verification_token
                                                            +
                                                            Deprecated verification mechanism. This can be used only for ssl_check requests.
                                                            +
                                                            assistant_thread_context_store
                                                            +
                                                            Custom AssistantThreadContext store (Default: the built-in implementation, +which uses a parent message's metadata to store the latest context)
                                                            +

                                                            Class variables

                                                            var AsyncSlackAppServer
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            Instance variables

                                                            prop client : slack_sdk.web.async_client.AsyncWebClient
                                                            -

                                                            The singleton slack_sdk.web.async_client.AsyncWebClient instance in this app.

                                                            Expand source code @@ -1637,10 +1647,10 @@

                                                            Instance variables

                                                            """The singleton `slack_sdk.web.async_client.AsyncWebClient` instance in this app.""" return self._async_client
                                                            +

                                                            The singleton slack_sdk.web.async_client.AsyncWebClient instance in this app.

                                                            prop installation_store : slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore | None
                                                            -

                                                            The slack_sdk.oauth.AsyncInstallationStore that can be used in the authorize middleware.

                                                            Expand source code @@ -1650,10 +1660,10 @@

                                                            Instance variables

                                                            """The `slack_sdk.oauth.AsyncInstallationStore` that can be used in the `authorize` middleware.""" return self._async_installation_store
                                                            +

                                                            The slack_sdk.oauth.AsyncInstallationStore that can be used in the authorize middleware.

                                                            prop listener_runnerAsyncioListenerRunner
                                                            -

                                                            The asyncio-based executor for asynchronously running listeners.

                                                            Expand source code @@ -1663,10 +1673,10 @@

                                                            Instance variables

                                                            """The asyncio-based executor for asynchronously running listeners.""" return self._async_listener_runner
                                                            +

                                                            The asyncio-based executor for asynchronously running listeners.

                                                            prop logger : logging.Logger
                                                            -

                                                            The logger this app uses.

                                                            Expand source code @@ -1676,10 +1686,10 @@

                                                            Instance variables

                                                            """The logger this app uses.""" return self._framework_logger
                                                            +

                                                            The logger this app uses.

                                                            prop name : str
                                                            -

                                                            The name of this app (default: the filename)

                                                            Expand source code @@ -1689,10 +1699,10 @@

                                                            Instance variables

                                                            """The name of this app (default: the filename)""" return self._name
                                                            +

                                                            The name of this app (default: the filename)

                                                            prop oauth_flowAsyncOAuthFlow | None
                                                            -

                                                            Configured OAuthFlow object if exists.

                                                            Expand source code @@ -1702,10 +1712,10 @@

                                                            Instance variables

                                                            """Configured `OAuthFlow` object if exists.""" return self._async_oauth_flow
                                                            +

                                                            Configured OAuthFlow object if exists.

                                                            prop process_before_response : bool
                                                            -
                                                            Expand source code @@ -1714,6 +1724,7 @@

                                                            Instance variables

                                                            def process_before_response(self) -> bool: return self._process_before_response or False
                                                            +

                                                            Methods

                                                            @@ -1722,6 +1733,47 @@

                                                            Methods

                                                            def action(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def action(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new action listener. This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.action("approve_button")
                                                            +        async def update_message(ack):
                                                            +            await ack()
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.action("approve_button")(update_message)
                                                            +
                                                            +    * Refer to https://api.slack.com/reference/interaction-payloads/block-actions for actions in `blocks`.
                                                            +    * Refer to https://api.slack.com/legacy/message-buttons for actions in `attachments`.
                                                            +    * Refer to https://api.slack.com/dialogs for actions in dialogs.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        constraints: The conditions that match a request payload
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.action(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new action listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                             @app.action("approve_button")
                                                            @@ -1753,12 +1805,134 @@ 

                                                            Args

                                                            def assistant(self,
                                                            assistant: AsyncAssistant) ‑> Callable | None
                                                            +
                                                            + +Expand source code + +
                                                            def assistant(self, assistant: AsyncAssistant) -> Optional[Callable]:
                                                            +    return self.middleware(assistant)
                                                            +
                                                            async def async_dispatch(self,
                                                            req: AsyncBoltRequest) ‑> BoltResponse
                                                            +
                                                            + +Expand source code + +
                                                            async def async_dispatch(self, req: AsyncBoltRequest) -> BoltResponse:
                                                            +    """Applies all middleware and dispatches an incoming request from Slack to the right code path.
                                                            +
                                                            +    Args:
                                                            +        req: An incoming request from Slack.
                                                            +
                                                            +    Returns:
                                                            +        The response generated by this Bolt app.
                                                            +    """
                                                            +    starting_time = time.time()
                                                            +    self._init_context(req)
                                                            +
                                                            +    resp: Optional[BoltResponse] = BoltResponse(status=200, body="")
                                                            +    middleware_state = {"next_called": False}
                                                            +
                                                            +    async def async_middleware_next():
                                                            +        middleware_state["next_called"] = True
                                                            +
                                                            +    try:
                                                            +        for middleware in self._async_middleware_list:
                                                            +            middleware_state["next_called"] = False
                                                            +            if self._framework_logger.level <= logging.DEBUG:
                                                            +                self._framework_logger.debug(f"Applying {middleware.name}")
                                                            +            resp = await middleware.async_process(
                                                            +                req=req, resp=resp, next=async_middleware_next  # type: ignore[arg-type]
                                                            +            )
                                                            +            if not middleware_state["next_called"]:
                                                            +                if resp is None:
                                                            +                    # next() method was not called without providing the response to return to Slack
                                                            +                    # This should not be an intentional handling in usual use cases.
                                                            +                    resp = BoltResponse(status=404, body={"error": "no next() calls in middleware"})
                                                            +                    if self._raise_error_for_unhandled_request is True:
                                                            +                        try:
                                                            +                            raise BoltUnhandledRequestError(
                                                            +                                request=req,
                                                            +                                current_response=resp,
                                                            +                                last_global_middleware_name=middleware.name,
                                                            +                            )
                                                            +                        except BoltUnhandledRequestError as e:
                                                            +                            await self._async_listener_runner.listener_error_handler.handle(
                                                            +                                error=e,
                                                            +                                request=req,
                                                            +                                response=resp,
                                                            +                            )
                                                            +                        return resp
                                                            +                    self._framework_logger.warning(warning_unhandled_by_global_middleware(middleware.name, req))
                                                            +                    return resp
                                                            +                return resp
                                                            +
                                                            +        for listener in self._async_listeners:
                                                            +            listener_name = get_name_for_callable(listener.ack_function)
                                                            +            self._framework_logger.debug(debug_checking_listener(listener_name))
                                                            +            if await listener.async_matches(req=req, resp=resp):  # type: ignore[arg-type]
                                                            +                # run all the middleware attached to this listener first
                                                            +                (middleware_resp, next_was_not_called) = await listener.run_async_middleware(
                                                            +                    req=req, resp=resp  # type: ignore[arg-type]
                                                            +                )
                                                            +                if next_was_not_called:
                                                            +                    if middleware_resp is not None:
                                                            +                        if self._framework_logger.level <= logging.DEBUG:
                                                            +                            debug_message = debug_return_listener_middleware_response(
                                                            +                                listener_name,
                                                            +                                middleware_resp.status,
                                                            +                                middleware_resp.body,
                                                            +                                starting_time,
                                                            +                            )
                                                            +                            self._framework_logger.debug(debug_message)
                                                            +                        return middleware_resp
                                                            +                    # The last listener middleware didn't call next() method.
                                                            +                    # This means the listener is not for this incoming request.
                                                            +                    continue
                                                            +
                                                            +                if middleware_resp is not None:
                                                            +                    resp = middleware_resp
                                                            +
                                                            +                self._framework_logger.debug(debug_running_listener(listener_name))
                                                            +                listener_response: Optional[BoltResponse] = await self._async_listener_runner.run(
                                                            +                    request=req,
                                                            +                    response=resp,  # type: ignore[arg-type]
                                                            +                    listener_name=listener_name,
                                                            +                    listener=listener,
                                                            +                )
                                                            +                if listener_response is not None:
                                                            +                    return listener_response
                                                            +
                                                            +        if resp is None:
                                                            +            resp = BoltResponse(status=404, body={"error": "unhandled request"})
                                                            +        if self._raise_error_for_unhandled_request is True:
                                                            +            try:
                                                            +                raise BoltUnhandledRequestError(
                                                            +                    request=req,
                                                            +                    current_response=resp,
                                                            +                )
                                                            +            except BoltUnhandledRequestError as e:
                                                            +                await self._async_listener_runner.listener_error_handler.handle(
                                                            +                    error=e,
                                                            +                    request=req,
                                                            +                    response=resp,
                                                            +                )
                                                            +            return resp
                                                            +        return self._handle_unmatched_requests(req, resp)
                                                            +
                                                            +    except Exception as error:
                                                            +        resp = BoltResponse(status=500, body="")
                                                            +        await self._async_middleware_error_handler.handle(
                                                            +            error=error,
                                                            +            request=req,
                                                            +            response=resp,
                                                            +        )
                                                            +        return resp
                                                            +

                                                            Applies all middleware and dispatches an incoming request from Slack to the right code path.

                                                            Args

                                                            @@ -1772,6 +1946,26 @@

                                                            Returns

                                                            def attachment_action(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def attachment_action(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `interactive_message` action listener.
                                                            +    Refer to https://api.slack.com/legacy/message-buttons for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.attachment_action(callback_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new interactive_message action listener. Refer to https://api.slack.com/legacy/message-buttons for details.

                                                            @@ -1779,6 +1973,27 @@

                                                            Returns

                                                            def block_action(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def block_action(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `block_actions` action listener.
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/block-actions for details.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.block_action(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new block_actions action listener. Refer to https://api.slack.com/reference/interaction-payloads/block-actions for details.

                                                            @@ -1786,12 +2001,73 @@

                                                            Returns

                                                            def block_suggestion(self,
                                                            action_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            -

                                                            Registers a new block_suggestion listener.

                                                            +
                                                            + +Expand source code + +
                                                            def block_suggestion(
                                                            +    self,
                                                            +    action_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `block_suggestion` listener."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.block_suggestion(action_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +
                                                            +

                                                            Registers a new block_suggestion listener.

                                                            def command(self,
                                                            command: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def command(
                                                            +    self,
                                                            +    command: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new slash command listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.command("/echo")
                                                            +        async def repeat_text(ack, say, command):
                                                            +            # Acknowledge command request
                                                            +            await ack()
                                                            +            await say(f"{command['text']}")
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.command("/echo")(repeat_text)
                                                            +
                                                            +    Refer to https://api.slack.com/interactivity/slash-commands for details of Slash Commands.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        command: The conditions that match a request payload
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.command(command, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new slash command listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1822,18 +2098,60 @@ 

                                                            Args

                                                            def default_app_uninstalled_event_listener(self) ‑> Callable[..., Awaitable[BoltResponse | None]]
                                                            +
                                                            + +Expand source code + +
                                                            def default_app_uninstalled_event_listener(
                                                            +    self,
                                                            +) -> Callable[..., Awaitable[Optional[BoltResponse]]]:
                                                            +    if self._async_tokens_revocation_listeners is None:
                                                            +        raise BoltError(error_installation_store_required_for_builtin_listeners())
                                                            +    return self._async_tokens_revocation_listeners.handle_app_uninstalled_events
                                                            +
                                                            def default_tokens_revoked_event_listener(self) ‑> Callable[..., Awaitable[BoltResponse | None]]
                                                            +
                                                            + +Expand source code + +
                                                            def default_tokens_revoked_event_listener(
                                                            +    self,
                                                            +) -> Callable[..., Awaitable[Optional[BoltResponse]]]:
                                                            +    if self._async_tokens_revocation_listeners is None:
                                                            +        raise BoltError(error_installation_store_required_for_builtin_listeners())
                                                            +    return self._async_tokens_revocation_listeners.handle_tokens_revoked_events
                                                            +
                                                            def dialog_cancellation(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def dialog_cancellation(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `dialog_submission` listener.
                                                            +    Refer to https://api.slack.com/dialogs for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.dialog_cancellation(callback_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new dialog_submission listener. Refer to https://api.slack.com/dialogs for details.

                                                            @@ -1841,6 +2159,26 @@

                                                            Args

                                                            def dialog_submission(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def dialog_submission(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `dialog_submission` listener.
                                                            +    Refer to https://api.slack.com/dialogs for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.dialog_submission(callback_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new dialog_submission listener. Refer to https://api.slack.com/dialogs for details.

                                                            @@ -1848,6 +2186,26 @@

                                                            Args

                                                            def dialog_suggestion(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def dialog_suggestion(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `dialog_suggestion` listener.
                                                            +    Refer to https://api.slack.com/dialogs for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.dialog_suggestion(callback_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new dialog_suggestion listener. Refer to https://api.slack.com/dialogs for details.

                                                            @@ -1855,12 +2213,57 @@

                                                            Args

                                                            def enable_token_revocation_listeners(self) ‑> None
                                                            +
                                                            + +Expand source code + +
                                                            def enable_token_revocation_listeners(self) -> None:
                                                            +    self.event("tokens_revoked")(self.default_tokens_revoked_event_listener())
                                                            +    self.event("app_uninstalled")(self.default_app_uninstalled_event_listener())
                                                            +
                                                            def error(self,
                                                            func: Callable[..., Awaitable[BoltResponse | None]]) ‑> Callable[..., Awaitable[BoltResponse | None]]
                                                            +
                                                            + +Expand source code + +
                                                            def error(
                                                            +    self, func: Callable[..., Awaitable[Optional[BoltResponse]]]
                                                            +) -> Callable[..., Awaitable[Optional[BoltResponse]]]:
                                                            +    """Updates the global error handler. This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.error
                                                            +        async def custom_error_handler(error, body, logger):
                                                            +            logger.exception(f"Error: {error}")
                                                            +            logger.info(f"Request body: {body}")
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.error(custom_error_handler)
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        func: The function that is supposed to be executed
                                                            +            when getting an unhandled error in Bolt app.
                                                            +    """
                                                            +    if not is_callable_coroutine(func):
                                                            +        name = get_name_for_callable(func)
                                                            +        raise BoltError(error_listener_function_must_be_coro_func(name))
                                                            +    self._async_listener_runner.listener_error_handler = AsyncCustomListenerErrorHandler(
                                                            +        logger=self._framework_logger,
                                                            +        func=func,
                                                            +    )
                                                            +    self._async_middleware_error_handler = AsyncCustomMiddlewareErrorHandler(
                                                            +        logger=self._framework_logger,
                                                            +        func=func,
                                                            +    )
                                                            +    return func
                                                            +

                                                            Updates the global error handler. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                             @app.error
                                                            @@ -1883,6 +2286,53 @@ 

                                                            Args

                                                            def event(self,
                                                            event: str | Pattern | Dict[str, str | Sequence[str | Pattern | None] | None],
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def event(
                                                            +    self,
                                                            +    event: Union[
                                                            +        str,
                                                            +        Pattern,
                                                            +        Dict[str, Optional[Union[str, Sequence[Optional[Union[str, Pattern]]]]]],
                                                            +    ],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new event listener. This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.event("team_join")
                                                            +        async def ask_for_introduction(event, say):
                                                            +            welcome_channel_id = "C12345"
                                                            +            user_id = event["user"]
                                                            +            text = f"Welcome to the team, <@{user_id}>! :tada: You can introduce yourself in this channel."
                                                            +            await say(text=text, channel=welcome_channel_id)
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.event("team_join")(ask_for_introduction)
                                                            +
                                                            +    Refer to https://api.slack.com/apis/connections/events-api for details of Events API.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        event: The conditions that match a request payload.
                                                            +            If you pass a dict for this, you can have type, subtype in the constraint.
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.event(event, True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new event listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                             @app.event("team_join")
                                                            @@ -1914,6 +2364,56 @@ 

                                                            Args

                                                            def function(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None,
                                                            auto_acknowledge: bool = True) ‑> Callable[..., Callable[..., Awaitable[BoltResponse]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def function(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +    auto_acknowledge: bool = True,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[BoltResponse]]]]:
                                                            +    """Registers a new Function listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.function("reverse")
                                                            +        async def reverse_string(ack: AsyncAck, inputs: dict, complete: AsyncComplete, fail: AsyncFail):
                                                            +            try:
                                                            +                await ack()
                                                            +                string_to_reverse = inputs["stringToReverse"]
                                                            +                await complete({"reverseString": string_to_reverse[::-1]})
                                                            +            except Exception as e:
                                                            +                await fail(f"Cannot reverse string (error: {e})")
                                                            +                raise e
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.function("reverse")(reverse_string)
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        callback_id: The callback id to identify the function
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    matchers = list(matchers) if matchers else []
                                                            +    middleware = list(middleware) if middleware else []
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.function_executed(
                                                            +            callback_id=callback_id, base_logger=self._base_logger, asyncio=True
                                                            +        )
                                                            +        return self._register_listener(functions, primary_matcher, matchers, middleware, auto_acknowledge)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new Function listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -1947,12 +2447,96 @@ 

                                                            Args

                                                            def global_shortcut(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def global_shortcut(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new global shortcut listener."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.global_shortcut(callback_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new global shortcut listener.

                                                            def message(self,
                                                            keyword: str | Pattern = '',
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def message(
                                                            +    self,
                                                            +    keyword: Union[str, Pattern] = "",
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new message event listener. This method can be used as either a decorator or a method.
                                                            +    Check the `App#event` method's docstring for details.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.message(":wave:")
                                                            +        async def say_hello(message, say):
                                                            +            user = message['user']
                                                            +            await say(f"Hi there, <@{user}>!")
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.message(":wave:")(say_hello)
                                                            +
                                                            +    Refer to https://api.slack.com/events/message for details of `message` events.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        keyword: The keyword to match
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +    matchers = list(matchers) if matchers else []
                                                            +    middleware = list(middleware) if middleware else []
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        constraints = {
                                                            +            "type": "message",
                                                            +            "subtype": (
                                                            +                # In most cases, new message events come with no subtype.
                                                            +                None,
                                                            +                # As of Jan 2021, most bot messages no longer have the subtype bot_message.
                                                            +                # By contrast, messages posted using classic app's bot token still have the subtype.
                                                            +                "bot_message",
                                                            +                # If an end-user posts a message with "Also send to #channel" checked,
                                                            +                # the message event comes with this subtype.
                                                            +                "thread_broadcast",
                                                            +                # If an end-user posts a message with attached files,
                                                            +                # the message event comes with this subtype.
                                                            +                "file_share",
                                                            +            ),
                                                            +        }
                                                            +        primary_matcher = builtin_matchers.message_event(
                                                            +            constraints=constraints,
                                                            +            keyword=keyword,
                                                            +            asyncio=True,
                                                            +            base_logger=self._base_logger,
                                                            +        )
                                                            +        middleware.insert(0, AsyncMessageListenerMatches(keyword))
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new message event listener. This method can be used as either a decorator or a method. Check the App#event method's docstring for details.

                                                            # Use this method as a decorator
                                                            @@ -1982,12 +2566,73 @@ 

                                                            Args

                                                            def message_shortcut(self,
                                                            callback_id: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def message_shortcut(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new message shortcut listener."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.message_shortcut(callback_id, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new message shortcut listener.

                                                            def middleware(self, *args) ‑> Callable | None
                                                            +
                                                            + +Expand source code + +
                                                            def middleware(self, *args) -> Optional[Callable]:
                                                            +    """Registers a new middleware to this app.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.middleware
                                                            +        async def middleware_func(logger, body, next):
                                                            +            logger.info(f"request body: {body}")
                                                            +            await next()
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.middleware(middleware_func)
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        *args: A function that works as a global middleware.
                                                            +    """
                                                            +    if len(args) > 0:
                                                            +        middleware_or_callable = args[0]
                                                            +        if isinstance(middleware_or_callable, AsyncMiddleware):
                                                            +            middleware: AsyncMiddleware = middleware_or_callable
                                                            +            self._async_middleware_list.append(middleware)
                                                            +            if isinstance(middleware, AsyncAssistant) and middleware.thread_context_store is not None:
                                                            +                self._assistant_thread_context_store = middleware.thread_context_store
                                                            +        elif callable(middleware_or_callable):
                                                            +            self._async_middleware_list.append(
                                                            +                AsyncCustomMiddleware(
                                                            +                    app_name=self.name,
                                                            +                    func=middleware_or_callable,
                                                            +                    base_logger=self._base_logger,
                                                            +                )
                                                            +            )
                                                            +            return middleware_or_callable
                                                            +        else:
                                                            +            raise BoltError(f"Unexpected type for a middleware ({type(middleware_or_callable)})")
                                                            +    return None
                                                            +

                                                            Registers a new middleware to this app. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -2010,6 +2655,58 @@ 

                                                            Args

                                                            def options(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def options(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new options listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.options("menu_selection")
                                                            +        async def show_menu_options(ack):
                                                            +            options = [
                                                            +                {
                                                            +                    "text": {"type": "plain_text", "text": "Option 1"},
                                                            +                    "value": "1-1",
                                                            +                },
                                                            +                {
                                                            +                    "text": {"type": "plain_text", "text": "Option 2"},
                                                            +                    "value": "1-2",
                                                            +                },
                                                            +            ]
                                                            +            await ack(options=options)
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.options("menu_selection")(show_menu_options)
                                                            +
                                                            +    Refer to the following documents for details:
                                                            +
                                                            +    * https://api.slack.com/reference/block-kit/block-elements#external_select
                                                            +    * https://api.slack.com/reference/block-kit/block-elements#external_multi_select
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.options(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new options listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -2050,6 +2747,33 @@ 

                                                            Args

                                                            def server(self, port: int = 3000, path: str = '/slack/events', host: str | None = None) ‑> AsyncSlackAppServer
                                                            +
                                                            + +Expand source code + +
                                                            def server(
                                                            +    self,
                                                            +    port: int = 3000,
                                                            +    path: str = "/slack/events",
                                                            +    host: Optional[str] = None,
                                                            +) -> AsyncSlackAppServer:
                                                            +    """Configure a web server using AIOHTTP.
                                                            +    Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.
                                                            +
                                                            +    Args:
                                                            +        port: The port to listen on (Default: 3000)
                                                            +        path: The path to handle request from Slack (Default: `/slack/events`)
                                                            +        host: The hostname to serve the web endpoints. (Default: 0.0.0.0)
                                                            +    """
                                                            +    if self._server is None or self._server.port != port or self._server.path != path:
                                                            +        self._server = AsyncSlackAppServer(
                                                            +            port=port,
                                                            +            path=path,
                                                            +            app=self,
                                                            +            host=host,
                                                            +        )
                                                            +    return self._server
                                                            +

                                                            Configure a web server using AIOHTTP. Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.

                                                            Args

                                                            @@ -2066,6 +2790,54 @@

                                                            Args

                                                            def shortcut(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def shortcut(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new shortcut listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.shortcut("open_modal")
                                                            +        async def open_modal(ack, body, client):
                                                            +            # Acknowledge the command request
                                                            +            await ack()
                                                            +            # Call views_open with the built-in client
                                                            +            await client.views_open(
                                                            +                # Pass a valid trigger_id within 3 seconds of receiving it
                                                            +                trigger_id=body["trigger_id"],
                                                            +                # View payload
                                                            +                view={ ... }
                                                            +            )
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.shortcut("open_modal")(open_modal)
                                                            +
                                                            +    Refer to https://api.slack.com/interactivity/shortcuts for details about Shortcuts.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        constraints: The conditions that match a request payload.
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.shortcut(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new shortcut listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -2102,6 +2874,21 @@ 

                                                            Args

                                                            def start(self, port: int = 3000, path: str = '/slack/events', host: str | None = None) ‑> None
                                                            +
                                                            + +Expand source code + +
                                                            def start(self, port: int = 3000, path: str = "/slack/events", host: Optional[str] = None) -> None:
                                                            +    """Start a web server using AIOHTTP.
                                                            +    Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.
                                                            +
                                                            +    Args:
                                                            +        port: The port to listen on (Default: 3000)
                                                            +        path: The path to handle request from Slack (Default: `/slack/events`)
                                                            +        host: The hostname to serve the web endpoints. (Default: 0.0.0.0)
                                                            +    """
                                                            +    self.server(port=port, path=path, host=host).start()
                                                            +

                                                            Start a web server using AIOHTTP. Refer to https://docs.aiohttp.org/ for more details about AIOHTTP.

                                                            Args

                                                            @@ -2118,6 +2905,74 @@

                                                            Args

                                                            def step(self,
                                                            callback_id: str | Pattern | AsyncWorkflowStep | AsyncWorkflowStepBuilder,
                                                            edit: Callable[..., BoltResponse | None] | AsyncListener | Sequence[Callable] | None = None,
                                                            save: Callable[..., BoltResponse | None] | AsyncListener | Sequence[Callable] | None = None,
                                                            execute: Callable[..., BoltResponse | None] | AsyncListener | Sequence[Callable] | None = None)
                                                            +
                                                            + +Expand source code + +
                                                            def step(
                                                            +    self,
                                                            +    callback_id: Union[str, Pattern, AsyncWorkflowStep, AsyncWorkflowStepBuilder],
                                                            +    edit: Optional[Union[Callable[..., Optional[BoltResponse]], AsyncListener, Sequence[Callable]]] = None,
                                                            +    save: Optional[Union[Callable[..., Optional[BoltResponse]], AsyncListener, Sequence[Callable]]] = None,
                                                            +    execute: Optional[Union[Callable[..., Optional[BoltResponse]], AsyncListener, Sequence[Callable]]] = None,
                                                            +):
                                                            +    """
                                                            +    Deprecated:
                                                            +        Steps from apps for legacy workflows are now deprecated.
                                                            +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                            +
                                                            +    Registers a new step from app listener.
                                                            +
                                                            +    Unlike others, this method doesn't behave as a decorator.
                                                            +    If you want to register a step from app by a decorator, use `AsyncWorkflowStepBuilder`'s methods.
                                                            +
                                                            +        # Create a new WorkflowStep instance
                                                            +        from slack_bolt.workflows.async_step import AsyncWorkflowStep
                                                            +        ws = AsyncWorkflowStep(
                                                            +            callback_id="add_task",
                                                            +            edit=edit,
                                                            +            save=save,
                                                            +            execute=execute,
                                                            +        )
                                                            +        # Pass Step to set up listeners
                                                            +        app.step(ws)
                                                            +
                                                            +    Refer to https://api.slack.com/workflows/steps for details of steps from apps.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +    For further information about AsyncWorkflowStep specific function arguments
                                                            +    such as `configure`, `update`, `complete`, and `fail`,
                                                            +    refer to the `async` prefixed ones in `slack_bolt.workflows.step.utilities` API documents.
                                                            +
                                                            +    Args:
                                                            +        callback_id: The Callback ID for this step from app
                                                            +        edit: The function for displaying a modal in the Workflow Builder
                                                            +        save: The function for handling configuration in the Workflow Builder
                                                            +        execute: The function for handling the step execution
                                                            +    """
                                                            +    warnings.warn(
                                                            +        (
                                                            +            "Steps from apps for legacy workflows are now deprecated. "
                                                            +            "Use new custom steps: https://api.slack.com/automation/functions/custom-bolt"
                                                            +        ),
                                                            +        category=DeprecationWarning,
                                                            +    )
                                                            +    step = callback_id
                                                            +    if isinstance(callback_id, (str, Pattern)):
                                                            +        step = AsyncWorkflowStep(
                                                            +            callback_id=callback_id,
                                                            +            edit=edit,  # type: ignore[arg-type]
                                                            +            save=save,  # type: ignore[arg-type]
                                                            +            execute=execute,  # type: ignore[arg-type]
                                                            +            base_logger=self._base_logger,
                                                            +        )
                                                            +    elif isinstance(step, AsyncWorkflowStepBuilder):
                                                            +        step = step.build(base_logger=self._base_logger)
                                                            +    elif not isinstance(step, AsyncWorkflowStep):
                                                            +        raise BoltError(f"Invalid step object ({type(step)})")
                                                            +
                                                            +    self.use(AsyncWorkflowStepMiddleware(step))
                                                            +

                                                            Deprecated

                                                            Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                            @@ -2156,12 +3011,72 @@

                                                            Args

                                                            def use(self, *args) ‑> Callable | None
                                                            +
                                                            + +Expand source code + +
                                                            def use(self, *args) -> Optional[Callable]:
                                                            +    """Refer to `AsyncApp#middleware()` method's docstring for details."""
                                                            +    return self.middleware(*args)
                                                            +

                                                            Refer to AsyncApp#middleware() method's docstring for details.

                                                            def view(self,
                                                            constraints: str | Pattern | Dict[str, str | Pattern],
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def view(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `view_submission`/`view_closed` event listener.
                                                            +    This method can be used as either a decorator or a method.
                                                            +
                                                            +        # Use this method as a decorator
                                                            +        @app.view("view_1")
                                                            +        async def handle_submission(ack, body, client, view):
                                                            +            # Assume there's an input block with `block_c` as the block_id and `dreamy_input`
                                                            +            hopes_and_dreams = view["state"]["values"]["block_c"]["dreamy_input"]
                                                            +            user = body["user"]["id"]
                                                            +            # Validate the inputs
                                                            +            errors = {}
                                                            +            if hopes_and_dreams is not None and len(hopes_and_dreams) <= 5:
                                                            +                errors["block_c"] = "The value must be longer than 5 characters"
                                                            +            if len(errors) > 0:
                                                            +                await ack(response_action="errors", errors=errors)
                                                            +                return
                                                            +            # Acknowledge the view_submission event and close the modal
                                                            +            await ack()
                                                            +            # Do whatever you want with the input data - here we're saving it to a DB
                                                            +
                                                            +        # Pass a function to this method
                                                            +        app.view("view_1")(handle_submission)
                                                            +
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/views for details of payloads.
                                                            +
                                                            +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.async_args`'s API document.
                                                            +
                                                            +    Args:
                                                            +        constraints: The conditions that match a request payload
                                                            +        matchers: A list of listener matcher functions.
                                                            +            Only when all the matchers return True, the listener function can be invoked.
                                                            +        middleware: A list of lister middleware functions.
                                                            +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                            +    """
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.view(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new view_submission/view_closed event listener. This method can be used as either a decorator or a method.

                                                            # Use this method as a decorator
                                                            @@ -2202,6 +3117,26 @@ 

                                                            Args

                                                            def view_closed(self,
                                                            constraints: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def view_closed(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `view_closed` listener.
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/views#view_closed for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.view_closed(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new view_closed listener. Refer to https://api.slack.com/reference/interaction-payloads/views#view_closed for details.

                                                            @@ -2209,6 +3144,26 @@

                                                            Args

                                                            def view_submission(self,
                                                            constraints: str | Pattern,
                                                            matchers: Sequence[Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: Sequence[Callable | AsyncMiddleware] | None = None) ‑> Callable[..., Callable[..., Awaitable[BoltResponse | None]] | None]
                                                            +
                                                            + +Expand source code + +
                                                            def view_submission(
                                                            +    self,
                                                            +    constraints: Union[str, Pattern],
                                                            +    matchers: Optional[Sequence[Callable[..., Awaitable[bool]]]] = None,
                                                            +    middleware: Optional[Sequence[Union[Callable, AsyncMiddleware]]] = None,
                                                            +) -> Callable[..., Optional[Callable[..., Awaitable[Optional[BoltResponse]]]]]:
                                                            +    """Registers a new `view_submission` listener.
                                                            +    Refer to https://api.slack.com/reference/interaction-payloads/views#view_submission for details."""
                                                            +
                                                            +    def __call__(*args, **kwargs):
                                                            +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                            +        primary_matcher = builtin_matchers.view_submission(constraints, asyncio=True, base_logger=self._base_logger)
                                                            +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                            +
                                                            +    return __call__
                                                            +

                                                            Registers a new view_submission listener. Refer to https://api.slack.com/reference/interaction-payloads/views#view_submission for details.

                                                            @@ -2216,6 +3171,32 @@

                                                            Args

                                                            def web_app(self, path: str = '/slack/events', port: int = 3000) ‑> aiohttp.web_app.Application
                                                            +
                                                            + +Expand source code + +
                                                            def web_app(self, path: str = "/slack/events", port: int = 3000) -> web.Application:
                                                            +    """Returns a `web.Application` instance for aiohttp-devtools users.
                                                            +
                                                            +        from slack_bolt.async_app import AsyncApp
                                                            +        app = AsyncApp()
                                                            +
                                                            +        @app.event("app_mention")
                                                            +        async def event_test(body, say, logger):
                                                            +            logger.info(body)
                                                            +            await say("What's up?")
                                                            +
                                                            +        def app_factory():
                                                            +            return app.web_app()
                                                            +
                                                            +        # adev runserver --port 3000 --app-factory app_factory async_app.py
                                                            +
                                                            +    Args:
                                                            +        path: The path to receive incoming requests from Slack
                                                            +        port: The port to listen on (Default: 3000)
                                                            +    """
                                                            +    return self.server(path=path, port=port).web_app
                                                            +

                                                            Returns a web.Application instance for aiohttp-devtools users.

                                                            from slack_bolt.async_app import AsyncApp
                                                             app = AsyncApp()
                                                            @@ -2245,7 +3226,6 @@ 

                                                            Args

                                                            (*,
                                                            app_name: str = 'assistant',
                                                            thread_context_store: AsyncAssistantThreadContextStore | None = None,
                                                            logger: logging.Logger | None = None)
                                                            -

                                                            A middleware can process request data before other middleware and listener functions.

                                                            Expand source code @@ -2545,6 +3525,7 @@

                                                            Args

                                                            else: raise BoltError(f"Invalid listener: {type(listener_or_functions)} detected")
                                                            +

                                                            A middleware can process request data before other middleware and listener functions.

                                                            Ancestors

                                                            • AsyncMiddleware
                                                            • @@ -2553,11 +3534,11 @@

                                                              Class variables

                                                              var base_logger : logging.Logger | None
                                                              -
                                                              +

                                                              The type of the None singleton.

                                                              var thread_context_storeAsyncAssistantThreadContextStore | None
                                                              -
                                                              +

                                                              The type of the None singleton.

                                                              Static methods

                                                              @@ -2566,6 +3547,15 @@

                                                              Static methods

                                                              async def default_thread_context_changed(save_thread_context: AsyncSaveThreadContext,
                                                              payload: dict)
                                                              +
                                                              + +Expand source code + +
                                                              @staticmethod
                                                              +async def default_thread_context_changed(save_thread_context: AsyncSaveThreadContext, payload: dict):
                                                              +    new_context: dict = payload["assistant_thread"]["context"]
                                                              +    await save_thread_context(new_context)
                                                              +
                                                            @@ -2575,30 +3565,276 @@

                                                            Methods

                                                            def bot_message(self,
                                                            *args,
                                                            matchers: Callable[..., bool] | AsyncListenerMatcher | None = None,
                                                            middleware: Callable | AsyncMiddleware | None = None,
                                                            lazy: List[Callable[..., None]] | None = None)
                                                            +
                                                            + +Expand source code + +
                                                            def bot_message(
                                                            +    self,
                                                            +    *args,
                                                            +    matchers: Optional[Union[Callable[..., bool], AsyncListenerMatcher]] = None,
                                                            +    middleware: Optional[Union[Callable, AsyncMiddleware]] = None,
                                                            +    lazy: Optional[List[Callable[..., None]]] = None,
                                                            +):
                                                            +    if self._bot_message_listeners is None:
                                                            +        self._bot_message_listeners = []
                                                            +    all_matchers = self._merge_matchers(
                                                            +        build_listener_matcher(
                                                            +            func=is_bot_message_event_in_assistant_thread,
                                                            +            asyncio=True,
                                                            +            base_logger=self.base_logger,
                                                            +        ),  # type:ignore[arg-type]
                                                            +        matchers,
                                                            +    )
                                                            +    if is_used_without_argument(args):
                                                            +        func = args[0]
                                                            +        self._bot_message_listeners.append(
                                                            +            self.build_listener(
                                                            +                listener_or_functions=func,
                                                            +                matchers=all_matchers,
                                                            +                middleware=middleware,  # type:ignore[arg-type]
                                                            +            )
                                                            +        )
                                                            +        return func
                                                            +
                                                            +    def _inner(func):
                                                            +        functions = [func] + (lazy if lazy is not None else [])
                                                            +        self._bot_message_listeners.append(
                                                            +            self.build_listener(
                                                            +                listener_or_functions=functions,
                                                            +                matchers=all_matchers,
                                                            +                middleware=middleware,
                                                            +            )
                                                            +        )
                                                            +
                                                            +        @wraps(func)
                                                            +        def _wrapper(*args, **kwargs):
                                                            +            return func(*args, **kwargs)
                                                            +
                                                            +        return _wrapper
                                                            +
                                                            +    return _inner
                                                            +
                                                            def build_listener(self,
                                                            listener_or_functions: AsyncListener | Callable | List[Callable],
                                                            matchers: List[AsyncListenerMatcher | Callable[..., Awaitable[bool]]] | None = None,
                                                            middleware: List[AsyncMiddleware] | None = None,
                                                            base_logger: logging.Logger | None = None) ‑> AsyncListener
                                                            +
                                                            + +Expand source code + +
                                                            def build_listener(
                                                            +    self,
                                                            +    listener_or_functions: Union[AsyncListener, Callable, List[Callable]],
                                                            +    matchers: Optional[List[Union[AsyncListenerMatcher, Callable[..., Awaitable[bool]]]]] = None,
                                                            +    middleware: Optional[List[AsyncMiddleware]] = None,
                                                            +    base_logger: Optional[Logger] = None,
                                                            +) -> AsyncListener:
                                                            +    if isinstance(listener_or_functions, Callable):  # type:ignore[arg-type]
                                                            +        listener_or_functions = [listener_or_functions]  # type:ignore[list-item]
                                                            +
                                                            +    if isinstance(listener_or_functions, AsyncListener):
                                                            +        return listener_or_functions
                                                            +    elif isinstance(listener_or_functions, list):
                                                            +        middleware = middleware if middleware else []
                                                            +        functions = listener_or_functions
                                                            +        ack_function = functions.pop(0)
                                                            +
                                                            +        matchers = matchers if matchers else []
                                                            +        listener_matchers: List[AsyncListenerMatcher] = []
                                                            +        for matcher in matchers:
                                                            +            if isinstance(matcher, AsyncListenerMatcher):
                                                            +                listener_matchers.append(matcher)
                                                            +            else:
                                                            +                listener_matchers.append(
                                                            +                    build_listener_matcher(
                                                            +                        func=matcher,  # type:ignore[arg-type]
                                                            +                        asyncio=True,
                                                            +                        base_logger=base_logger,
                                                            +                    )
                                                            +                )
                                                            +        return AsyncCustomListener(
                                                            +            app_name=self.app_name,
                                                            +            matchers=listener_matchers,
                                                            +            middleware=middleware,
                                                            +            ack_function=ack_function,
                                                            +            lazy_functions=functions,
                                                            +            auto_acknowledgement=True,
                                                            +            base_logger=base_logger or self.base_logger,
                                                            +        )
                                                            +    else:
                                                            +        raise BoltError(f"Invalid listener: {type(listener_or_functions)} detected")
                                                            +
                                                            def thread_context_changed(self,
                                                            *args,
                                                            matchers: Callable[..., bool] | AsyncListenerMatcher | None = None,
                                                            middleware: Callable | AsyncMiddleware | None = None,
                                                            lazy: List[Callable[..., None]] | None = None)
                                                            +
                                                            + +Expand source code + +
                                                            def thread_context_changed(
                                                            +    self,
                                                            +    *args,
                                                            +    matchers: Optional[Union[Callable[..., bool], AsyncListenerMatcher]] = None,
                                                            +    middleware: Optional[Union[Callable, AsyncMiddleware]] = None,
                                                            +    lazy: Optional[List[Callable[..., None]]] = None,
                                                            +):
                                                            +    if self._thread_context_changed_listeners is None:
                                                            +        self._thread_context_changed_listeners = []
                                                            +    all_matchers = self._merge_matchers(
                                                            +        build_listener_matcher(
                                                            +            func=is_assistant_thread_context_changed_event,
                                                            +            asyncio=True,
                                                            +            base_logger=self.base_logger,
                                                            +        ),  # type:ignore[arg-type]
                                                            +        matchers,
                                                            +    )
                                                            +    if is_used_without_argument(args):
                                                            +        func = args[0]
                                                            +        self._thread_context_changed_listeners.append(
                                                            +            self.build_listener(
                                                            +                listener_or_functions=func,
                                                            +                matchers=all_matchers,
                                                            +                middleware=middleware,  # type:ignore[arg-type]
                                                            +            )
                                                            +        )
                                                            +        return func
                                                            +
                                                            +    def _inner(func):
                                                            +        functions = [func] + (lazy if lazy is not None else [])
                                                            +        self._thread_context_changed_listeners.append(
                                                            +            self.build_listener(
                                                            +                listener_or_functions=functions,
                                                            +                matchers=all_matchers,
                                                            +                middleware=middleware,
                                                            +            )
                                                            +        )
                                                            +
                                                            +        @wraps(func)
                                                            +        def _wrapper(*args, **kwargs):
                                                            +            return func(*args, **kwargs)
                                                            +
                                                            +        return _wrapper
                                                            +
                                                            +    return _inner
                                                            +
                                                            def thread_started(self,
                                                            *args,
                                                            matchers: Callable[..., bool] | AsyncListenerMatcher | None = None,
                                                            middleware: Callable | AsyncMiddleware | None = None,
                                                            lazy: List[Callable[..., None]] | None = None)
                                                            +
                                                            + +Expand source code + +
                                                            def thread_started(
                                                            +    self,
                                                            +    *args,
                                                            +    matchers: Optional[Union[Callable[..., bool], AsyncListenerMatcher]] = None,
                                                            +    middleware: Optional[Union[Callable, AsyncMiddleware]] = None,
                                                            +    lazy: Optional[List[Callable[..., None]]] = None,
                                                            +):
                                                            +    if self._thread_started_listeners is None:
                                                            +        self._thread_started_listeners = []
                                                            +    all_matchers = self._merge_matchers(
                                                            +        build_listener_matcher(
                                                            +            func=is_assistant_thread_started_event,
                                                            +            asyncio=True,
                                                            +            base_logger=self.base_logger,
                                                            +        ),  # type:ignore[arg-type]
                                                            +        matchers,
                                                            +    )
                                                            +    if is_used_without_argument(args):
                                                            +        func = args[0]
                                                            +        self._thread_started_listeners.append(
                                                            +            self.build_listener(
                                                            +                listener_or_functions=func,
                                                            +                matchers=all_matchers,
                                                            +                middleware=middleware,  # type:ignore[arg-type]
                                                            +            )
                                                            +        )
                                                            +        return func
                                                            +
                                                            +    def _inner(func):
                                                            +        functions = [func] + (lazy if lazy is not None else [])
                                                            +        self._thread_started_listeners.append(
                                                            +            self.build_listener(
                                                            +                listener_or_functions=functions,
                                                            +                matchers=all_matchers,
                                                            +                middleware=middleware,
                                                            +            )
                                                            +        )
                                                            +
                                                            +        @wraps(func)
                                                            +        def _wrapper(*args, **kwargs):
                                                            +            return func(*args, **kwargs)
                                                            +
                                                            +        return _wrapper
                                                            +
                                                            +    return _inner
                                                            +
                                                            def user_message(self,
                                                            *args,
                                                            matchers: Callable[..., bool] | AsyncListenerMatcher | None = None,
                                                            middleware: Callable | AsyncMiddleware | None = None,
                                                            lazy: List[Callable[..., None]] | None = None)
                                                            +
                                                            + +Expand source code + +
                                                            def user_message(
                                                            +    self,
                                                            +    *args,
                                                            +    matchers: Optional[Union[Callable[..., bool], AsyncListenerMatcher]] = None,
                                                            +    middleware: Optional[Union[Callable, AsyncMiddleware]] = None,
                                                            +    lazy: Optional[List[Callable[..., None]]] = None,
                                                            +):
                                                            +    if self._user_message_listeners is None:
                                                            +        self._user_message_listeners = []
                                                            +    all_matchers = self._merge_matchers(
                                                            +        build_listener_matcher(
                                                            +            func=is_user_message_event_in_assistant_thread,
                                                            +            asyncio=True,
                                                            +            base_logger=self.base_logger,
                                                            +        ),  # type:ignore[arg-type]
                                                            +        matchers,
                                                            +    )
                                                            +    if is_used_without_argument(args):
                                                            +        func = args[0]
                                                            +        self._user_message_listeners.append(
                                                            +            self.build_listener(
                                                            +                listener_or_functions=func,
                                                            +                matchers=all_matchers,
                                                            +                middleware=middleware,  # type:ignore[arg-type]
                                                            +            )
                                                            +        )
                                                            +        return func
                                                            +
                                                            +    def _inner(func):
                                                            +        functions = [func] + (lazy if lazy is not None else [])
                                                            +        self._user_message_listeners.append(
                                                            +            self.build_listener(
                                                            +                listener_or_functions=functions,
                                                            +                matchers=all_matchers,
                                                            +                middleware=middleware,
                                                            +            )
                                                            +        )
                                                            +
                                                            +        @wraps(func)
                                                            +        def _wrapper(*args, **kwargs):
                                                            +            return func(*args, **kwargs)
                                                            +
                                                            +        return _wrapper
                                                            +
                                                            +    return _inner
                                                            +
                                                            @@ -2617,7 +3853,6 @@

                                                            Inherited members

                                                            (*args, **kwargs)
                                                            -

                                                            Context object associated with a request from Slack.

                                                            Expand source code @@ -2813,6 +4048,7 @@

                                                            Inherited members

                                                            def save_thread_context(self) -> Optional[AsyncSaveThreadContext]: return self.get("save_thread_context")
                                                            +

                                                            Context object associated with a request from Slack.

                                                            Ancestors

                                                            • BaseContext
                                                            • @@ -2822,18 +4058,6 @@

                                                              Instance variables

                                                              prop ackAsyncAck
                                                              -

                                                              ack() function for this request.

                                                              -
                                                              @app.action("button")
                                                              -async def handle_button_clicks(context):
                                                              -    await context.ack()
                                                              -
                                                              -# You can access "ack" this way too.
                                                              -@app.action("button")
                                                              -async def handle_button_clicks(ack):
                                                              -    await ack()
                                                              -
                                                              -

                                                              Returns

                                                              -

                                                              Callable ack() function

                                                              Expand source code @@ -2858,27 +4082,21 @@

                                                              Returns

                                                              self["ack"] = AsyncAck() return self["ack"]
                                                            -
                                                            -
                                                            prop client : slack_sdk.web.async_client.AsyncWebClient
                                                            -
                                                            -

                                                            The AsyncWebClient instance available for this request.

                                                            -
                                                            @app.event("app_mention")
                                                            -async def handle_events(context):
                                                            -    await context.client.chat_postMessage(
                                                            -        channel=context.channel_id,
                                                            -        text="Thanks!",
                                                            -    )
                                                            +

                                                            ack() function for this request.

                                                            +
                                                            @app.action("button")
                                                            +async def handle_button_clicks(context):
                                                            +    await context.ack()
                                                             
                                                            -# You can access "client" this way too.
                                                            -@app.event("app_mention")
                                                            -async def handle_events(client, context):
                                                            -    await client.chat_postMessage(
                                                            -        channel=context.channel_id,
                                                            -        text="Thanks!",
                                                            -    )
                                                            +# You can access "ack" this way too.
                                                            +@app.action("button")
                                                            +async def handle_button_clicks(ack):
                                                            +    await ack()
                                                             

                                                            Returns

                                                            -

                                                            AsyncWebClient instance

                                                            +

                                                            Callable ack() function

                                                            +
                                                            +
                                                            prop client : slack_sdk.web.async_client.AsyncWebClient
                                                            +
                                                            Expand source code @@ -2908,26 +4126,28 @@

                                                            Returns

                                                            if "client" not in self: self["client"] = AsyncWebClient(token=None) return self["client"]
                                                            - -
                                                            -
                                                            prop completeAsyncComplete
                                                            -
                                                            -

                                                            complete() function for this request. Once a custom function's state is set to complete, -any outputs the function returns will be passed along to the next step of its housing workflow, -or complete the workflow if the function is the last step in a workflow. Additionally, -any interactivity handlers associated to a function invocation will no longer be invocable.

                                                            -
                                                            @app.function("reverse")
                                                            -async def handle_button_clicks(ack, complete):
                                                            -    await ack()
                                                            -    await complete(outputs={"stringReverse":"olleh"})
                                                            +
                                                            +

                                                            The AsyncWebClient instance available for this request.

                                                            +
                                                            @app.event("app_mention")
                                                            +async def handle_events(context):
                                                            +    await context.client.chat_postMessage(
                                                            +        channel=context.channel_id,
                                                            +        text="Thanks!",
                                                            +    )
                                                             
                                                            -@app.function("reverse")
                                                            -async def handle_button_clicks(context):
                                                            -    await context.ack()
                                                            -    await context.complete(outputs={"stringReverse":"olleh"})
                                                            +# You can access "client" this way too.
                                                            +@app.event("app_mention")
                                                            +async def handle_events(client, context):
                                                            +    await client.chat_postMessage(
                                                            +        channel=context.channel_id,
                                                            +        text="Thanks!",
                                                            +    )
                                                             

                                                            Returns

                                                            -

                                                            Callable complete() function

                                                            +

                                                            AsyncWebClient instance

                                                            +
                                                            +
                                                            prop completeAsyncComplete
                                                            +
                                                            Expand source code @@ -2956,25 +4176,25 @@

                                                            Returns

                                                            self["complete"] = AsyncComplete(client=self.client, function_execution_id=self.function_execution_id) return self["complete"]
                                                            -
                                                            -
                                                            prop failAsyncFail
                                                            -
                                                            -

                                                            fail() function for this request. Once a custom function's state is set to error, -its housing workflow will be interrupted and any provided error message will be passed -on to the end user through SlackBot. Additionally, any interactivity handlers associated -to a function invocation will no longer be invocable.

                                                            +

                                                            complete() function for this request. Once a custom function's state is set to complete, +any outputs the function returns will be passed along to the next step of its housing workflow, +or complete the workflow if the function is the last step in a workflow. Additionally, +any interactivity handlers associated to a function invocation will no longer be invocable.

                                                            @app.function("reverse")
                                                            -async def handle_button_clicks(ack, fail):
                                                            +async def handle_button_clicks(ack, complete):
                                                                 await ack()
                                                            -    await fail(error="something went wrong")
                                                            +    await complete(outputs={"stringReverse":"olleh"})
                                                             
                                                             @app.function("reverse")
                                                             async def handle_button_clicks(context):
                                                                 await context.ack()
                                                            -    await context.fail(error="something went wrong")
                                                            +    await context.complete(outputs={"stringReverse":"olleh"})
                                                             

                                                            Returns

                                                            -

                                                            Callable fail() function

                                                            +

                                                            Callable complete() function

                                                            +
                                                            +
                                                            prop failAsyncFail
                                                            +
                                                            Expand source code @@ -3003,10 +4223,25 @@

                                                            Returns

                                                            self["fail"] = AsyncFail(client=self.client, function_execution_id=self.function_execution_id) return self["fail"]
                                                            +

                                                            fail() function for this request. Once a custom function's state is set to error, +its housing workflow will be interrupted and any provided error message will be passed +on to the end user through SlackBot. Additionally, any interactivity handlers associated +to a function invocation will no longer be invocable.

                                                            +
                                                            @app.function("reverse")
                                                            +async def handle_button_clicks(ack, fail):
                                                            +    await ack()
                                                            +    await fail(error="something went wrong")
                                                            +
                                                            +@app.function("reverse")
                                                            +async def handle_button_clicks(context):
                                                            +    await context.ack()
                                                            +    await context.fail(error="something went wrong")
                                                            +
                                                            +

                                                            Returns

                                                            +

                                                            Callable fail() function

                                                            prop get_thread_contextAsyncGetThreadContext | None
                                                            -
                                                            Expand source code @@ -3015,10 +4250,10 @@

                                                            Returns

                                                            def get_thread_context(self) -> Optional[AsyncGetThreadContext]: return self.get("get_thread_context")
                                                            +
                                                            prop listener_runner : AsyncioListenerRunner
                                                            -

                                                            The properly configured listener_runner that is available for middleware/listeners.

                                                            Expand source code @@ -3028,23 +4263,10 @@

                                                            Returns

                                                            """The properly configured listener_runner that is available for middleware/listeners.""" return self["listener_runner"]
                                                            +

                                                            The properly configured listener_runner that is available for middleware/listeners.

                                                            prop respondAsyncRespond | None
                                                            -

                                                            respond() function for this request.

                                                            -
                                                            @app.action("button")
                                                            -async def handle_button_clicks(context):
                                                            -    await context.ack()
                                                            -    await context.respond("Hi!")
                                                            -
                                                            -# You can access "ack" this way too.
                                                            -@app.action("button")
                                                            -async def handle_button_clicks(ack, respond):
                                                            -    await ack()
                                                            -    await respond("Hi!")
                                                            -
                                                            -

                                                            Returns

                                                            -

                                                            Callable respond() function

                                                            Expand source code @@ -3075,10 +4297,23 @@

                                                            Returns

                                                            ) return self["respond"]
                                                            +

                                                            respond() function for this request.

                                                            +
                                                            @app.action("button")
                                                            +async def handle_button_clicks(context):
                                                            +    await context.ack()
                                                            +    await context.respond("Hi!")
                                                            +
                                                            +# You can access "ack" this way too.
                                                            +@app.action("button")
                                                            +async def handle_button_clicks(ack, respond):
                                                            +    await ack()
                                                            +    await respond("Hi!")
                                                            +
                                                            +

                                                            Returns

                                                            +

                                                            Callable respond() function

                                                            prop save_thread_contextAsyncSaveThreadContext | None
                                                            -
                                                            Expand source code @@ -3087,23 +4322,10 @@

                                                            Returns

                                                            def save_thread_context(self) -> Optional[AsyncSaveThreadContext]: return self.get("save_thread_context")
                                                            +
                                                            prop sayAsyncSay
                                                            -

                                                            say() function for this request.

                                                            -
                                                            @app.action("button")
                                                            -async def handle_button_clicks(context):
                                                            -    await context.ack()
                                                            -    await context.say("Hi!")
                                                            -
                                                            -# You can access "ack" this way too.
                                                            -@app.action("button")
                                                            -async def handle_button_clicks(ack, say):
                                                            -    await ack()
                                                            -    await say("Hi!")
                                                            -
                                                            -

                                                            Returns

                                                            -

                                                            Callable say() function

                                                            Expand source code @@ -3130,10 +4352,23 @@

                                                            Returns

                                                            self["say"] = AsyncSay(client=self.client, channel=self.channel_id, thread_ts=self.thread_ts) return self["say"]
                                                            +

                                                            say() function for this request.

                                                            +
                                                            @app.action("button")
                                                            +async def handle_button_clicks(context):
                                                            +    await context.ack()
                                                            +    await context.say("Hi!")
                                                            +
                                                            +# You can access "ack" this way too.
                                                            +@app.action("button")
                                                            +async def handle_button_clicks(ack, say):
                                                            +    await ack()
                                                            +    await say("Hi!")
                                                            +
                                                            +

                                                            Returns

                                                            +

                                                            Callable say() function

                                                            prop set_statusAsyncSetStatus | None
                                                            -
                                                            Expand source code @@ -3142,10 +4377,10 @@

                                                            Returns

                                                            def set_status(self) -> Optional[AsyncSetStatus]: return self.get("set_status")
                                                            +
                                                            prop set_suggested_promptsAsyncSetSuggestedPrompts | None
                                                            -
                                                            Expand source code @@ -3154,10 +4389,10 @@

                                                            Returns

                                                            def set_suggested_prompts(self) -> Optional[AsyncSetSuggestedPrompts]: return self.get("set_suggested_prompts")
                                                            +
                                                            prop set_titleAsyncSetTitle | None
                                                            -
                                                            Expand source code @@ -3166,6 +4401,7 @@

                                                            Returns

                                                            def set_title(self) -> Optional[AsyncSetTitle]: return self.get("set_title")
                                                            +

                                                            Methods

                                                            @@ -3174,6 +4410,30 @@

                                                            Methods

                                                            def to_copyable(self) ‑> AsyncBoltContext
                                                            +
                                                            + +Expand source code + +
                                                            def to_copyable(self) -> "AsyncBoltContext":
                                                            +    new_dict = {}
                                                            +    for prop_name, prop_value in self.items():
                                                            +        if prop_name in self.copyable_standard_property_names:
                                                            +            # all the standard properties are copiable
                                                            +            new_dict[prop_name] = prop_value
                                                            +        elif prop_name in self.non_copyable_standard_property_names:
                                                            +            # Do nothing with this property (e.g., listener_runner)
                                                            +            continue
                                                            +        else:
                                                            +            try:
                                                            +                copied_value = create_copy(prop_value)
                                                            +                new_dict[prop_name] = copied_value
                                                            +            except TypeError as te:
                                                            +                self.logger.debug(
                                                            +                    f"Skipped setting '{prop_name}' to a copied request for lazy listeners "
                                                            +                    f"as it's not possible to make a deep copy (error: {te})"
                                                            +                )
                                                            +    return AsyncBoltContext(new_dict)
                                                            +
                                                            @@ -3189,6 +4449,7 @@

                                                            Inherited members

                                                          • bot_token
                                                          • bot_user_id
                                                          • channel_id
                                                          • +
                                                          • copyable_standard_property_names
                                                          • enterprise_id
                                                          • function_bot_access_token
                                                          • function_execution_id
                                                          • @@ -3196,7 +4457,9 @@

                                                            Inherited members

                                                          • is_enterprise_install
                                                          • logger
                                                          • matches
                                                          • +
                                                          • non_copyable_standard_property_names
                                                          • response_url
                                                          • +
                                                          • standard_property_names
                                                          • team_id
                                                          • thread_ts
                                                          • token
                                                          • @@ -3211,20 +4474,6 @@

                                                            Inherited members

                                                            (*,
                                                            body: str | dict,
                                                            query: str | Dict[str, str] | Dict[str, Sequence[str]] | None = None,
                                                            headers: Dict[str, str | Sequence[str]] | None = None,
                                                            context: Dict[str, Any] | None = None,
                                                            mode: str = 'http')
                                                            -

                                                            Request to a Bolt app.

                                                            -

                                                            Args

                                                            -
                                                            -
                                                            body
                                                            -
                                                            The raw request body (only plain text is supported for "http" mode)
                                                            -
                                                            query
                                                            -
                                                            The query string data in any data format.
                                                            -
                                                            headers
                                                            -
                                                            The request headers.
                                                            -
                                                            context
                                                            -
                                                            The context in this request.
                                                            -
                                                            mode
                                                            -
                                                            The mode used for this request. (either "http" or "socket_mode")
                                                            -
                                                            Expand source code @@ -3299,43 +4548,57 @@

                                                            Args

                                                            mode=self.mode, )
                                                            +

                                                            Request to a Bolt app.

                                                            +

                                                            Args

                                                            +
                                                            +
                                                            body
                                                            +
                                                            The raw request body (only plain text is supported for "http" mode)
                                                            +
                                                            query
                                                            +
                                                            The query string data in any data format.
                                                            +
                                                            headers
                                                            +
                                                            The request headers.
                                                            +
                                                            context
                                                            +
                                                            The context in this request.
                                                            +
                                                            mode
                                                            +
                                                            The mode used for this request. (either "http" or "socket_mode")
                                                            +

                                                            Class variables

                                                            var body : Dict[str, Any]
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            var content_type : str | None
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            var contextAsyncBoltContext
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            var headers : Dict[str, Sequence[str]]
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            var lazy_function_name : str | None
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            var lazy_only : bool
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            var mode : str
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            var query : Dict[str, Sequence[str]]
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            var raw_body : str
                                                            -
                                                            +

                                                            The type of the None singleton.

                                                            Methods

                                                            @@ -3344,6 +4607,20 @@

                                                            Methods

                                                            def to_copyable(self) ‑> AsyncBoltRequest
                                                            +
                                                            + +Expand source code + +
                                                            def to_copyable(self) -> "AsyncBoltRequest":
                                                            +    body: Union[str, dict] = self.raw_body if self.mode == "http" else self.body
                                                            +    return AsyncBoltRequest(
                                                            +        body=body,
                                                            +        query=self.query,
                                                            +        headers=self.headers,
                                                            +        context=self.context.to_copyable(),
                                                            +        mode=self.mode,
                                                            +    )
                                                            +
                                                            @@ -3353,7 +4630,6 @@

                                                            Methods

                                                            (*,
                                                            app_name: str,
                                                            func: Callable[..., Awaitable[bool]],
                                                            base_logger: logging.Logger | None = None)
                                                            -
                                                            Expand source code @@ -3381,6 +4657,7 @@

                                                            Methods

                                                            ) )
                                                            +

                                                            Ancestors

                                                            • AsyncListenerMatcher
                                                            • @@ -3389,19 +4666,19 @@

                                                              Class variables

                                                              var app_name : str
                                                              -
                                                              +

                                                              The type of the None singleton.

                                                              var arg_names : Sequence[str]
                                                              -
                                                              +

                                                              The type of the None singleton.

                                                              var func : Callable[..., Awaitable[bool]]
                                                              -
                                                              +

                                                              The type of the None singleton.

                                                              var logger : logging.Logger
                                                              -
                                                              +

                                                              The type of the None singleton.

                                                              Inherited members

                                                              @@ -3418,7 +4695,6 @@

                                                              Inherited members

                                                              (thread_context_store: AsyncAssistantThreadContextStore,
                                                              channel_id: str,
                                                              thread_ts: str,
                                                              payload: dict)
                                                              -
                                                              Expand source code @@ -3466,27 +4742,28 @@

                                                              Inherited members

                                                              return self._thread_context
                                                              +

                                                              Class variables

                                                              var channel_id : str
                                                              -
                                                              +

                                                              The type of the None singleton.

                                                              var payload : dict
                                                              -
                                                              +

                                                              The type of the None singleton.

                                                              var thread_context_loaded : bool
                                                              -
                                                              +

                                                              The type of the None singleton.

                                                              var thread_context_storeAsyncAssistantThreadContextStore
                                                              -
                                                              +

                                                              The type of the None singleton.

                                                              var thread_ts : str
                                                              -
                                                              +

                                                              The type of the None singleton.

                                                              @@ -3494,7 +4771,6 @@

                                                              Class variables

                                                              class AsyncListener
                                                              -
                                                              Expand source code @@ -3559,6 +4835,7 @@

                                                              Class variables

                                                              """ raise NotImplementedError()
                                                              +

                                                              Subclasses

                                                              • AsyncCustomListener
                                                              • @@ -3567,23 +4844,23 @@

                                                                Class variables

                                                                var ack_function : Callable[..., Awaitable[BoltResponse]]
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var auto_acknowledgement : bool
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var lazy_functions : Sequence[Callable[..., Awaitable[None]]]
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var matchers : Sequence[AsyncListenerMatcher]
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var middleware : Sequence[AsyncMiddleware]
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                Methods

                                                                @@ -3592,12 +4869,46 @@

                                                                Methods

                                                                async def async_matches(self,
                                                                *,
                                                                req: AsyncBoltRequest,
                                                                resp: BoltResponse) ‑> bool
                                                                +
                                                                + +Expand source code + +
                                                                async def async_matches(
                                                                +    self,
                                                                +    *,
                                                                +    req: AsyncBoltRequest,
                                                                +    resp: BoltResponse,
                                                                +) -> bool:
                                                                +    is_matched: bool = False
                                                                +    for matcher in self.matchers:
                                                                +        is_matched = await matcher.async_matches(req, resp)
                                                                +        if not is_matched:
                                                                +            return is_matched
                                                                +    return is_matched
                                                                +
                                                                async def run_ack_function(self,
                                                                *,
                                                                request: AsyncBoltRequest,
                                                                response: BoltResponse) ‑> BoltResponse | None
                                                                +
                                                                + +Expand source code + +
                                                                @abstractmethod
                                                                +async def run_ack_function(self, *, request: AsyncBoltRequest, response: BoltResponse) -> Optional[BoltResponse]:
                                                                +    """Runs all the registered middleware and then run the listener function.
                                                                +
                                                                +    Args:
                                                                +        request: The incoming request
                                                                +        response: The current response
                                                                +
                                                                +    Returns:
                                                                +        The processed response
                                                                +    """
                                                                +    raise NotImplementedError()
                                                                +

                                                                Runs all the registered middleware and then run the listener function.

                                                                Args

                                                                @@ -3613,6 +4924,37 @@

                                                                Returns

                                                                async def run_async_middleware(self,
                                                                *,
                                                                req: AsyncBoltRequest,
                                                                resp: BoltResponse) ‑> Tuple[BoltResponse | None, bool]
                                                                +
                                                                + +Expand source code + +
                                                                async def run_async_middleware(
                                                                +    self,
                                                                +    *,
                                                                +    req: AsyncBoltRequest,
                                                                +    resp: BoltResponse,
                                                                +) -> Tuple[Optional[BoltResponse], bool]:
                                                                +    """Runs an async middleware.
                                                                +
                                                                +    Args:
                                                                +        req: The incoming request
                                                                +        resp: The current response
                                                                +
                                                                +    Returns:
                                                                +        A tuple of the processed response and a flag indicating termination
                                                                +    """
                                                                +    for m in self.middleware:
                                                                +        middleware_state = {"next_called": False}
                                                                +
                                                                +        async def _next():
                                                                +            middleware_state["next_called"] = True
                                                                +
                                                                +        resp = await m.async_process(req=req, resp=resp, next=_next)  # type: ignore[assignment]
                                                                +        if not middleware_state["next_called"]:
                                                                +            # next() was not called in this middleware
                                                                +            return (resp, True)
                                                                +    return (resp, False)
                                                                +

                                                                Runs an async middleware.

                                                                Args

                                                                @@ -3631,7 +4973,6 @@

                                                                Returns

                                                                (*,
                                                                response_url: str | None,
                                                                proxy: str | None = None,
                                                                ssl: ssl.SSLContext | None = None)
                                                                -
                                                                Expand source code @@ -3695,19 +5036,20 @@

                                                                Returns

                                                                else: raise ValueError("respond is unsupported here as there is no response_url")
                                                                +

                                                                Class variables

                                                                var proxy : str | None
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var response_url : str | None
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var ssl : ssl.SSLContext | None
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                @@ -3716,7 +5058,6 @@

                                                                Class variables

                                                                (thread_context_store: AsyncAssistantThreadContextStore,
                                                                channel_id: str,
                                                                thread_ts: str)
                                                                -
                                                                Expand source code @@ -3743,19 +5084,20 @@

                                                                Class variables

                                                                context=new_context, )
                                                                +

                                                                Class variables

                                                                var channel_id : str
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var thread_context_storeAsyncAssistantThreadContextStore
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var thread_ts : str
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                @@ -3764,7 +5106,6 @@

                                                                Class variables

                                                                (client: slack_sdk.web.async_client.AsyncWebClient | None,
                                                                channel: str | None,
                                                                thread_ts: str | None = None,
                                                                build_metadata: Callable[[], Awaitable[Dict | slack_sdk.models.metadata.Metadata]] | None = None)
                                                                -
                                                                Expand source code @@ -3846,23 +5187,24 @@

                                                                Class variables

                                                                else: raise ValueError("say without channel_id here is unsupported")
                                                                +

                                                                Class variables

                                                                var build_metadata : Callable[[], Awaitable[Dict | slack_sdk.models.metadata.Metadata]] | None
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var channel : str | None
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var client : slack_sdk.web.async_client.AsyncWebClient | None
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var thread_ts : str | None
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                @@ -3871,7 +5213,6 @@

                                                                Class variables

                                                                (client: slack_sdk.web.async_client.AsyncWebClient,
                                                                channel_id: str,
                                                                thread_ts: str)
                                                                -
                                                                Expand source code @@ -3898,19 +5239,20 @@

                                                                Class variables

                                                                thread_ts=self.thread_ts, )
                                                                +

                                                                Class variables

                                                                var channel_id : str
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var client : slack_sdk.web.async_client.AsyncWebClient
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var thread_ts : str
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                @@ -3919,7 +5261,6 @@

                                                                Class variables

                                                                (client: slack_sdk.web.async_client.AsyncWebClient,
                                                                channel_id: str,
                                                                thread_ts: str)
                                                                -
                                                                Expand source code @@ -3958,19 +5299,20 @@

                                                                Class variables

                                                                title=title, )
                                                                +

                                                                Class variables

                                                                var channel_id : str
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var client : slack_sdk.web.async_client.AsyncWebClient
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var thread_ts : str
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                @@ -3979,7 +5321,6 @@

                                                                Class variables

                                                                (client: slack_sdk.web.async_client.AsyncWebClient,
                                                                channel_id: str,
                                                                thread_ts: str)
                                                                -
                                                                Expand source code @@ -4006,19 +5347,20 @@

                                                                Class variables

                                                                thread_ts=self.thread_ts, )
                                                                +

                                                                Class variables

                                                                var channel_id : str
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var client : slack_sdk.web.async_client.AsyncWebClient
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var thread_ts : str
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                @@ -4221,7 +5563,7 @@

                                                                -

                                                                Generated by pdoc 0.11.3.

                                                                +

                                                                Generated by pdoc 0.11.5.

                                                                diff --git a/docs/static/api-docs/slack_bolt/authorization/async_authorize.html b/docs/static/api-docs/slack_bolt/authorization/async_authorize.html index 7012e07b..0a064078 100644 --- a/docs/static/api-docs/slack_bolt/authorization/async_authorize.html +++ b/docs/static/api-docs/slack_bolt/authorization/async_authorize.html @@ -3,19 +3,30 @@ - + slack_bolt.authorization.async_authorize API documentation - + @@ -39,8 +50,6 @@

                                                                Classes

                                                                class AsyncAuthorize
                                                                -

                                                                This provides authorize function that returns AuthorizeResult -for an incoming request from Slack.

                                                                Expand source code @@ -66,6 +75,8 @@

                                                                Classes

                                                                ) -> Optional[AuthorizeResult]: raise NotImplementedError()
                                                                +

                                                                This provides authorize function that returns AuthorizeResult +for an incoming request from Slack.

                                                                Subclasses

                                                                • AsyncCallableAuthorize
                                                                • @@ -77,8 +88,6 @@

                                                                  Subclasses

                                                                  (*,
                                                                  logger: logging.Logger,
                                                                  func: Callable[..., Awaitable[AuthorizeResult]])
                                                                  -

                                                                  When you pass the authorize argument in AsyncApp constructor, -This authorize implementation will be used.

                                                                  Expand source code @@ -149,6 +158,8 @@

                                                                  Subclasses

                                                                  ) return None
                                                                  +

                                                                  When you pass the authorize argument in AsyncApp constructor, +This authorize implementation will be used.

                                                                  Ancestors

                                                                  • AsyncAuthorize
                                                                  • @@ -159,9 +170,6 @@

                                                                    Ancestors

                                                                    (*,
                                                                    logger: logging.Logger,
                                                                    installation_store: slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore,
                                                                    client_id: str | None = None,
                                                                    client_secret: str | None = None,
                                                                    token_rotation_expiration_minutes: int | None = None,
                                                                    bot_only: bool = False,
                                                                    cache_enabled: bool = False,
                                                                    client: slack_sdk.web.async_client.AsyncWebClient | None = None,
                                                                    user_token_resolution: str = 'authed_user')
                                                                    -

                                                                    If you use the OAuth flow settings, this authorize implementation will be used. -As long as your own InstallationStore (or the built-in ones) works as you expect, -you can expect that the authorize layer should work for you without any customization.

                                                                    Expand source code @@ -437,6 +445,9 @@

                                                                    Ancestors

                                                                    await self.installation_store.async_save(refreshed) return refreshed
                                                                    +

                                                                    If you use the OAuth flow settings, this authorize implementation will be used. +As long as your own InstallationStore (or the built-in ones) works as you expect, +you can expect that the authorize layer should work for you without any customization.

                                                                    Ancestors

                                                                    • AsyncAuthorize
                                                                    • @@ -445,27 +456,27 @@

                                                                      Class variables

                                                                      var authorize_result_cache : Dict[str, AuthorizeResult]
                                                                      -
                                                                      +

                                                                      The type of the None singleton.

                                                                      var bot_only : bool
                                                                      -
                                                                      +

                                                                      The type of the None singleton.

                                                                      var find_bot_available : bool | None
                                                                      -
                                                                      +

                                                                      The type of the None singleton.

                                                                      var find_installation_available : bool | None
                                                                      -
                                                                      +

                                                                      The type of the None singleton.

                                                                      var token_rotator : slack_sdk.oauth.token_rotation.async_rotator.AsyncTokenRotator | None
                                                                      -
                                                                      +

                                                                      The type of the None singleton.

                                                                      var user_token_resolution : str
                                                                      -
                                                                      +

                                                                      The type of the None singleton.

                                                                    @@ -507,7 +518,7 @@

                                                                    -

                                                                    Generated by pdoc 0.11.3.

                                                                    +

                                                                    Generated by pdoc 0.11.5.

                                                                    diff --git a/docs/static/api-docs/slack_bolt/authorization/async_authorize_args.html b/docs/static/api-docs/slack_bolt/authorization/async_authorize_args.html index 2b1ea126..642b35f9 100644 --- a/docs/static/api-docs/slack_bolt/authorization/async_authorize_args.html +++ b/docs/static/api-docs/slack_bolt/authorization/async_authorize_args.html @@ -3,19 +3,30 @@ - + slack_bolt.authorization.async_authorize_args API documentation - + @@ -40,18 +51,6 @@

                                                                    Classes

                                                                    (*,
                                                                    context: AsyncBoltContext,
                                                                    enterprise_id: str | None,
                                                                    team_id: str | None,
                                                                    user_id: str | None)
                                                                    -

                                                                    The full list of the arguments passed to authorize function.

                                                                    -

                                                                    Args

                                                                    -
                                                                    -
                                                                    context
                                                                    -
                                                                    The request context
                                                                    -
                                                                    enterprise_id
                                                                    -
                                                                    The Organization ID (Enterprise Grid)
                                                                    -
                                                                    team_id
                                                                    -
                                                                    The workspace ID
                                                                    -
                                                                    user_id
                                                                    -
                                                                    The request user ID
                                                                    -
                                                                    Expand source code @@ -87,31 +86,43 @@

                                                                    Args

                                                                    self.team_id = team_id self.user_id = user_id
                                                                    +

                                                                    The full list of the arguments passed to authorize function.

                                                                    +

                                                                    Args

                                                                    +
                                                                    +
                                                                    context
                                                                    +
                                                                    The request context
                                                                    +
                                                                    enterprise_id
                                                                    +
                                                                    The Organization ID (Enterprise Grid)
                                                                    +
                                                                    team_id
                                                                    +
                                                                    The workspace ID
                                                                    +
                                                                    user_id
                                                                    +
                                                                    The request user ID
                                                                    +

                                                                    Class variables

                                                                    var client : slack_sdk.web.async_client.AsyncWebClient
                                                                    -
                                                                    +

                                                                    The type of the None singleton.

                                                                    var contextAsyncBoltContext
                                                                    -
                                                                    +

                                                                    The type of the None singleton.

                                                                    var enterprise_id : str | None
                                                                    -
                                                                    +

                                                                    The type of the None singleton.

                                                                    var logger : logging.Logger
                                                                    -
                                                                    +

                                                                    The type of the None singleton.

                                                                    var team_id : str | None
                                                                    -
                                                                    +

                                                                    The type of the None singleton.

                                                                    var user_id : str | None
                                                                    -
                                                                    +

                                                                    The type of the None singleton.

                                                                    @@ -147,7 +158,7 @@

                                                                    -

                                                                    Generated by pdoc 0.11.3.

                                                                    +

                                                                    Generated by pdoc 0.11.5.

                                                                    diff --git a/docs/static/api-docs/slack_bolt/authorization/authorize.html b/docs/static/api-docs/slack_bolt/authorization/authorize.html index b838b659..255c8719 100644 --- a/docs/static/api-docs/slack_bolt/authorization/authorize.html +++ b/docs/static/api-docs/slack_bolt/authorization/authorize.html @@ -3,19 +3,30 @@ - + slack_bolt.authorization.authorize API documentation - + @@ -39,8 +50,6 @@

                                                                    Classes

                                                                    class Authorize
                                                                    -

                                                                    This provides authorize function that returns AuthorizeResult -for an incoming request from Slack.

                                                                    Expand source code @@ -66,6 +75,8 @@

                                                                    Classes

                                                                    ) -> Optional[AuthorizeResult]: raise NotImplementedError()
                                                                    +

                                                                    This provides authorize function that returns AuthorizeResult +for an incoming request from Slack.

                                                                    Subclasses

                                                                    • CallableAuthorize
                                                                    • @@ -77,8 +88,6 @@

                                                                      Subclasses

                                                                      (*,
                                                                      logger: logging.Logger,
                                                                      func: Callable[..., AuthorizeResult])
                                                                      -

                                                                      When you pass the authorize argument in AsyncApp constructor, -This authorize implementation will be used.

                                                                      Expand source code @@ -154,6 +163,8 @@

                                                                      Subclasses

                                                                      ) return None
                                                                      +

                                                                      When you pass the authorize argument in AsyncApp constructor, +This authorize implementation will be used.

                                                                      Ancestors

                                                                      • Authorize
                                                                      • @@ -164,9 +175,6 @@

                                                                        Ancestors

                                                                        (*,
                                                                        logger: logging.Logger,
                                                                        installation_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore,
                                                                        client_id: str | None = None,
                                                                        client_secret: str | None = None,
                                                                        token_rotation_expiration_minutes: int | None = None,
                                                                        bot_only: bool = False,
                                                                        cache_enabled: bool = False,
                                                                        client: slack_sdk.web.client.WebClient | None = None,
                                                                        user_token_resolution: str = 'authed_user')
                                                                        -

                                                                        If you use the OAuth flow settings, this authorize implementation will be used. -As long as your own InstallationStore (or the built-in ones) works as you expect, -you can expect that the authorize layer should work for you without any customization.

                                                                        Expand source code @@ -435,6 +443,9 @@

                                                                        Ancestors

                                                                        self.installation_store.save(refreshed) return refreshed
                                                                        +

                                                                        If you use the OAuth flow settings, this authorize implementation will be used. +As long as your own InstallationStore (or the built-in ones) works as you expect, +you can expect that the authorize layer should work for you without any customization.

                                                                        Ancestors

                                                                        • Authorize
                                                                        • @@ -443,27 +454,27 @@

                                                                          Class variables

                                                                          var authorize_result_cache : Dict[str, AuthorizeResult]
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var bot_only : bool
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var find_bot_available : bool
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var find_installation_available : bool
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var token_rotator : slack_sdk.oauth.token_rotation.rotator.TokenRotator | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var user_token_resolution : str
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                        @@ -505,7 +516,7 @@

                                                                        -

                                                                        Generated by pdoc 0.11.3.

                                                                        +

                                                                        Generated by pdoc 0.11.5.

                                                                        diff --git a/docs/static/api-docs/slack_bolt/authorization/authorize_args.html b/docs/static/api-docs/slack_bolt/authorization/authorize_args.html index 5e9e210b..660ac17e 100644 --- a/docs/static/api-docs/slack_bolt/authorization/authorize_args.html +++ b/docs/static/api-docs/slack_bolt/authorization/authorize_args.html @@ -3,19 +3,30 @@ - + slack_bolt.authorization.authorize_args API documentation - + @@ -40,18 +51,6 @@

                                                                        Classes

                                                                        (*,
                                                                        context: BoltContext,
                                                                        enterprise_id: str | None,
                                                                        team_id: str | None,
                                                                        user_id: str | None)
                                                                        -

                                                                        The full list of the arguments passed to authorize function.

                                                                        -

                                                                        Args

                                                                        -
                                                                        -
                                                                        context
                                                                        -
                                                                        The request context
                                                                        -
                                                                        enterprise_id
                                                                        -
                                                                        The Organization ID (Enterprise Grid)
                                                                        -
                                                                        team_id
                                                                        -
                                                                        The workspace ID
                                                                        -
                                                                        user_id
                                                                        -
                                                                        The request user ID
                                                                        -
                                                                        Expand source code @@ -87,31 +86,43 @@

                                                                        Args

                                                                        self.team_id = team_id self.user_id = user_id
                                                                        +

                                                                        The full list of the arguments passed to authorize function.

                                                                        +

                                                                        Args

                                                                        +
                                                                        +
                                                                        context
                                                                        +
                                                                        The request context
                                                                        +
                                                                        enterprise_id
                                                                        +
                                                                        The Organization ID (Enterprise Grid)
                                                                        +
                                                                        team_id
                                                                        +
                                                                        The workspace ID
                                                                        +
                                                                        user_id
                                                                        +
                                                                        The request user ID
                                                                        +

                                                                        Class variables

                                                                        var client : slack_sdk.web.client.WebClient
                                                                        -
                                                                        +

                                                                        The type of the None singleton.

                                                                        var contextBoltContext
                                                                        -
                                                                        +

                                                                        The type of the None singleton.

                                                                        var enterprise_id : str | None
                                                                        -
                                                                        +

                                                                        The type of the None singleton.

                                                                        var logger : logging.Logger
                                                                        -
                                                                        +

                                                                        The type of the None singleton.

                                                                        var team_id : str | None
                                                                        -
                                                                        +

                                                                        The type of the None singleton.

                                                                        var user_id : str | None
                                                                        -
                                                                        +

                                                                        The type of the None singleton.

                                                                        @@ -147,7 +158,7 @@

                                                                        diff --git a/docs/static/api-docs/slack_bolt/authorization/authorize_result.html b/docs/static/api-docs/slack_bolt/authorization/authorize_result.html index 9202bd54..3bddc0a3 100644 --- a/docs/static/api-docs/slack_bolt/authorization/authorize_result.html +++ b/docs/static/api-docs/slack_bolt/authorization/authorize_result.html @@ -3,19 +3,30 @@ - + slack_bolt.authorization.authorize_result API documentation - + @@ -40,34 +51,6 @@

                                                                        Classes

                                                                        (*,
                                                                        enterprise_id: str | None,
                                                                        team_id: str | None,
                                                                        team: str | None = None,
                                                                        url: str | None = None,
                                                                        bot_user_id: str | None = None,
                                                                        bot_id: str | None = None,
                                                                        bot_token: str | None = None,
                                                                        bot_scopes: str | Sequence[str] | None = None,
                                                                        user_id: str | None = None,
                                                                        user: str | None = None,
                                                                        user_token: str | None = None,
                                                                        user_scopes: str | Sequence[str] | None = None)
                                                                        -

                                                                        Authorize function call result

                                                                        -

                                                                        Args

                                                                        -
                                                                        -
                                                                        enterprise_id
                                                                        -
                                                                        Organization ID (Enterprise Grid) starting with E
                                                                        -
                                                                        team_id
                                                                        -
                                                                        Workspace ID starting with T
                                                                        -
                                                                        team
                                                                        -
                                                                        Workspace name
                                                                        -
                                                                        url
                                                                        -
                                                                        Workspace slack.com URL
                                                                        -
                                                                        bot_user_id
                                                                        -
                                                                        Bot user's User ID starting with either U or W
                                                                        -
                                                                        bot_id
                                                                        -
                                                                        Bot ID starting with B
                                                                        -
                                                                        bot_token
                                                                        -
                                                                        Bot user access token starting with xoxb-
                                                                        -
                                                                        bot_scopes
                                                                        -
                                                                        The scopes associated with the bot token
                                                                        -
                                                                        user_id
                                                                        -
                                                                        The request user ID
                                                                        -
                                                                        user
                                                                        -
                                                                        The request user's name
                                                                        -
                                                                        user_token
                                                                        -
                                                                        User access token starting with xoxp-
                                                                        -
                                                                        user_scopes
                                                                        -
                                                                        The scopes associated wth the user token
                                                                        -
                                                                        Expand source code @@ -177,6 +160,34 @@

                                                                        Args

                                                                        user_scopes=user_scopes, )
                                                                        +

                                                                        Authorize function call result

                                                                        +

                                                                        Args

                                                                        +
                                                                        +
                                                                        enterprise_id
                                                                        +
                                                                        Organization ID (Enterprise Grid) starting with E
                                                                        +
                                                                        team_id
                                                                        +
                                                                        Workspace ID starting with T
                                                                        +
                                                                        team
                                                                        +
                                                                        Workspace name
                                                                        +
                                                                        url
                                                                        +
                                                                        Workspace slack.com URL
                                                                        +
                                                                        bot_user_id
                                                                        +
                                                                        Bot user's User ID starting with either U or W
                                                                        +
                                                                        bot_id
                                                                        +
                                                                        Bot ID starting with B
                                                                        +
                                                                        bot_token
                                                                        +
                                                                        Bot user access token starting with xoxb-
                                                                        +
                                                                        bot_scopes
                                                                        +
                                                                        The scopes associated with the bot token
                                                                        +
                                                                        user_id
                                                                        +
                                                                        The request user ID
                                                                        +
                                                                        user
                                                                        +
                                                                        The request user's name
                                                                        +
                                                                        user_token
                                                                        +
                                                                        User access token starting with xoxp-
                                                                        +
                                                                        user_scopes
                                                                        +
                                                                        The scopes associated wth the user token
                                                                        +

                                                                        Ancestors

                                                                        • builtins.dict
                                                                        • @@ -185,51 +196,51 @@

                                                                          Class variables

                                                                          var bot_id : str | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var bot_scopes : Sequence[str] | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var bot_token : str | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var bot_user_id : str | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var enterprise_id : str | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var team : str | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var team_id : str | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var url : str | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var user : str | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var user_id : str | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var user_scopes : Sequence[str] | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          var user_token : str | None
                                                                          -
                                                                          +

                                                                          The type of the None singleton.

                                                                          Static methods

                                                                          @@ -281,7 +292,7 @@

                                                                          diff --git a/docs/static/api-docs/slack_bolt/authorization/index.html b/docs/static/api-docs/slack_bolt/authorization/index.html index 5b53ddb3..eaa267d2 100644 --- a/docs/static/api-docs/slack_bolt/authorization/index.html +++ b/docs/static/api-docs/slack_bolt/authorization/index.html @@ -3,20 +3,31 @@ - + slack_bolt.authorization API documentation - + @@ -67,34 +78,6 @@

                                                                          Classes

                                                                          (*,
                                                                          enterprise_id: str | None,
                                                                          team_id: str | None,
                                                                          team: str | None = None,
                                                                          url: str | None = None,
                                                                          bot_user_id: str | None = None,
                                                                          bot_id: str | None = None,
                                                                          bot_token: str | None = None,
                                                                          bot_scopes: str | Sequence[str] | None = None,
                                                                          user_id: str | None = None,
                                                                          user: str | None = None,
                                                                          user_token: str | None = None,
                                                                          user_scopes: str | Sequence[str] | None = None)
                                                                          -

                                                                          Authorize function call result

                                                                          -

                                                                          Args

                                                                          -
                                                                          -
                                                                          enterprise_id
                                                                          -
                                                                          Organization ID (Enterprise Grid) starting with E
                                                                          -
                                                                          team_id
                                                                          -
                                                                          Workspace ID starting with T
                                                                          -
                                                                          team
                                                                          -
                                                                          Workspace name
                                                                          -
                                                                          url
                                                                          -
                                                                          Workspace slack.com URL
                                                                          -
                                                                          bot_user_id
                                                                          -
                                                                          Bot user's User ID starting with either U or W
                                                                          -
                                                                          bot_id
                                                                          -
                                                                          Bot ID starting with B
                                                                          -
                                                                          bot_token
                                                                          -
                                                                          Bot user access token starting with xoxb-
                                                                          -
                                                                          bot_scopes
                                                                          -
                                                                          The scopes associated with the bot token
                                                                          -
                                                                          user_id
                                                                          -
                                                                          The request user ID
                                                                          -
                                                                          user
                                                                          -
                                                                          The request user's name
                                                                          -
                                                                          user_token
                                                                          -
                                                                          User access token starting with xoxp-
                                                                          -
                                                                          user_scopes
                                                                          -
                                                                          The scopes associated wth the user token
                                                                          -
                                                                          Expand source code @@ -204,6 +187,34 @@

                                                                          Args

                                                                          user_scopes=user_scopes, )
                                                                          +

                                                                          Authorize function call result

                                                                          +

                                                                          Args

                                                                          +
                                                                          +
                                                                          enterprise_id
                                                                          +
                                                                          Organization ID (Enterprise Grid) starting with E
                                                                          +
                                                                          team_id
                                                                          +
                                                                          Workspace ID starting with T
                                                                          +
                                                                          team
                                                                          +
                                                                          Workspace name
                                                                          +
                                                                          url
                                                                          +
                                                                          Workspace slack.com URL
                                                                          +
                                                                          bot_user_id
                                                                          +
                                                                          Bot user's User ID starting with either U or W
                                                                          +
                                                                          bot_id
                                                                          +
                                                                          Bot ID starting with B
                                                                          +
                                                                          bot_token
                                                                          +
                                                                          Bot user access token starting with xoxb-
                                                                          +
                                                                          bot_scopes
                                                                          +
                                                                          The scopes associated with the bot token
                                                                          +
                                                                          user_id
                                                                          +
                                                                          The request user ID
                                                                          +
                                                                          user
                                                                          +
                                                                          The request user's name
                                                                          +
                                                                          user_token
                                                                          +
                                                                          User access token starting with xoxp-
                                                                          +
                                                                          user_scopes
                                                                          +
                                                                          The scopes associated wth the user token
                                                                          +

                                                                          Ancestors

                                                                          • builtins.dict
                                                                          • @@ -212,51 +223,51 @@

                                                                            Class variables

                                                                            var bot_id : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var bot_scopes : Sequence[str] | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var bot_token : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var bot_user_id : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var enterprise_id : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var team : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var team_id : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var url : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var user : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var user_id : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var user_scopes : Sequence[str] | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var user_token : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            Static methods

                                                                            @@ -317,7 +328,7 @@

                                                                            -

                                                                            Generated by pdoc 0.11.3.

                                                                            +

                                                                            Generated by pdoc 0.11.5.

                                                                            diff --git a/docs/static/api-docs/slack_bolt/context/ack/ack.html b/docs/static/api-docs/slack_bolt/context/ack/ack.html index b5e5c898..e1b71bcb 100644 --- a/docs/static/api-docs/slack_bolt/context/ack/ack.html +++ b/docs/static/api-docs/slack_bolt/context/ack/ack.html @@ -3,19 +3,30 @@ - + slack_bolt.context.ack.ack API documentation - + @@ -39,7 +50,6 @@

                                                                            Classes

                                                                            class Ack
                                                                            -
                                                                            Expand source code @@ -81,11 +91,12 @@

                                                                            Classes

                                                                            view=view, )
                                                                            +

                                                                            Class variables

                                                                            var responseBoltResponse | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            @@ -116,7 +127,7 @@

                                                                            -

                                                                            Generated by pdoc 0.11.3.

                                                                            +

                                                                            Generated by pdoc 0.11.5.

                                                                            diff --git a/docs/static/api-docs/slack_bolt/context/ack/async_ack.html b/docs/static/api-docs/slack_bolt/context/ack/async_ack.html index 0eb7e804..0f2989e9 100644 --- a/docs/static/api-docs/slack_bolt/context/ack/async_ack.html +++ b/docs/static/api-docs/slack_bolt/context/ack/async_ack.html @@ -3,19 +3,30 @@ - + slack_bolt.context.ack.async_ack API documentation - + @@ -39,7 +50,6 @@

                                                                            Classes

                                                                            class AsyncAck
                                                                            -
                                                                            Expand source code @@ -81,11 +91,12 @@

                                                                            Classes

                                                                            view=view, )
                                                                            +

                                                                            Class variables

                                                                            var responseBoltResponse | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            @@ -116,7 +127,7 @@

                                                                            -

                                                                            Generated by pdoc 0.11.3.

                                                                            +

                                                                            Generated by pdoc 0.11.5.

                                                                            diff --git a/docs/static/api-docs/slack_bolt/context/ack/index.html b/docs/static/api-docs/slack_bolt/context/ack/index.html index cc179b15..230da5d9 100644 --- a/docs/static/api-docs/slack_bolt/context/ack/index.html +++ b/docs/static/api-docs/slack_bolt/context/ack/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.ack API documentation - + @@ -54,7 +65,6 @@

                                                                            Classes

                                                                            class Ack
                                                                            -
                                                                            Expand source code @@ -96,11 +106,12 @@

                                                                            Classes

                                                                            view=view, )
                                                                            +

                                                                            Class variables

                                                                            var responseBoltResponse | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            @@ -138,7 +149,7 @@

                                                                            -

                                                                            Generated by pdoc 0.11.3.

                                                                            +

                                                                            Generated by pdoc 0.11.5.

                                                                            diff --git a/docs/static/api-docs/slack_bolt/context/ack/internals.html b/docs/static/api-docs/slack_bolt/context/ack/internals.html index b1b1a253..2fa3d802 100644 --- a/docs/static/api-docs/slack_bolt/context/ack/internals.html +++ b/docs/static/api-docs/slack_bolt/context/ack/internals.html @@ -3,19 +3,30 @@ - + slack_bolt.context.ack.internals API documentation - + @@ -49,7 +60,7 @@

                                                                            Module slack_bolt.context.ack.internals

                                                                            diff --git a/docs/static/api-docs/slack_bolt/context/assistant/assistant_utilities.html b/docs/static/api-docs/slack_bolt/context/assistant/assistant_utilities.html index 16f08462..7bfeeeee 100644 --- a/docs/static/api-docs/slack_bolt/context/assistant/assistant_utilities.html +++ b/docs/static/api-docs/slack_bolt/context/assistant/assistant_utilities.html @@ -3,19 +3,30 @@ - + slack_bolt.context.assistant.assistant_utilities API documentation - + @@ -40,7 +51,6 @@

                                                                            Classes

                                                                            (*,
                                                                            payload: dict,
                                                                            context: BoltContext,
                                                                            thread_context_store: AssistantThreadContextStore | None = None)
                                                                            -
                                                                            Expand source code @@ -114,34 +124,34 @@

                                                                            Classes

                                                                            def save_thread_context(self) -> SaveThreadContext: return SaveThreadContext(self.thread_context_store, self.channel_id, self.thread_ts)
                                                                            +

                                                                            Class variables

                                                                            var channel_id : str
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var client : slack_sdk.web.client.WebClient
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var payload : dict
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var thread_context_storeAssistantThreadContextStore
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var thread_ts : str
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            Instance variables

                                                                            prop get_thread_contextGetThreadContext
                                                                            -
                                                                            Expand source code @@ -150,10 +160,10 @@

                                                                            Instance variables

                                                                            def get_thread_context(self) -> GetThreadContext: return GetThreadContext(self.thread_context_store, self.channel_id, self.thread_ts, self.payload)
                                                                            +
                                                                            prop save_thread_contextSaveThreadContext
                                                                            -
                                                                            Expand source code @@ -162,10 +172,10 @@

                                                                            Instance variables

                                                                            def save_thread_context(self) -> SaveThreadContext: return SaveThreadContext(self.thread_context_store, self.channel_id, self.thread_ts)
                                                                            +
                                                                            prop saySay
                                                                            -
                                                                            Expand source code @@ -185,10 +195,10 @@

                                                                            Instance variables

                                                                            build_metadata=build_metadata, )
                                                                            +
                                                                            prop set_statusSetStatus
                                                                            -
                                                                            Expand source code @@ -197,10 +207,10 @@

                                                                            Instance variables

                                                                            def set_status(self) -> SetStatus: return SetStatus(self.client, self.channel_id, self.thread_ts)
                                                                            +
                                                                            prop set_suggested_promptsSetSuggestedPrompts
                                                                            -
                                                                            Expand source code @@ -209,10 +219,10 @@

                                                                            Instance variables

                                                                            def set_suggested_prompts(self) -> SetSuggestedPrompts: return SetSuggestedPrompts(self.client, self.channel_id, self.thread_ts)
                                                                            +
                                                                            prop set_titleSetTitle
                                                                            -
                                                                            Expand source code @@ -221,6 +231,7 @@

                                                                            Instance variables

                                                                            def set_title(self) -> SetTitle: return SetTitle(self.client, self.channel_id, self.thread_ts)
                                                                            +

                                                                            Methods

                                                                            @@ -229,6 +240,13 @@

                                                                            Methods

                                                                            def is_valid(self) ‑> bool
                                                                            +
                                                                            + +Expand source code + +
                                                                            def is_valid(self) -> bool:
                                                                            +    return self.channel_id is not None and self.thread_ts is not None
                                                                            +

                                                                @@ -271,7 +289,7 @@

                                                                -

                                                                Generated by pdoc 0.11.3.

                                                                +

                                                                Generated by pdoc 0.11.5.

                                                                diff --git a/docs/static/api-docs/slack_bolt/context/assistant/async_assistant_utilities.html b/docs/static/api-docs/slack_bolt/context/assistant/async_assistant_utilities.html index 22468df4..b4af582a 100644 --- a/docs/static/api-docs/slack_bolt/context/assistant/async_assistant_utilities.html +++ b/docs/static/api-docs/slack_bolt/context/assistant/async_assistant_utilities.html @@ -3,19 +3,30 @@ - + slack_bolt.context.assistant.async_assistant_utilities API documentation - + @@ -40,7 +51,6 @@

                                                                Classes

                                                                (*,
                                                                payload: dict,
                                                                context: AsyncBoltContext,
                                                                thread_context_store: AsyncAssistantThreadContextStore | None = None)
                                                                -
                                                                Expand source code @@ -114,34 +124,34 @@

                                                                Classes

                                                                def save_thread_context(self) -> AsyncSaveThreadContext: return AsyncSaveThreadContext(self.thread_context_store, self.channel_id, self.thread_ts)
                                                                +

                                                                Class variables

                                                                var channel_id : str
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var client : slack_sdk.web.async_client.AsyncWebClient
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var payload : dict
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var thread_context_storeAsyncAssistantThreadContextStore
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                var thread_ts : str
                                                                -
                                                                +

                                                                The type of the None singleton.

                                                                Instance variables

                                                                prop get_thread_contextAsyncGetThreadContext
                                                                -
                                                                Expand source code @@ -150,10 +160,10 @@

                                                                Instance variables

                                                                def get_thread_context(self) -> AsyncGetThreadContext: return AsyncGetThreadContext(self.thread_context_store, self.channel_id, self.thread_ts, self.payload)
                                                                +
                                                                prop save_thread_contextAsyncSaveThreadContext
                                                                -
                                                                Expand source code @@ -162,10 +172,10 @@

                                                                Instance variables

                                                                def save_thread_context(self) -> AsyncSaveThreadContext: return AsyncSaveThreadContext(self.thread_context_store, self.channel_id, self.thread_ts)
                                                                +
                                                                prop sayAsyncSay
                                                                -
                                                                Expand source code @@ -179,10 +189,10 @@

                                                                Instance variables

                                                                build_metadata=self._build_message_metadata, )
                                                                +
                                                                prop set_statusAsyncSetStatus
                                                                -
                                                                Expand source code @@ -191,10 +201,10 @@

                                                                Instance variables

                                                                def set_status(self) -> AsyncSetStatus: return AsyncSetStatus(self.client, self.channel_id, self.thread_ts)
                                                                +
                                                                prop set_suggested_promptsAsyncSetSuggestedPrompts
                                                                -
                                                                Expand source code @@ -203,10 +213,10 @@

                                                                Instance variables

                                                                def set_suggested_prompts(self) -> AsyncSetSuggestedPrompts: return AsyncSetSuggestedPrompts(self.client, self.channel_id, self.thread_ts)
                                                                +
                                                                prop set_titleAsyncSetTitle
                                                                -
                                                                Expand source code @@ -215,6 +225,7 @@

                                                                Instance variables

                                                                def set_title(self) -> AsyncSetTitle: return AsyncSetTitle(self.client, self.channel_id, self.thread_ts)
                                                                +

                                                                Methods

                                                                @@ -223,6 +234,13 @@

                                                                Methods

                                                                def is_valid(self) ‑> bool
                                                                +
                                                                + +Expand source code + +
                                                                def is_valid(self) -> bool:
                                                                +    return self.channel_id is not None and self.thread_ts is not None
                                                                +

                                                                @@ -265,7 +283,7 @@

                                                                -

                                                                Generated by pdoc 0.11.3.

                                                                +

                                                                Generated by pdoc 0.11.5.

                                                                diff --git a/docs/static/api-docs/slack_bolt/context/assistant/index.html b/docs/static/api-docs/slack_bolt/context/assistant/index.html index d2026e01..73dcff28 100644 --- a/docs/static/api-docs/slack_bolt/context/assistant/index.html +++ b/docs/static/api-docs/slack_bolt/context/assistant/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.assistant API documentation - + @@ -81,7 +92,7 @@

                                                                Sub-modules

                                                                diff --git a/docs/static/api-docs/slack_bolt/context/assistant/internals.html b/docs/static/api-docs/slack_bolt/context/assistant/internals.html index f2124d9f..b1558b9d 100644 --- a/docs/static/api-docs/slack_bolt/context/assistant/internals.html +++ b/docs/static/api-docs/slack_bolt/context/assistant/internals.html @@ -3,19 +3,30 @@ - + slack_bolt.context.assistant.internals API documentation - + @@ -37,6 +48,20 @@

                                                                Functions

                                                                def has_channel_id_and_thread_ts(payload: dict) ‑> bool
                                                                +
                                                                + +Expand source code + +
                                                                def has_channel_id_and_thread_ts(payload: dict) -> bool:
                                                                +    """Verifies if the given payload has both channel_id and thread_ts under assistant_thread property.
                                                                +    This data pattern is available for assistant_* events.
                                                                +    """
                                                                +    return (
                                                                +        payload.get("assistant_thread") is not None
                                                                +        and payload["assistant_thread"].get("channel_id") is not None
                                                                +        and payload["assistant_thread"].get("thread_ts") is not None
                                                                +    )
                                                                +

                                                                Verifies if the given payload has both channel_id and thread_ts under assistant_thread property. This data pattern is available for assistant_* events.

                                                                @@ -64,7 +89,7 @@

                                                                Functions

                                                                diff --git a/docs/static/api-docs/slack_bolt/context/assistant/thread_context/index.html b/docs/static/api-docs/slack_bolt/context/assistant/thread_context/index.html index 755d63b5..7d1232b1 100644 --- a/docs/static/api-docs/slack_bolt/context/assistant/thread_context/index.html +++ b/docs/static/api-docs/slack_bolt/context/assistant/thread_context/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.assistant.thread_context API documentation - + @@ -40,17 +51,6 @@

                                                                Classes

                                                                (payload: dict)
                                                                -

                                                                dict() -> new empty dictionary -dict(mapping) -> new dictionary initialized from a mapping object's -(key, value) pairs -dict(iterable) -> new dictionary initialized as if via: -d = {} -for k, v in iterable: -d[k] = v -dict(**kwargs) -> new dictionary initialized with the name=value pairs -in the keyword argument list. -For example: -dict(one=1, two=2)

                                                                Expand source code @@ -66,6 +66,17 @@

                                                                Classes

                                                                self.team_id = payload.get("team_id") self.channel_id = payload["channel_id"]
                                                                +

                                                                dict() -> new empty dictionary +dict(mapping) -> new dictionary initialized from a mapping object's +(key, value) pairs +dict(iterable) -> new dictionary initialized as if via: +d = {} +for k, v in iterable: +d[k] = v +dict(**kwargs) -> new dictionary initialized with the name=value pairs +in the keyword argument list. +For example: +dict(one=1, two=2)

                                                                Ancestors

                                                                • builtins.dict
                                                                • @@ -74,15 +85,15 @@

                                                                  Class variables

                                                                  var channel_id : str
                                                                  -
                                                                  +

                                                                  The type of the None singleton.

                                                                  var enterprise_id : str | None
                                                                  -
                                                                  +

                                                                  The type of the None singleton.

                                                                  var team_id : str | None
                                                                  -
                                                                  +

                                                                  The type of the None singleton.

                                                                @@ -115,7 +126,7 @@

                                                                -

                                                                Generated by pdoc 0.11.3.

                                                                +

                                                                Generated by pdoc 0.11.5.

                                                                diff --git a/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/async_store.html b/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/async_store.html index a9e928c7..f5045739 100644 --- a/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/async_store.html +++ b/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/async_store.html @@ -3,19 +3,30 @@ - + slack_bolt.context.assistant.thread_context_store.async_store API documentation - + @@ -39,7 +50,6 @@

                                                                Classes

                                                                class AsyncAssistantThreadContextStore
                                                                -
                                                                Expand source code @@ -51,6 +61,7 @@

                                                                Classes

                                                                async def find(self, *, channel_id: str, thread_ts: str) -> Optional[AssistantThreadContext]: raise NotImplementedError()
                                                                +

                                                                Subclasses

                                                                • DefaultAsyncAssistantThreadContextStore
                                                                • @@ -61,12 +72,26 @@

                                                                  Methods

                                                                  async def find(self, *, channel_id: str, thread_ts: str) ‑> AssistantThreadContext | None
                                                                  +
                                                                  + +Expand source code + +
                                                                  async def find(self, *, channel_id: str, thread_ts: str) -> Optional[AssistantThreadContext]:
                                                                  +    raise NotImplementedError()
                                                                  +
                                                                  async def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) ‑> None
                                                                  +
                                                                  + +Expand source code + +
                                                                  async def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) -> None:
                                                                  +    raise NotImplementedError()
                                                                  +
                                                                  @@ -99,7 +124,7 @@

                                                                  -

                                                                  Generated by pdoc 0.11.3.

                                                                  +

                                                                  Generated by pdoc 0.11.5.

                                                                  diff --git a/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/default_async_store.html b/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/default_async_store.html index d2696dc2..8344971d 100644 --- a/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/default_async_store.html +++ b/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/default_async_store.html @@ -3,19 +3,30 @@ - + slack_bolt.context.assistant.thread_context_store.default_async_store API documentation - + @@ -40,7 +51,6 @@

                                                                  Classes

                                                                  (context: AsyncBoltContext)
                                                                  -
                                                                  Expand source code @@ -89,6 +99,7 @@

                                                                  Classes

                                                                  return message return None
                                                                  +

                                                                  Ancestors

                                                                  • AsyncAssistantThreadContextStore
                                                                  • @@ -97,11 +108,11 @@

                                                                    Class variables

                                                                    var client : slack_sdk.web.async_client.AsyncWebClient
                                                                    -
                                                                    +

                                                                    The type of the None singleton.

                                                                    var contextAsyncBoltContext
                                                                    -
                                                                    +

                                                                    The type of the None singleton.

                                                                    Methods

                                                                    @@ -110,12 +121,41 @@

                                                                    Methods

                                                                    async def find(self, *, channel_id: str, thread_ts: str) ‑> AssistantThreadContext | None
                                                                    +
                                                                    + +Expand source code + +
                                                                    async def find(self, *, channel_id: str, thread_ts: str) -> Optional[AssistantThreadContext]:
                                                                    +    parent_message = await self._retrieve_first_bot_reply(channel_id, thread_ts)
                                                                    +    if parent_message is not None and parent_message.get("metadata"):
                                                                    +        if bool(parent_message["metadata"]["event_payload"]):
                                                                    +            return AssistantThreadContext(parent_message["metadata"]["event_payload"])
                                                                    +    return None
                                                                    +
                                                                    async def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) ‑> None
                                                                    +
                                                                    + +Expand source code + +
                                                                    async def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) -> None:
                                                                    +    parent_message = await self._retrieve_first_bot_reply(channel_id, thread_ts)
                                                                    +    if parent_message is not None:
                                                                    +        await self.client.chat_update(
                                                                    +            channel=channel_id,
                                                                    +            ts=parent_message["ts"],
                                                                    +            text=parent_message["text"],
                                                                    +            blocks=parent_message["blocks"],
                                                                    +            metadata={
                                                                    +                "event_type": "assistant_thread_context",
                                                                    +                "event_payload": context,
                                                                    +            },
                                                                    +        )
                                                                    +
                                                                    @@ -150,7 +190,7 @@

                                                                    -

                                                                    Generated by pdoc 0.11.3.

                                                                    +

                                                                    Generated by pdoc 0.11.5.

                                                                    diff --git a/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/default_store.html b/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/default_store.html index c20a3413..d647b9c7 100644 --- a/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/default_store.html +++ b/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/default_store.html @@ -3,19 +3,30 @@ - + slack_bolt.context.assistant.thread_context_store.default_store API documentation - + @@ -40,7 +51,6 @@

                                                                    Classes

                                                                    (context: BoltContext)
                                                                    -
                                                                    Expand source code @@ -87,6 +97,7 @@

                                                                    Classes

                                                                    return message return None
                                                                    +

                                                                    Ancestors

                                                                    • AssistantThreadContextStore
                                                                    • @@ -95,11 +106,11 @@

                                                                      Class variables

                                                                      var client : slack_sdk.web.client.WebClient
                                                                      -
                                                                      +

                                                                      The type of the None singleton.

                                                                      var contextBoltContext
                                                                      -
                                                                      +

                                                                      The type of the None singleton.

                                                                      Methods

                                                                      @@ -108,12 +119,41 @@

                                                                      Methods

                                                                      def find(self, *, channel_id: str, thread_ts: str) ‑> AssistantThreadContext | None
                                                                      +
                                                                      + +Expand source code + +
                                                                      def find(self, *, channel_id: str, thread_ts: str) -> Optional[AssistantThreadContext]:
                                                                      +    parent_message = self._retrieve_first_bot_reply(channel_id, thread_ts)
                                                                      +    if parent_message is not None and parent_message.get("metadata"):
                                                                      +        if bool(parent_message["metadata"]["event_payload"]):
                                                                      +            return AssistantThreadContext(parent_message["metadata"]["event_payload"])
                                                                      +    return None
                                                                      +
                                                                      def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) ‑> None
                                                                      +
                                                                      + +Expand source code + +
                                                                      def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) -> None:
                                                                      +    parent_message = self._retrieve_first_bot_reply(channel_id, thread_ts)
                                                                      +    if parent_message is not None:
                                                                      +        self.client.chat_update(
                                                                      +            channel=channel_id,
                                                                      +            ts=parent_message["ts"],
                                                                      +            text=parent_message["text"],
                                                                      +            blocks=parent_message["blocks"],
                                                                      +            metadata={
                                                                      +                "event_type": "assistant_thread_context",
                                                                      +                "event_payload": context,
                                                                      +            },
                                                                      +        )
                                                                      +
                                                                      @@ -148,7 +188,7 @@

                                                                      -

                                                                      Generated by pdoc 0.11.3.

                                                                      +

                                                                      Generated by pdoc 0.11.5.

                                                                      diff --git a/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/file/index.html b/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/file/index.html index 3a31ee12..4190a948 100644 --- a/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/file/index.html +++ b/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/file/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.assistant.thread_context_store.file API documentation - + @@ -37,10 +48,9 @@

                                                                      Classes

                                                                      class FileAssistantThreadContextStore -(base_dir: str = '/Users/kazuhiro.sera/.bolt-app-assistant-thread-contexts') +(base_dir: str = '/Users/wbergamin/.bolt-app-assistant-thread-contexts')
                                                                      -
                                                                      Expand source code @@ -76,6 +86,7 @@

                                                                      Classes

                                                                      path = Path(path) path.mkdir(parents=True, exist_ok=True)
                                                                      +

                                                                      Ancestors

                                                                      • AssistantThreadContextStore
                                                                      • @@ -86,12 +97,36 @@

                                                                        Methods

                                                                        def find(self, *, channel_id: str, thread_ts: str) ‑> AssistantThreadContext | None
                                                                        +
                                                                        + +Expand source code + +
                                                                        def find(self, *, channel_id: str, thread_ts: str) -> Optional[AssistantThreadContext]:
                                                                        +    path = f"{self.base_dir}/{channel_id}-{thread_ts}.json"
                                                                        +    try:
                                                                        +        with open(path) as f:
                                                                        +            data = json.loads(f.read())
                                                                        +            if data.get("channel_id") is not None:
                                                                        +                return AssistantThreadContext(data)
                                                                        +    except FileNotFoundError:
                                                                        +        pass
                                                                        +    return None
                                                                        +
                                                                        def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) ‑> None
                                                                        +
                                                                        + +Expand source code + +
                                                                        def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) -> None:
                                                                        +    path = f"{self.base_dir}/{channel_id}-{thread_ts}.json"
                                                                        +    with open(path, "w") as f:
                                                                        +        f.write(json.dumps(context))
                                                                        +
                                                                      @@ -124,7 +159,7 @@

                                                                      -

                                                                      Generated by pdoc 0.11.3.

                                                                      +

                                                                      Generated by pdoc 0.11.5.

                                                                      diff --git a/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/index.html b/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/index.html index dc302480..400b3c37 100644 --- a/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/index.html +++ b/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.assistant.thread_context_store API documentation - + @@ -81,7 +92,7 @@

                                                                      Sub-modules

                                                                      diff --git a/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/store.html b/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/store.html index 77c9e1b2..fde47afc 100644 --- a/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/store.html +++ b/docs/static/api-docs/slack_bolt/context/assistant/thread_context_store/store.html @@ -3,19 +3,30 @@ - + slack_bolt.context.assistant.thread_context_store.store API documentation - + @@ -39,7 +50,6 @@

                                                                      Classes

                                                                      class AssistantThreadContextStore
                                                                      -
                                                                      Expand source code @@ -51,6 +61,7 @@

                                                                      Classes

                                                                      def find(self, *, channel_id: str, thread_ts: str) -> Optional[AssistantThreadContext]: raise NotImplementedError()
                                                                      +

                                                                      Subclasses

                                                                      • DefaultAssistantThreadContextStore
                                                                      • @@ -62,12 +73,26 @@

                                                                        Methods

                                                                        def find(self, *, channel_id: str, thread_ts: str) ‑> AssistantThreadContext | None
                                                                        +
                                                                        + +Expand source code + +
                                                                        def find(self, *, channel_id: str, thread_ts: str) -> Optional[AssistantThreadContext]:
                                                                        +    raise NotImplementedError()
                                                                        +
                                                                        def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) ‑> None
                                                                        +
                                                                        + +Expand source code + +
                                                                        def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) -> None:
                                                                        +    raise NotImplementedError()
                                                                        +
                                                                        @@ -100,7 +125,7 @@

                                                                        -

                                                                        Generated by pdoc 0.11.3.

                                                                        +

                                                                        Generated by pdoc 0.11.5.

                                                                        diff --git a/docs/static/api-docs/slack_bolt/context/async_context.html b/docs/static/api-docs/slack_bolt/context/async_context.html index af07618a..76ac8c5d 100644 --- a/docs/static/api-docs/slack_bolt/context/async_context.html +++ b/docs/static/api-docs/slack_bolt/context/async_context.html @@ -3,19 +3,30 @@ - + slack_bolt.context.async_context API documentation - + @@ -40,7 +51,6 @@

                                                                        Classes

                                                                        (*args, **kwargs)
                                                                        -

                                                                        Context object associated with a request from Slack.

                                                                        Expand source code @@ -236,6 +246,7 @@

                                                                        Classes

                                                                        def save_thread_context(self) -> Optional[AsyncSaveThreadContext]: return self.get("save_thread_context")
                                                                        +

                                                                        Context object associated with a request from Slack.

                                                                        Ancestors

                                                                        • BaseContext
                                                                        • @@ -245,18 +256,6 @@

                                                                          Instance variables

                                                                          prop ackAsyncAck
                                                                          -

                                                                          ack() function for this request.

                                                                          -
                                                                          @app.action("button")
                                                                          -async def handle_button_clicks(context):
                                                                          -    await context.ack()
                                                                          -
                                                                          -# You can access "ack" this way too.
                                                                          -@app.action("button")
                                                                          -async def handle_button_clicks(ack):
                                                                          -    await ack()
                                                                          -
                                                                          -

                                                                          Returns

                                                                          -

                                                                          Callable ack() function

                                                                          Expand source code @@ -281,27 +280,21 @@

                                                                          Returns

                                                                          self["ack"] = AsyncAck() return self["ack"]
                                                                          -
                                                                          -
                                                                          prop client : slack_sdk.web.async_client.AsyncWebClient
                                                                          -
                                                                          -

                                                                          The AsyncWebClient instance available for this request.

                                                                          -
                                                                          @app.event("app_mention")
                                                                          -async def handle_events(context):
                                                                          -    await context.client.chat_postMessage(
                                                                          -        channel=context.channel_id,
                                                                          -        text="Thanks!",
                                                                          -    )
                                                                          +

                                                                          ack() function for this request.

                                                                          +
                                                                          @app.action("button")
                                                                          +async def handle_button_clicks(context):
                                                                          +    await context.ack()
                                                                           
                                                                          -# You can access "client" this way too.
                                                                          -@app.event("app_mention")
                                                                          -async def handle_events(client, context):
                                                                          -    await client.chat_postMessage(
                                                                          -        channel=context.channel_id,
                                                                          -        text="Thanks!",
                                                                          -    )
                                                                          +# You can access "ack" this way too.
                                                                          +@app.action("button")
                                                                          +async def handle_button_clicks(ack):
                                                                          +    await ack()
                                                                           

                                                                          Returns

                                                                          -

                                                                          AsyncWebClient instance

                                                                          +

                                                                          Callable ack() function

                                                                          +
                                                                          +
                                                                          prop client : slack_sdk.web.async_client.AsyncWebClient
                                                                          +
                                                                          Expand source code @@ -332,25 +325,27 @@

                                                                          Returns

                                                                          self["client"] = AsyncWebClient(token=None) return self["client"]
                                                                          -
                                                                          -
                                                                          prop completeAsyncComplete
                                                                          -
                                                                          -

                                                                          complete() function for this request. Once a custom function's state is set to complete, -any outputs the function returns will be passed along to the next step of its housing workflow, -or complete the workflow if the function is the last step in a workflow. Additionally, -any interactivity handlers associated to a function invocation will no longer be invocable.

                                                                          -
                                                                          @app.function("reverse")
                                                                          -async def handle_button_clicks(ack, complete):
                                                                          -    await ack()
                                                                          -    await complete(outputs={"stringReverse":"olleh"})
                                                                          +

                                                                          The AsyncWebClient instance available for this request.

                                                                          +
                                                                          @app.event("app_mention")
                                                                          +async def handle_events(context):
                                                                          +    await context.client.chat_postMessage(
                                                                          +        channel=context.channel_id,
                                                                          +        text="Thanks!",
                                                                          +    )
                                                                           
                                                                          -@app.function("reverse")
                                                                          -async def handle_button_clicks(context):
                                                                          -    await context.ack()
                                                                          -    await context.complete(outputs={"stringReverse":"olleh"})
                                                                          +# You can access "client" this way too.
                                                                          +@app.event("app_mention")
                                                                          +async def handle_events(client, context):
                                                                          +    await client.chat_postMessage(
                                                                          +        channel=context.channel_id,
                                                                          +        text="Thanks!",
                                                                          +    )
                                                                           

                                                                          Returns

                                                                          -

                                                                          Callable complete() function

                                                                          +

                                                                          AsyncWebClient instance

                                                                          +
                                                                          +
                                                                          prop completeAsyncComplete
                                                                          +
                                                                          Expand source code @@ -379,25 +374,25 @@

                                                                          Returns

                                                                          self["complete"] = AsyncComplete(client=self.client, function_execution_id=self.function_execution_id) return self["complete"]
                                                                          -
                                                                          -
                                                                          prop failAsyncFail
                                                                          -
                                                                          -

                                                                          fail() function for this request. Once a custom function's state is set to error, -its housing workflow will be interrupted and any provided error message will be passed -on to the end user through SlackBot. Additionally, any interactivity handlers associated -to a function invocation will no longer be invocable.

                                                                          +

                                                                          complete() function for this request. Once a custom function's state is set to complete, +any outputs the function returns will be passed along to the next step of its housing workflow, +or complete the workflow if the function is the last step in a workflow. Additionally, +any interactivity handlers associated to a function invocation will no longer be invocable.

                                                                          @app.function("reverse")
                                                                          -async def handle_button_clicks(ack, fail):
                                                                          +async def handle_button_clicks(ack, complete):
                                                                               await ack()
                                                                          -    await fail(error="something went wrong")
                                                                          +    await complete(outputs={"stringReverse":"olleh"})
                                                                           
                                                                           @app.function("reverse")
                                                                           async def handle_button_clicks(context):
                                                                               await context.ack()
                                                                          -    await context.fail(error="something went wrong")
                                                                          +    await context.complete(outputs={"stringReverse":"olleh"})
                                                                           

                                                                          Returns

                                                                          -

                                                                          Callable fail() function

                                                                          +

                                                                          Callable complete() function

                                                                          +
                                                                          +
                                                                          prop failAsyncFail
                                                                          +
                                                                          Expand source code @@ -426,10 +421,25 @@

                                                                          Returns

                                                                          self["fail"] = AsyncFail(client=self.client, function_execution_id=self.function_execution_id) return self["fail"]
                                                                          +

                                                                          fail() function for this request. Once a custom function's state is set to error, +its housing workflow will be interrupted and any provided error message will be passed +on to the end user through SlackBot. Additionally, any interactivity handlers associated +to a function invocation will no longer be invocable.

                                                                          +
                                                                          @app.function("reverse")
                                                                          +async def handle_button_clicks(ack, fail):
                                                                          +    await ack()
                                                                          +    await fail(error="something went wrong")
                                                                          +
                                                                          +@app.function("reverse")
                                                                          +async def handle_button_clicks(context):
                                                                          +    await context.ack()
                                                                          +    await context.fail(error="something went wrong")
                                                                          +
                                                                          +

                                                                          Returns

                                                                          +

                                                                          Callable fail() function

                                                                          prop get_thread_contextAsyncGetThreadContext | None
                                                                          -
                                                                          Expand source code @@ -438,10 +448,10 @@

                                                                          Returns

                                                                          def get_thread_context(self) -> Optional[AsyncGetThreadContext]: return self.get("get_thread_context")
                                                                          +
                                                                          prop listener_runner : AsyncioListenerRunner
                                                                          -

                                                                          The properly configured listener_runner that is available for middleware/listeners.

                                                                          Expand source code @@ -451,23 +461,10 @@

                                                                          Returns

                                                                          """The properly configured listener_runner that is available for middleware/listeners.""" return self["listener_runner"]
                                                                          +

                                                                          The properly configured listener_runner that is available for middleware/listeners.

                                                                          prop respondAsyncRespond | None
                                                                          -

                                                                          respond() function for this request.

                                                                          -
                                                                          @app.action("button")
                                                                          -async def handle_button_clicks(context):
                                                                          -    await context.ack()
                                                                          -    await context.respond("Hi!")
                                                                          -
                                                                          -# You can access "ack" this way too.
                                                                          -@app.action("button")
                                                                          -async def handle_button_clicks(ack, respond):
                                                                          -    await ack()
                                                                          -    await respond("Hi!")
                                                                          -
                                                                          -

                                                                          Returns

                                                                          -

                                                                          Callable respond() function

                                                                          Expand source code @@ -498,10 +495,23 @@

                                                                          Returns

                                                                          ) return self["respond"]
                                                                          +

                                                                          respond() function for this request.

                                                                          +
                                                                          @app.action("button")
                                                                          +async def handle_button_clicks(context):
                                                                          +    await context.ack()
                                                                          +    await context.respond("Hi!")
                                                                          +
                                                                          +# You can access "ack" this way too.
                                                                          +@app.action("button")
                                                                          +async def handle_button_clicks(ack, respond):
                                                                          +    await ack()
                                                                          +    await respond("Hi!")
                                                                          +
                                                                          +

                                                                          Returns

                                                                          +

                                                                          Callable respond() function

                                                                          prop save_thread_contextAsyncSaveThreadContext | None
                                                                          -
                                                                          Expand source code @@ -510,23 +520,10 @@

                                                                          Returns

                                                                          def save_thread_context(self) -> Optional[AsyncSaveThreadContext]: return self.get("save_thread_context")
                                                                          +
                                                                          prop sayAsyncSay
                                                                          -

                                                                          say() function for this request.

                                                                          -
                                                                          @app.action("button")
                                                                          -async def handle_button_clicks(context):
                                                                          -    await context.ack()
                                                                          -    await context.say("Hi!")
                                                                          -
                                                                          -# You can access "ack" this way too.
                                                                          -@app.action("button")
                                                                          -async def handle_button_clicks(ack, say):
                                                                          -    await ack()
                                                                          -    await say("Hi!")
                                                                          -
                                                                          -

                                                                          Returns

                                                                          -

                                                                          Callable say() function

                                                                          Expand source code @@ -553,10 +550,23 @@

                                                                          Returns

                                                                          self["say"] = AsyncSay(client=self.client, channel=self.channel_id, thread_ts=self.thread_ts) return self["say"]
                                                                          +

                                                                          say() function for this request.

                                                                          +
                                                                          @app.action("button")
                                                                          +async def handle_button_clicks(context):
                                                                          +    await context.ack()
                                                                          +    await context.say("Hi!")
                                                                          +
                                                                          +# You can access "ack" this way too.
                                                                          +@app.action("button")
                                                                          +async def handle_button_clicks(ack, say):
                                                                          +    await ack()
                                                                          +    await say("Hi!")
                                                                          +
                                                                          +

                                                                          Returns

                                                                          +

                                                                          Callable say() function

                                                                          prop set_statusAsyncSetStatus | None
                                                                          -
                                                                          Expand source code @@ -565,10 +575,10 @@

                                                                          Returns

                                                                          def set_status(self) -> Optional[AsyncSetStatus]: return self.get("set_status")
                                                                          +
                                                                          prop set_suggested_promptsAsyncSetSuggestedPrompts | None
                                                                          -
                                                                          Expand source code @@ -577,10 +587,10 @@

                                                                          Returns

                                                                          def set_suggested_prompts(self) -> Optional[AsyncSetSuggestedPrompts]: return self.get("set_suggested_prompts")
                                                                          +
                                                                          prop set_titleAsyncSetTitle | None
                                                                          -
                                                                          Expand source code @@ -589,6 +599,7 @@

                                                                          Returns

                                                                          def set_title(self) -> Optional[AsyncSetTitle]: return self.get("set_title")
                                                                          +

                                                                          Methods

                                                                          @@ -597,6 +608,30 @@

                                                                          Methods

                                                                          def to_copyable(self) ‑> AsyncBoltContext
                                                                          +
                                                                          + +Expand source code + +
                                                                          def to_copyable(self) -> "AsyncBoltContext":
                                                                          +    new_dict = {}
                                                                          +    for prop_name, prop_value in self.items():
                                                                          +        if prop_name in self.copyable_standard_property_names:
                                                                          +            # all the standard properties are copiable
                                                                          +            new_dict[prop_name] = prop_value
                                                                          +        elif prop_name in self.non_copyable_standard_property_names:
                                                                          +            # Do nothing with this property (e.g., listener_runner)
                                                                          +            continue
                                                                          +        else:
                                                                          +            try:
                                                                          +                copied_value = create_copy(prop_value)
                                                                          +                new_dict[prop_name] = copied_value
                                                                          +            except TypeError as te:
                                                                          +                self.logger.debug(
                                                                          +                    f"Skipped setting '{prop_name}' to a copied request for lazy listeners "
                                                                          +                    f"as it's not possible to make a deep copy (error: {te})"
                                                                          +                )
                                                                          +    return AsyncBoltContext(new_dict)
                                                                          +
                                                                          @@ -612,6 +647,7 @@

                                                                          Inherited members

                                                                        • bot_token
                                                                        • bot_user_id
                                                                        • channel_id
                                                                        • +
                                                                        • copyable_standard_property_names
                                                                        • enterprise_id
                                                                        • function_bot_access_token
                                                                        • function_execution_id
                                                                        • @@ -619,7 +655,9 @@

                                                                          Inherited members

                                                                        • is_enterprise_install
                                                                        • logger
                                                                        • matches
                                                                        • +
                                                                        • non_copyable_standard_property_names
                                                                        • response_url
                                                                        • +
                                                                        • standard_property_names
                                                                        • team_id
                                                                        • thread_ts
                                                                        • token
                                                                        • @@ -668,7 +706,7 @@

                                                                          -

                                                                          Generated by pdoc 0.11.3.

                                                                          +

                                                                          Generated by pdoc 0.11.5.

                                                                          diff --git a/docs/static/api-docs/slack_bolt/context/base_context.html b/docs/static/api-docs/slack_bolt/context/base_context.html index e0299dc9..54617176 100644 --- a/docs/static/api-docs/slack_bolt/context/base_context.html +++ b/docs/static/api-docs/slack_bolt/context/base_context.html @@ -3,19 +3,30 @@ - + slack_bolt.context.base_context API documentation - + @@ -40,7 +51,6 @@

                                                                          Classes

                                                                          (*args, **kwargs)
                                                                          -

                                                                          Context object associated with a request from Slack.

                                                                          Expand source code @@ -227,6 +237,7 @@

                                                                          Classes

                                                                          if authorize_result.user_token is not None: self["user_token"] = authorize_result.user_token
                                                                          +

                                                                          Context object associated with a request from Slack.

                                                                          Ancestors

                                                                          • builtins.dict
                                                                          • @@ -240,24 +251,21 @@

                                                                            Class variables

                                                                            var copyable_standard_property_names
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var non_copyable_standard_property_names
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var standard_property_names
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            Instance variables

                                                                            prop actor_enterprise_id : str | None
                                                                            -

                                                                            The action's actor's Enterprise Grid organization ID. -Note that this property is especially useful for handling events in Slack Connect channels. -That being said, it's not guaranteed to have a valid ID for all events due to server-side inconsistency.

                                                                            Expand source code @@ -270,12 +278,12 @@

                                                                            Instance variables

                                                                            """ return self.get("actor_enterprise_id")
                                                                            +

                                                                            The action's actor's Enterprise Grid organization ID. +Note that this property is especially useful for handling events in Slack Connect channels. +That being said, it's not guaranteed to have a valid ID for all events due to server-side inconsistency.

                                                                            prop actor_team_id : str | None
                                                                            -

                                                                            The action's actor's workspace ID. -Note that this property is especially useful for handling events in Slack Connect channels. -That being said, it's not guaranteed to have a valid ID for all events due to server-side inconsistency.

                                                                            Expand source code @@ -288,12 +296,12 @@

                                                                            Instance variables

                                                                            """ return self.get("actor_team_id")
                                                                            +

                                                                            The action's actor's workspace ID. +Note that this property is especially useful for handling events in Slack Connect channels. +That being said, it's not guaranteed to have a valid ID for all events due to server-side inconsistency.

                                                                            prop actor_user_id : str | None
                                                                            -

                                                                            The action's actor's user ID. -Note that this property is especially useful for handling events in Slack Connect channels. -That being said, it's not guaranteed to have a valid ID for all events due to server-side inconsistency.

                                                                            Expand source code @@ -306,10 +314,12 @@

                                                                            Instance variables

                                                                            """ return self.get("actor_user_id")
                                                                            +

                                                                            The action's actor's user ID. +Note that this property is especially useful for handling events in Slack Connect channels. +That being said, it's not guaranteed to have a valid ID for all events due to server-side inconsistency.

                                                                            prop authorize_resultAuthorizeResult | None
                                                                            -

                                                                            The authorize result resolved for this request.

                                                                            Expand source code @@ -319,10 +329,10 @@

                                                                            Instance variables

                                                                            """The authorize result resolved for this request.""" return self.get("authorize_result")
                                                                            +

                                                                            The authorize result resolved for this request.

                                                                            prop bot_id : str | None
                                                                            -

                                                                            The bot ID resolved for this request.

                                                                            Expand source code @@ -332,10 +342,10 @@

                                                                            Instance variables

                                                                            """The bot ID resolved for this request.""" return self.get("bot_id")
                                                                            +

                                                                            The bot ID resolved for this request.

                                                                            prop bot_token : str | None
                                                                            -

                                                                            The bot token resolved for this request.

                                                                            Expand source code @@ -345,10 +355,10 @@

                                                                            Instance variables

                                                                            """The bot token resolved for this request.""" return self.get("bot_token")
                                                                            +

                                                                            The bot token resolved for this request.

                                                                            prop bot_user_id : str | None
                                                                            -

                                                                            The bot user ID resolved for this request.

                                                                            Expand source code @@ -358,10 +368,10 @@

                                                                            Instance variables

                                                                            """The bot user ID resolved for this request.""" return self.get("bot_user_id")
                                                                            +

                                                                            The bot user ID resolved for this request.

                                                                            prop channel_id : str | None
                                                                            -

                                                                            The conversation ID associated with this request.

                                                                            Expand source code @@ -371,10 +381,10 @@

                                                                            Instance variables

                                                                            """The conversation ID associated with this request.""" return self.get("channel_id")
                                                                            +

                                                                            The conversation ID associated with this request.

                                                                            prop enterprise_id : str | None
                                                                            -

                                                                            The Enterprise Grid Organization ID of this request.

                                                                            Expand source code @@ -384,11 +394,10 @@

                                                                            Instance variables

                                                                            """The Enterprise Grid Organization ID of this request.""" return self.get("enterprise_id")
                                                                            +

                                                                            The Enterprise Grid Organization ID of this request.

                                                                            prop function_bot_access_token : str | None
                                                                            -

                                                                            The bot token resolved for this function request. -Only available for function_executed and interactivity events scoped to a custom step.

                                                                            Expand source code @@ -400,11 +409,11 @@

                                                                            Instance variables

                                                                            """ return self.get("function_bot_access_token")
                                                                            +

                                                                            The bot token resolved for this function request. +Only available for function_executed and interactivity events scoped to a custom step.

                                                                            prop function_execution_id : str | None
                                                                            -

                                                                            The function_execution_id associated with this request. -Only available for function_executed and interactivity events scoped to a custom step.

                                                                            Expand source code @@ -416,11 +425,11 @@

                                                                            Instance variables

                                                                            """ return self.get("function_execution_id")
                                                                            +

                                                                            The function_execution_id associated with this request. +Only available for function_executed and interactivity events scoped to a custom step.

                                                                            prop inputs : Dict[str, Any] | None
                                                                            -

                                                                            The inputs associated with this request. -Only available for function_executed and interactivity events scoped to a custom step.

                                                                            Expand source code @@ -432,10 +441,11 @@

                                                                            Instance variables

                                                                            """ return self.get("inputs")
                                                                            +

                                                                            The inputs associated with this request. +Only available for function_executed and interactivity events scoped to a custom step.

                                                                            prop is_enterprise_install : bool | None
                                                                            -

                                                                            True if the request is associated with an Org-wide installation.

                                                                            Expand source code @@ -445,10 +455,10 @@

                                                                            Instance variables

                                                                            """True if the request is associated with an Org-wide installation.""" return self.get("is_enterprise_install")
                                                                            +

                                                                            True if the request is associated with an Org-wide installation.

                                                                            prop logger : logging.Logger
                                                                            -

                                                                            The properly configured logger that is available for middleware/listeners.

                                                                            Expand source code @@ -458,10 +468,10 @@

                                                                            Instance variables

                                                                            """The properly configured logger that is available for middleware/listeners.""" return self["logger"]
                                                                            +

                                                                            The properly configured logger that is available for middleware/listeners.

                                                                            prop matches : Tuple | None
                                                                            -

                                                                            Returns all the matched parts in message listener's regexp

                                                                            Expand source code @@ -471,10 +481,10 @@

                                                                            Instance variables

                                                                            """Returns all the matched parts in message listener's regexp""" return self.get("matches")
                                                                            +

                                                                            Returns all the matched parts in message listener's regexp

                                                                            prop response_url : str | None
                                                                            -

                                                                            The response_url associated with this request.

                                                                            Expand source code @@ -484,10 +494,10 @@

                                                                            Instance variables

                                                                            """The `response_url` associated with this request.""" return self.get("response_url")
                                                                            +

                                                                            The response_url associated with this request.

                                                                            prop team_id : str | None
                                                                            -

                                                                            The Workspace ID of this request.

                                                                            Expand source code @@ -497,10 +507,10 @@

                                                                            Instance variables

                                                                            """The Workspace ID of this request.""" return self.get("team_id")
                                                                            +

                                                                            The Workspace ID of this request.

                                                                            prop thread_ts : str | None
                                                                            -

                                                                            The conversation thread's ID associated with this request.

                                                                            Expand source code @@ -510,10 +520,10 @@

                                                                            Instance variables

                                                                            """The conversation thread's ID associated with this request.""" return self.get("thread_ts")
                                                                            +

                                                                            The conversation thread's ID associated with this request.

                                                                            prop token : str | None
                                                                            -

                                                                            The (bot/user) token resolved for this request.

                                                                            Expand source code @@ -523,10 +533,10 @@

                                                                            Instance variables

                                                                            """The (bot/user) token resolved for this request.""" return self.get("token")
                                                                            +

                                                                            The (bot/user) token resolved for this request.

                                                                            prop user_id : str | None
                                                                            -

                                                                            The user ID associated ith this request.

                                                                            Expand source code @@ -536,10 +546,10 @@

                                                                            Instance variables

                                                                            """The user ID associated ith this request.""" return self.get("user_id")
                                                                            +

                                                                            The user ID associated ith this request.

                                                                            prop user_token : str | None
                                                                            -

                                                                            The user token resolved for this request.

                                                                            Expand source code @@ -549,6 +559,7 @@

                                                                            Instance variables

                                                                            """The user token resolved for this request.""" return self.get("user_token")
                                                                            +

                                                                            The user token resolved for this request.

                                                                            Methods

                                                                            @@ -557,6 +568,23 @@

                                                                            Methods

                                                                            def set_authorize_result(self,
                                                                            authorize_result: AuthorizeResult)
                                                                            +
                                                                            + +Expand source code + +
                                                                            def set_authorize_result(self, authorize_result: AuthorizeResult):
                                                                            +    self["authorize_result"] = authorize_result
                                                                            +    if authorize_result.bot_id is not None:
                                                                            +        self["bot_id"] = authorize_result.bot_id
                                                                            +    if authorize_result.bot_user_id is not None:
                                                                            +        self["bot_user_id"] = authorize_result.bot_user_id
                                                                            +    if authorize_result.bot_token is not None:
                                                                            +        self["bot_token"] = authorize_result.bot_token
                                                                            +    if authorize_result.user_id is not None:
                                                                            +        self["user_id"] = authorize_result.user_id
                                                                            +    if authorize_result.user_token is not None:
                                                                            +        self["user_token"] = authorize_result.user_token
                                                                            +
                                                                            @@ -612,7 +640,7 @@

                                                                            -

                                                                            Generated by pdoc 0.11.3.

                                                                            +

                                                                            Generated by pdoc 0.11.5.

                                                                            diff --git a/docs/static/api-docs/slack_bolt/context/complete/async_complete.html b/docs/static/api-docs/slack_bolt/context/complete/async_complete.html index 36fc95c9..e6ce03d7 100644 --- a/docs/static/api-docs/slack_bolt/context/complete/async_complete.html +++ b/docs/static/api-docs/slack_bolt/context/complete/async_complete.html @@ -3,19 +3,30 @@ - + slack_bolt.context.complete.async_complete API documentation - + @@ -40,7 +51,6 @@

                                                                            Classes

                                                                            (client: slack_sdk.web.async_client.AsyncWebClient,
                                                                            function_execution_id: str | None)
                                                                            -
                                                                            Expand source code @@ -76,15 +86,16 @@

                                                                            Classes

                                                                            function_execution_id=self.function_execution_id, outputs=outputs or {} )
                                                                            +

                                                                            Class variables

                                                                            var client : slack_sdk.web.async_client.AsyncWebClient
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var function_execution_id : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            @@ -116,7 +127,7 @@

                                                                            diff --git a/docs/static/api-docs/slack_bolt/context/complete/complete.html b/docs/static/api-docs/slack_bolt/context/complete/complete.html index 7e317bf5..ef6c6c78 100644 --- a/docs/static/api-docs/slack_bolt/context/complete/complete.html +++ b/docs/static/api-docs/slack_bolt/context/complete/complete.html @@ -3,19 +3,30 @@ - + slack_bolt.context.complete.complete API documentation - + @@ -40,7 +51,6 @@

                                                                            Classes

                                                                            (client: slack_sdk.web.client.WebClient, function_execution_id: str | None)
                                                                            -
                                                                            Expand source code @@ -74,15 +84,16 @@

                                                                            Classes

                                                                            return self.client.functions_completeSuccess(function_execution_id=self.function_execution_id, outputs=outputs or {})
                                                                            +

                                                                            Class variables

                                                                            var client : slack_sdk.web.client.WebClient
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var function_execution_id : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            @@ -114,7 +125,7 @@

                                                                            -

                                                                            Generated by pdoc 0.11.3.

                                                                            +

                                                                            Generated by pdoc 0.11.5.

                                                                            diff --git a/docs/static/api-docs/slack_bolt/context/complete/index.html b/docs/static/api-docs/slack_bolt/context/complete/index.html index d4b854f0..f476fa25 100644 --- a/docs/static/api-docs/slack_bolt/context/complete/index.html +++ b/docs/static/api-docs/slack_bolt/context/complete/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.complete API documentation - + @@ -51,7 +62,6 @@

                                                                            Classes

                                                                            (client: slack_sdk.web.client.WebClient, function_execution_id: str | None)
                                                                            -
                                                                            Expand source code @@ -85,15 +95,16 @@

                                                                            Classes

                                                                            return self.client.functions_completeSuccess(function_execution_id=self.function_execution_id, outputs=outputs or {})
                                                                            +

                                                                            Class variables

                                                                            var client : slack_sdk.web.client.WebClient
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            var function_execution_id : str | None
                                                                            -
                                                                            +

                                                                            The type of the None singleton.

                                                                            @@ -131,7 +142,7 @@

                                                                            -

                                                                            Generated by pdoc 0.11.3.

                                                                            +

                                                                            Generated by pdoc 0.11.5.

                                                                            diff --git a/docs/static/api-docs/slack_bolt/context/context.html b/docs/static/api-docs/slack_bolt/context/context.html index a4b72f66..c1ae2789 100644 --- a/docs/static/api-docs/slack_bolt/context/context.html +++ b/docs/static/api-docs/slack_bolt/context/context.html @@ -3,19 +3,30 @@ - + slack_bolt.context.context API documentation - + @@ -40,7 +51,6 @@

                                                                            Classes

                                                                            (*args, **kwargs)
                                                                            -

                                                                            Context object associated with a request from Slack.

                                                                            Expand source code @@ -237,6 +247,7 @@

                                                                            Classes

                                                                            def save_thread_context(self) -> Optional[SaveThreadContext]: return self.get("save_thread_context")
                                                                            +

                                                                            Context object associated with a request from Slack.

                                                                            Ancestors

                                                                            • BaseContext
                                                                            • @@ -246,18 +257,6 @@

                                                                              Instance variables

                                                                              prop ackAck
                                                                              -

                                                                              ack() function for this request.

                                                                              -
                                                                              @app.action("button")
                                                                              -def handle_button_clicks(context):
                                                                              -    context.ack()
                                                                              -
                                                                              -# You can access "ack" this way too.
                                                                              -@app.action("button")
                                                                              -def handle_button_clicks(ack):
                                                                              -    ack()
                                                                              -
                                                                              -

                                                                              Returns

                                                                              -

                                                                              Callable ack() function

                                                                              Expand source code @@ -282,27 +281,21 @@

                                                                              Returns

                                                                              self["ack"] = Ack() return self["ack"]
                                                                              -
                                                                              -
                                                                              prop client : slack_sdk.web.client.WebClient
                                                                              -
                                                                              -

                                                                              The WebClient instance available for this request.

                                                                              -
                                                                              @app.event("app_mention")
                                                                              -def handle_events(context):
                                                                              -    context.client.chat_postMessage(
                                                                              -        channel=context.channel_id,
                                                                              -        text="Thanks!",
                                                                              -    )
                                                                              +

                                                                              ack() function for this request.

                                                                              +
                                                                              @app.action("button")
                                                                              +def handle_button_clicks(context):
                                                                              +    context.ack()
                                                                               
                                                                              -# You can access "client" this way too.
                                                                              -@app.event("app_mention")
                                                                              -def handle_events(client, context):
                                                                              -    client.chat_postMessage(
                                                                              -        channel=context.channel_id,
                                                                              -        text="Thanks!",
                                                                              -    )
                                                                              +# You can access "ack" this way too.
                                                                              +@app.action("button")
                                                                              +def handle_button_clicks(ack):
                                                                              +    ack()
                                                                               

                                                                              Returns

                                                                              -

                                                                              WebClient instance

                                                                              +

                                                                              Callable ack() function

                                                                              +
                                                                              +
                                                                              prop client : slack_sdk.web.client.WebClient
                                                                              +
                                                                              Expand source code @@ -333,25 +326,27 @@

                                                                              Returns

                                                                              self["client"] = WebClient(token=None) return self["client"]
                                                                              -
                                                                              -
                                                                              prop completeComplete
                                                                              -
                                                                              -

                                                                              complete() function for this request. Once a custom function's state is set to complete, -any outputs the function returns will be passed along to the next step of its housing workflow, -or complete the workflow if the function is the last step in a workflow. Additionally, -any interactivity handlers associated to a function invocation will no longer be invocable.

                                                                              -
                                                                              @app.function("reverse")
                                                                              -def handle_button_clicks(ack, complete):
                                                                              -    ack()
                                                                              -    complete(outputs={"stringReverse":"olleh"})
                                                                              +

                                                                              The WebClient instance available for this request.

                                                                              +
                                                                              @app.event("app_mention")
                                                                              +def handle_events(context):
                                                                              +    context.client.chat_postMessage(
                                                                              +        channel=context.channel_id,
                                                                              +        text="Thanks!",
                                                                              +    )
                                                                               
                                                                              -@app.function("reverse")
                                                                              -def handle_button_clicks(context):
                                                                              -    context.ack()
                                                                              -    context.complete(outputs={"stringReverse":"olleh"})
                                                                              +# You can access "client" this way too.
                                                                              +@app.event("app_mention")
                                                                              +def handle_events(client, context):
                                                                              +    client.chat_postMessage(
                                                                              +        channel=context.channel_id,
                                                                              +        text="Thanks!",
                                                                              +    )
                                                                               

                                                                              Returns

                                                                              -

                                                                              Callable complete() function

                                                                              +

                                                                              WebClient instance

                                                                              +
                                                                              +
                                                                              prop completeComplete
                                                                              +
                                                                              Expand source code @@ -380,25 +375,25 @@

                                                                              Returns

                                                                              self["complete"] = Complete(client=self.client, function_execution_id=self.function_execution_id) return self["complete"]
                                                                              -
                                                                              -
                                                                              prop failFail
                                                                              -
                                                                              -

                                                                              fail() function for this request. Once a custom function's state is set to error, -its housing workflow will be interrupted and any provided error message will be passed -on to the end user through SlackBot. Additionally, any interactivity handlers associated -to a function invocation will no longer be invocable.

                                                                              +

                                                                              complete() function for this request. Once a custom function's state is set to complete, +any outputs the function returns will be passed along to the next step of its housing workflow, +or complete the workflow if the function is the last step in a workflow. Additionally, +any interactivity handlers associated to a function invocation will no longer be invocable.

                                                                              @app.function("reverse")
                                                                              -def handle_button_clicks(ack, fail):
                                                                              +def handle_button_clicks(ack, complete):
                                                                                   ack()
                                                                              -    fail(error="something went wrong")
                                                                              +    complete(outputs={"stringReverse":"olleh"})
                                                                               
                                                                               @app.function("reverse")
                                                                               def handle_button_clicks(context):
                                                                                   context.ack()
                                                                              -    context.fail(error="something went wrong")
                                                                              +    context.complete(outputs={"stringReverse":"olleh"})
                                                                               

                                                                              Returns

                                                                              -

                                                                              Callable fail() function

                                                                              +

                                                                              Callable complete() function

                                                                              +
                                                                              +
                                                                              prop failFail
                                                                              +
                                                                              Expand source code @@ -427,10 +422,25 @@

                                                                              Returns

                                                                              self["fail"] = Fail(client=self.client, function_execution_id=self.function_execution_id) return self["fail"]
                                                                              +

                                                                              fail() function for this request. Once a custom function's state is set to error, +its housing workflow will be interrupted and any provided error message will be passed +on to the end user through SlackBot. Additionally, any interactivity handlers associated +to a function invocation will no longer be invocable.

                                                                              +
                                                                              @app.function("reverse")
                                                                              +def handle_button_clicks(ack, fail):
                                                                              +    ack()
                                                                              +    fail(error="something went wrong")
                                                                              +
                                                                              +@app.function("reverse")
                                                                              +def handle_button_clicks(context):
                                                                              +    context.ack()
                                                                              +    context.fail(error="something went wrong")
                                                                              +
                                                                              +

                                                                              Returns

                                                                              +

                                                                              Callable fail() function

                                                                              prop get_thread_contextGetThreadContext | None
                                                                              -
                                                                              Expand source code @@ -439,10 +449,10 @@

                                                                              Returns

                                                                              def get_thread_context(self) -> Optional[GetThreadContext]: return self.get("get_thread_context")
                                                                              +
                                                                              prop listener_runner : ThreadListenerRunner
                                                                              -

                                                                              The properly configured listener_runner that is available for middleware/listeners.

                                                                              Expand source code @@ -452,23 +462,10 @@

                                                                              Returns

                                                                              """The properly configured listener_runner that is available for middleware/listeners.""" return self["listener_runner"]
                                                                              +

                                                                              The properly configured listener_runner that is available for middleware/listeners.

                                                                              prop respondRespond | None
                                                                              -

                                                                              respond() function for this request.

                                                                              -
                                                                              @app.action("button")
                                                                              -def handle_button_clicks(context):
                                                                              -    context.ack()
                                                                              -    context.respond("Hi!")
                                                                              -
                                                                              -# You can access "ack" this way too.
                                                                              -@app.action("button")
                                                                              -def handle_button_clicks(ack, respond):
                                                                              -    ack()
                                                                              -    respond("Hi!")
                                                                              -
                                                                              -

                                                                              Returns

                                                                              -

                                                                              Callable respond() function

                                                                              Expand source code @@ -499,10 +496,23 @@

                                                                              Returns

                                                                              ) return self["respond"]
                                                                              +

                                                                              respond() function for this request.

                                                                              +
                                                                              @app.action("button")
                                                                              +def handle_button_clicks(context):
                                                                              +    context.ack()
                                                                              +    context.respond("Hi!")
                                                                              +
                                                                              +# You can access "ack" this way too.
                                                                              +@app.action("button")
                                                                              +def handle_button_clicks(ack, respond):
                                                                              +    ack()
                                                                              +    respond("Hi!")
                                                                              +
                                                                              +

                                                                              Returns

                                                                              +

                                                                              Callable respond() function

                                                                              prop save_thread_contextSaveThreadContext | None
                                                                              -
                                                                              Expand source code @@ -511,23 +521,10 @@

                                                                              Returns

                                                                              def save_thread_context(self) -> Optional[SaveThreadContext]: return self.get("save_thread_context")
                                                                              +
                                                                              prop saySay
                                                                              -

                                                                              say() function for this request.

                                                                              -
                                                                              @app.action("button")
                                                                              -def handle_button_clicks(context):
                                                                              -    context.ack()
                                                                              -    context.say("Hi!")
                                                                              -
                                                                              -# You can access "ack" this way too.
                                                                              -@app.action("button")
                                                                              -def handle_button_clicks(ack, say):
                                                                              -    ack()
                                                                              -    say("Hi!")
                                                                              -
                                                                              -

                                                                              Returns

                                                                              -

                                                                              Callable say() function

                                                                              Expand source code @@ -554,10 +551,23 @@

                                                                              Returns

                                                                              self["say"] = Say(client=self.client, channel=self.channel_id, thread_ts=self.thread_ts) return self["say"]
                                                                              +

                                                                              say() function for this request.

                                                                              +
                                                                              @app.action("button")
                                                                              +def handle_button_clicks(context):
                                                                              +    context.ack()
                                                                              +    context.say("Hi!")
                                                                              +
                                                                              +# You can access "ack" this way too.
                                                                              +@app.action("button")
                                                                              +def handle_button_clicks(ack, say):
                                                                              +    ack()
                                                                              +    say("Hi!")
                                                                              +
                                                                              +

                                                                              Returns

                                                                              +

                                                                              Callable say() function

                                                                              prop set_statusSetStatus | None
                                                                              -
                                                                              Expand source code @@ -566,10 +576,10 @@

                                                                              Returns

                                                                              def set_status(self) -> Optional[SetStatus]: return self.get("set_status")
                                                                              +
                                                                              prop set_suggested_promptsSetSuggestedPrompts | None
                                                                              -
                                                                              Expand source code @@ -578,10 +588,10 @@

                                                                              Returns

                                                                              def set_suggested_prompts(self) -> Optional[SetSuggestedPrompts]: return self.get("set_suggested_prompts")
                                                                              +
                                                                              prop set_titleSetTitle | None
                                                                              -
                                                                              Expand source code @@ -590,6 +600,7 @@

                                                                              Returns

                                                                              def set_title(self) -> Optional[SetTitle]: return self.get("set_title")
                                                                              +

                                                                              Methods

                                                                              @@ -598,6 +609,31 @@

                                                                              Methods

                                                                              def to_copyable(self) ‑> BoltContext
                                                                              +
                                                                              + +Expand source code + +
                                                                              def to_copyable(self) -> "BoltContext":
                                                                              +    new_dict = {}
                                                                              +    for prop_name, prop_value in self.items():
                                                                              +        if prop_name in self.copyable_standard_property_names:
                                                                              +            # all the standard properties are copiable
                                                                              +            new_dict[prop_name] = prop_value
                                                                              +        elif prop_name in self.non_copyable_standard_property_names:
                                                                              +            # Do nothing with this property (e.g., listener_runner)
                                                                              +            continue
                                                                              +        else:
                                                                              +            try:
                                                                              +                copied_value = create_copy(prop_value)
                                                                              +                new_dict[prop_name] = copied_value
                                                                              +            except TypeError as te:
                                                                              +                self.logger.warning(
                                                                              +                    f"Skipped setting '{prop_name}' to a copied request for lazy listeners "
                                                                              +                    "due to a deep-copy creation error. Consider passing the value not as part of context object "
                                                                              +                    f"(error: {te})"
                                                                              +                )
                                                                              +    return BoltContext(new_dict)
                                                                              +
                                                                              @@ -613,6 +649,7 @@

                                                                              Inherited members

                                                                            • bot_token
                                                                            • bot_user_id
                                                                            • channel_id
                                                                            • +
                                                                            • copyable_standard_property_names
                                                                            • enterprise_id
                                                                            • function_bot_access_token
                                                                            • function_execution_id
                                                                            • @@ -620,7 +657,9 @@

                                                                              Inherited members

                                                                            • is_enterprise_install
                                                                            • logger
                                                                            • matches
                                                                            • +
                                                                            • non_copyable_standard_property_names
                                                                            • response_url
                                                                            • +
                                                                            • standard_property_names
                                                                            • team_id
                                                                            • thread_ts
                                                                            • token
                                                                            • @@ -669,7 +708,7 @@

                                                                              -

                                                                              Generated by pdoc 0.11.3.

                                                                              +

                                                                              Generated by pdoc 0.11.5.

                                                                              diff --git a/docs/static/api-docs/slack_bolt/context/fail/async_fail.html b/docs/static/api-docs/slack_bolt/context/fail/async_fail.html index 49528b4c..91497eff 100644 --- a/docs/static/api-docs/slack_bolt/context/fail/async_fail.html +++ b/docs/static/api-docs/slack_bolt/context/fail/async_fail.html @@ -3,19 +3,30 @@ - + slack_bolt.context.fail.async_fail API documentation - + @@ -40,7 +51,6 @@

                                                                              Classes

                                                                              (client: slack_sdk.web.async_client.AsyncWebClient,
                                                                              function_execution_id: str | None)
                                                                              -
                                                                              Expand source code @@ -74,15 +84,16 @@

                                                                              Classes

                                                                              return await self.client.functions_completeError(function_execution_id=self.function_execution_id, error=error)
                                                                              +

                                                                              Class variables

                                                                              var client : slack_sdk.web.async_client.AsyncWebClient
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var function_execution_id : str | None
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              @@ -114,7 +125,7 @@

                                                                              -

                                                                              Generated by pdoc 0.11.3.

                                                                              +

                                                                              Generated by pdoc 0.11.5.

                                                                              diff --git a/docs/static/api-docs/slack_bolt/context/fail/fail.html b/docs/static/api-docs/slack_bolt/context/fail/fail.html index 6f191fd7..20d44d1d 100644 --- a/docs/static/api-docs/slack_bolt/context/fail/fail.html +++ b/docs/static/api-docs/slack_bolt/context/fail/fail.html @@ -3,19 +3,30 @@ - + slack_bolt.context.fail.fail API documentation - + @@ -40,7 +51,6 @@

                                                                              Classes

                                                                              (client: slack_sdk.web.client.WebClient, function_execution_id: str | None)
                                                                              -
                                                                              Expand source code @@ -74,15 +84,16 @@

                                                                              Classes

                                                                              return self.client.functions_completeError(function_execution_id=self.function_execution_id, error=error)
                                                                              +

                                                                              Class variables

                                                                              var client : slack_sdk.web.client.WebClient
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var function_execution_id : str | None
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              @@ -114,7 +125,7 @@

                                                                              -

                                                                              Generated by pdoc 0.11.3.

                                                                              +

                                                                              Generated by pdoc 0.11.5.

                                                                              diff --git a/docs/static/api-docs/slack_bolt/context/fail/index.html b/docs/static/api-docs/slack_bolt/context/fail/index.html index a4939084..2b14ac77 100644 --- a/docs/static/api-docs/slack_bolt/context/fail/index.html +++ b/docs/static/api-docs/slack_bolt/context/fail/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.fail API documentation - + @@ -51,7 +62,6 @@

                                                                              Classes

                                                                              (client: slack_sdk.web.client.WebClient, function_execution_id: str | None)
                                                                              -
                                                                              Expand source code @@ -85,15 +95,16 @@

                                                                              Classes

                                                                              return self.client.functions_completeError(function_execution_id=self.function_execution_id, error=error)
                                                                              +

                                                                              Class variables

                                                                              var client : slack_sdk.web.client.WebClient
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var function_execution_id : str | None
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              @@ -131,7 +142,7 @@

                                                                              -

                                                                              Generated by pdoc 0.11.3.

                                                                              +

                                                                              Generated by pdoc 0.11.5.

                                                                              diff --git a/docs/static/api-docs/slack_bolt/context/get_thread_context/async_get_thread_context.html b/docs/static/api-docs/slack_bolt/context/get_thread_context/async_get_thread_context.html index 58e473fc..66500752 100644 --- a/docs/static/api-docs/slack_bolt/context/get_thread_context/async_get_thread_context.html +++ b/docs/static/api-docs/slack_bolt/context/get_thread_context/async_get_thread_context.html @@ -3,19 +3,30 @@ - + slack_bolt.context.get_thread_context.async_get_thread_context API documentation - + @@ -40,7 +51,6 @@

                                                                              Classes

                                                                              (thread_context_store: AsyncAssistantThreadContextStore,
                                                                              channel_id: str,
                                                                              thread_ts: str,
                                                                              payload: dict)
                                                                              -
                                                                              Expand source code @@ -88,27 +98,28 @@

                                                                              Classes

                                                                              return self._thread_context
                                                                              +

                                                                              Class variables

                                                                              var channel_id : str
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var payload : dict
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var thread_context_loaded : bool
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var thread_context_storeAsyncAssistantThreadContextStore
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var thread_ts : str
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              @@ -143,7 +154,7 @@

                                                                              -

                                                                              Generated by pdoc 0.11.3.

                                                                              +

                                                                              Generated by pdoc 0.11.5.

                                                                              diff --git a/docs/static/api-docs/slack_bolt/context/get_thread_context/get_thread_context.html b/docs/static/api-docs/slack_bolt/context/get_thread_context/get_thread_context.html index 24f38365..a6777da3 100644 --- a/docs/static/api-docs/slack_bolt/context/get_thread_context/get_thread_context.html +++ b/docs/static/api-docs/slack_bolt/context/get_thread_context/get_thread_context.html @@ -3,19 +3,30 @@ - + slack_bolt.context.get_thread_context.get_thread_context API documentation - + @@ -40,7 +51,6 @@

                                                                              Classes

                                                                              (thread_context_store: AssistantThreadContextStore,
                                                                              channel_id: str,
                                                                              thread_ts: str,
                                                                              payload: dict)
                                                                              -
                                                                              Expand source code @@ -88,27 +98,28 @@

                                                                              Classes

                                                                              return self._thread_context
                                                                              +

                                                                              Class variables

                                                                              var channel_id : str
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var payload : dict
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var thread_context_loaded : bool
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var thread_context_storeAssistantThreadContextStore
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var thread_ts : str
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              @@ -143,7 +154,7 @@

                                                                              -

                                                                              Generated by pdoc 0.11.3.

                                                                              +

                                                                              Generated by pdoc 0.11.5.

                                                                              diff --git a/docs/static/api-docs/slack_bolt/context/get_thread_context/index.html b/docs/static/api-docs/slack_bolt/context/get_thread_context/index.html index 3cffdd92..ffd09591 100644 --- a/docs/static/api-docs/slack_bolt/context/get_thread_context/index.html +++ b/docs/static/api-docs/slack_bolt/context/get_thread_context/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.get_thread_context API documentation - + @@ -51,7 +62,6 @@

                                                                              Classes

                                                                              (thread_context_store: AssistantThreadContextStore,
                                                                              channel_id: str,
                                                                              thread_ts: str,
                                                                              payload: dict)
                                                                              -
                                                                              Expand source code @@ -99,27 +109,28 @@

                                                                              Classes

                                                                              return self._thread_context
                                                                              +

                                                                              Class variables

                                                                              var channel_id : str
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var payload : dict
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var thread_context_loaded : bool
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var thread_context_storeAssistantThreadContextStore
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              var thread_ts : str
                                                                              -
                                                                              +

                                                                              The type of the None singleton.

                                                                              @@ -160,7 +171,7 @@

                                                                              diff --git a/docs/static/api-docs/slack_bolt/context/index.html b/docs/static/api-docs/slack_bolt/context/index.html index 293e1f0f..4d3f472c 100644 --- a/docs/static/api-docs/slack_bolt/context/index.html +++ b/docs/static/api-docs/slack_bolt/context/index.html @@ -3,20 +3,31 @@ - + slack_bolt.context API documentation - + @@ -104,7 +115,6 @@

                                                                              Classes

                                                                              (*args, **kwargs)
                                                                              -

                                                                              Context object associated with a request from Slack.

                                                                              Expand source code @@ -301,6 +311,7 @@

                                                                              Classes

                                                                              def save_thread_context(self) -> Optional[SaveThreadContext]: return self.get("save_thread_context")
                                                                              +

                                                                              Context object associated with a request from Slack.

                                                                              Ancestors

                                                                              • BaseContext
                                                                              • @@ -310,18 +321,6 @@

                                                                                Instance variables

                                                                                prop ackAck
                                                                                -

                                                                                slack_bolt.context.ack function for this request.

                                                                                -
                                                                                @app.action("button")
                                                                                -def handle_button_clicks(context):
                                                                                -    context.ack()
                                                                                -
                                                                                -# You can access "ack" this way too.
                                                                                -@app.action("button")
                                                                                -def handle_button_clicks(ack):
                                                                                -    ack()
                                                                                -
                                                                                -

                                                                                Returns

                                                                                -

                                                                                Callable slack_bolt.context.ack function

                                                                                Expand source code @@ -346,27 +345,21 @@

                                                                                Returns

                                                                                self["ack"] = Ack() return self["ack"]
                                                                                -
                                                                                -
                                                                                prop client : slack_sdk.web.client.WebClient
                                                                                -
                                                                                -

                                                                                The WebClient instance available for this request.

                                                                                -
                                                                                @app.event("app_mention")
                                                                                -def handle_events(context):
                                                                                -    context.client.chat_postMessage(
                                                                                -        channel=context.channel_id,
                                                                                -        text="Thanks!",
                                                                                -    )
                                                                                +

                                                                                slack_bolt.context.ack function for this request.

                                                                                +
                                                                                @app.action("button")
                                                                                +def handle_button_clicks(context):
                                                                                +    context.ack()
                                                                                 
                                                                                -# You can access "client" this way too.
                                                                                -@app.event("app_mention")
                                                                                -def handle_events(client, context):
                                                                                -    client.chat_postMessage(
                                                                                -        channel=context.channel_id,
                                                                                -        text="Thanks!",
                                                                                -    )
                                                                                +# You can access "ack" this way too.
                                                                                +@app.action("button")
                                                                                +def handle_button_clicks(ack):
                                                                                +    ack()
                                                                                 

                                                                                Returns

                                                                                -

                                                                                WebClient instance

                                                                                +

                                                                                Callable slack_bolt.context.ack function

                                                                                +
                                                                                +
                                                                                prop client : slack_sdk.web.client.WebClient
                                                                                +
                                                                                Expand source code @@ -397,25 +390,27 @@

                                                                                Returns

                                                                                self["client"] = WebClient(token=None) return self["client"]
                                                                                -
                                                                                -
                                                                                prop completeComplete
                                                                                -
                                                                                -

                                                                                slack_bolt.context.complete function for this request. Once a custom function's state is set to complete, -any outputs the function returns will be passed along to the next step of its housing workflow, -or complete the workflow if the function is the last step in a workflow. Additionally, -any interactivity handlers associated to a function invocation will no longer be invocable.

                                                                                -
                                                                                @app.function("reverse")
                                                                                -def handle_button_clicks(ack, complete):
                                                                                -    ack()
                                                                                -    complete(outputs={"stringReverse":"olleh"})
                                                                                +

                                                                                The WebClient instance available for this request.

                                                                                +
                                                                                @app.event("app_mention")
                                                                                +def handle_events(context):
                                                                                +    context.client.chat_postMessage(
                                                                                +        channel=context.channel_id,
                                                                                +        text="Thanks!",
                                                                                +    )
                                                                                 
                                                                                -@app.function("reverse")
                                                                                -def handle_button_clicks(context):
                                                                                -    context.ack()
                                                                                -    context.complete(outputs={"stringReverse":"olleh"})
                                                                                +# You can access "client" this way too.
                                                                                +@app.event("app_mention")
                                                                                +def handle_events(client, context):
                                                                                +    client.chat_postMessage(
                                                                                +        channel=context.channel_id,
                                                                                +        text="Thanks!",
                                                                                +    )
                                                                                 

                                                                                Returns

                                                                                -

                                                                                Callable slack_bolt.context.complete function

                                                                                +

                                                                                WebClient instance

                                                                                +
                                                                                +
                                                                                prop completeComplete
                                                                                +
                                                                                Expand source code @@ -444,25 +439,25 @@

                                                                                Returns

                                                                                self["complete"] = Complete(client=self.client, function_execution_id=self.function_execution_id) return self["complete"]
                                                                                -
                                                                                -
                                                                                prop failFail
                                                                                -
                                                                                -

                                                                                slack_bolt.context.fail function for this request. Once a custom function's state is set to error, -its housing workflow will be interrupted and any provided error message will be passed -on to the end user through SlackBot. Additionally, any interactivity handlers associated -to a function invocation will no longer be invocable.

                                                                                +

                                                                                slack_bolt.context.complete function for this request. Once a custom function's state is set to complete, +any outputs the function returns will be passed along to the next step of its housing workflow, +or complete the workflow if the function is the last step in a workflow. Additionally, +any interactivity handlers associated to a function invocation will no longer be invocable.

                                                                                @app.function("reverse")
                                                                                -def handle_button_clicks(ack, fail):
                                                                                +def handle_button_clicks(ack, complete):
                                                                                     ack()
                                                                                -    fail(error="something went wrong")
                                                                                +    complete(outputs={"stringReverse":"olleh"})
                                                                                 
                                                                                 @app.function("reverse")
                                                                                 def handle_button_clicks(context):
                                                                                     context.ack()
                                                                                -    context.fail(error="something went wrong")
                                                                                +    context.complete(outputs={"stringReverse":"olleh"})
                                                                                 

                                                                                Returns

                                                                                -

                                                                                Callable slack_bolt.context.fail function

                                                                                +

                                                                                Callable slack_bolt.context.complete function

                                                                                +
                                                                                +
                                                                                prop failFail
                                                                                +
                                                                                Expand source code @@ -491,10 +486,25 @@

                                                                                Returns

                                                                                self["fail"] = Fail(client=self.client, function_execution_id=self.function_execution_id) return self["fail"]
                                                                                +

                                                                                slack_bolt.context.fail function for this request. Once a custom function's state is set to error, +its housing workflow will be interrupted and any provided error message will be passed +on to the end user through SlackBot. Additionally, any interactivity handlers associated +to a function invocation will no longer be invocable.

                                                                                +
                                                                                @app.function("reverse")
                                                                                +def handle_button_clicks(ack, fail):
                                                                                +    ack()
                                                                                +    fail(error="something went wrong")
                                                                                +
                                                                                +@app.function("reverse")
                                                                                +def handle_button_clicks(context):
                                                                                +    context.ack()
                                                                                +    context.fail(error="something went wrong")
                                                                                +
                                                                                +

                                                                                Returns

                                                                                +

                                                                                Callable slack_bolt.context.fail function

                                                                                prop get_thread_contextGetThreadContext | None
                                                                                -
                                                                                Expand source code @@ -503,10 +513,10 @@

                                                                                Returns

                                                                                def get_thread_context(self) -> Optional[GetThreadContext]: return self.get("get_thread_context")
                                                                                +
                                                                                prop listener_runner : ThreadListenerRunner
                                                                                -

                                                                                The properly configured listener_runner that is available for middleware/listeners.

                                                                                Expand source code @@ -516,23 +526,10 @@

                                                                                Returns

                                                                                """The properly configured listener_runner that is available for middleware/listeners.""" return self["listener_runner"]
                                                                                +

                                                                                The properly configured listener_runner that is available for middleware/listeners.

                                                                                prop respondRespond | None
                                                                                -

                                                                                slack_bolt.context.respond function for this request.

                                                                                -
                                                                                @app.action("button")
                                                                                -def handle_button_clicks(context):
                                                                                -    context.ack()
                                                                                -    context.respond("Hi!")
                                                                                -
                                                                                -# You can access "ack" this way too.
                                                                                -@app.action("button")
                                                                                -def handle_button_clicks(ack, respond):
                                                                                -    ack()
                                                                                -    respond("Hi!")
                                                                                -
                                                                                -

                                                                                Returns

                                                                                -

                                                                                Callable slack_bolt.context.respond function

                                                                                Expand source code @@ -563,10 +560,23 @@

                                                                                Returns

                                                                                ) return self["respond"]
                                                                                +

                                                                                slack_bolt.context.respond function for this request.

                                                                                +
                                                                                @app.action("button")
                                                                                +def handle_button_clicks(context):
                                                                                +    context.ack()
                                                                                +    context.respond("Hi!")
                                                                                +
                                                                                +# You can access "ack" this way too.
                                                                                +@app.action("button")
                                                                                +def handle_button_clicks(ack, respond):
                                                                                +    ack()
                                                                                +    respond("Hi!")
                                                                                +
                                                                                +

                                                                                Returns

                                                                                +

                                                                                Callable slack_bolt.context.respond function

                                                                                prop save_thread_contextSaveThreadContext | None
                                                                                -
                                                                                Expand source code @@ -575,23 +585,10 @@

                                                                                Returns

                                                                                def save_thread_context(self) -> Optional[SaveThreadContext]: return self.get("save_thread_context")
                                                                                +
                                                                                prop saySay
                                                                                -

                                                                                slack_bolt.context.say function for this request.

                                                                                -
                                                                                @app.action("button")
                                                                                -def handle_button_clicks(context):
                                                                                -    context.ack()
                                                                                -    context.say("Hi!")
                                                                                -
                                                                                -# You can access "ack" this way too.
                                                                                -@app.action("button")
                                                                                -def handle_button_clicks(ack, say):
                                                                                -    ack()
                                                                                -    say("Hi!")
                                                                                -
                                                                                -

                                                                                Returns

                                                                                -

                                                                                Callable slack_bolt.context.say function

                                                                                Expand source code @@ -618,10 +615,23 @@

                                                                                Returns

                                                                                self["say"] = Say(client=self.client, channel=self.channel_id, thread_ts=self.thread_ts) return self["say"]
                                                                                +

                                                                                slack_bolt.context.say function for this request.

                                                                                +
                                                                                @app.action("button")
                                                                                +def handle_button_clicks(context):
                                                                                +    context.ack()
                                                                                +    context.say("Hi!")
                                                                                +
                                                                                +# You can access "ack" this way too.
                                                                                +@app.action("button")
                                                                                +def handle_button_clicks(ack, say):
                                                                                +    ack()
                                                                                +    say("Hi!")
                                                                                +
                                                                                +

                                                                                Returns

                                                                                +

                                                                                Callable slack_bolt.context.say function

                                                                                prop set_statusSetStatus | None
                                                                                -
                                                                                Expand source code @@ -630,10 +640,10 @@

                                                                                Returns

                                                                                def set_status(self) -> Optional[SetStatus]: return self.get("set_status")
                                                                                +
                                                                                prop set_suggested_promptsSetSuggestedPrompts | None
                                                                                -
                                                                                Expand source code @@ -642,10 +652,10 @@

                                                                                Returns

                                                                                def set_suggested_prompts(self) -> Optional[SetSuggestedPrompts]: return self.get("set_suggested_prompts")
                                                                                +
                                                                                prop set_titleSetTitle | None
                                                                                -
                                                                                Expand source code @@ -654,6 +664,7 @@

                                                                                Returns

                                                                                def set_title(self) -> Optional[SetTitle]: return self.get("set_title")
                                                                                +

                                                                                Methods

                                                                                @@ -662,6 +673,31 @@

                                                                                Methods

                                                                                def to_copyable(self) ‑> BoltContext
                                                                                +
                                                                                + +Expand source code + +
                                                                                def to_copyable(self) -> "BoltContext":
                                                                                +    new_dict = {}
                                                                                +    for prop_name, prop_value in self.items():
                                                                                +        if prop_name in self.copyable_standard_property_names:
                                                                                +            # all the standard properties are copiable
                                                                                +            new_dict[prop_name] = prop_value
                                                                                +        elif prop_name in self.non_copyable_standard_property_names:
                                                                                +            # Do nothing with this property (e.g., listener_runner)
                                                                                +            continue
                                                                                +        else:
                                                                                +            try:
                                                                                +                copied_value = create_copy(prop_value)
                                                                                +                new_dict[prop_name] = copied_value
                                                                                +            except TypeError as te:
                                                                                +                self.logger.warning(
                                                                                +                    f"Skipped setting '{prop_name}' to a copied request for lazy listeners "
                                                                                +                    "due to a deep-copy creation error. Consider passing the value not as part of context object "
                                                                                +                    f"(error: {te})"
                                                                                +                )
                                                                                +    return BoltContext(new_dict)
                                                                                +
                                                                                @@ -677,6 +713,7 @@

                                                                                Inherited members

                                                                              • bot_token
                                                                              • bot_user_id
                                                                              • channel_id
                                                                              • +
                                                                              • copyable_standard_property_names
                                                                              • enterprise_id
                                                                              • function_bot_access_token
                                                                              • function_execution_id
                                                                              • @@ -684,7 +721,9 @@

                                                                                Inherited members

                                                                              • is_enterprise_install
                                                                              • logger
                                                                              • matches
                                                                              • +
                                                                              • non_copyable_standard_property_names
                                                                              • response_url
                                                                              • +
                                                                              • standard_property_names
                                                                              • team_id
                                                                              • thread_ts
                                                                              • token
                                                                              • @@ -751,7 +790,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/respond/async_respond.html b/docs/static/api-docs/slack_bolt/context/respond/async_respond.html index 2295005f..148e1607 100644 --- a/docs/static/api-docs/slack_bolt/context/respond/async_respond.html +++ b/docs/static/api-docs/slack_bolt/context/respond/async_respond.html @@ -3,19 +3,30 @@ - + slack_bolt.context.respond.async_respond API documentation - + @@ -40,7 +51,6 @@

                                                                                Classes

                                                                                (*,
                                                                                response_url: str | None,
                                                                                proxy: str | None = None,
                                                                                ssl: ssl.SSLContext | None = None)
                                                                                -
                                                                                Expand source code @@ -104,19 +114,20 @@

                                                                                Classes

                                                                                else: raise ValueError("respond is unsupported here as there is no response_url")
                                                                                +

                                                                                Class variables

                                                                                var proxy : str | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var response_url : str | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var ssl : ssl.SSLContext | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -149,7 +160,7 @@

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/respond/index.html b/docs/static/api-docs/slack_bolt/context/respond/index.html index 3b46a90d..94693dcc 100644 --- a/docs/static/api-docs/slack_bolt/context/respond/index.html +++ b/docs/static/api-docs/slack_bolt/context/respond/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.respond API documentation - + @@ -55,7 +66,6 @@

                                                                                Classes

                                                                                (*,
                                                                                response_url: str | None,
                                                                                proxy: str | None = None,
                                                                                ssl: ssl.SSLContext | None = None)
                                                                                -
                                                                                Expand source code @@ -119,19 +129,20 @@

                                                                                Classes

                                                                                else: raise ValueError("respond is unsupported here as there is no response_url")
                                                                                +

                                                                                Class variables

                                                                                var proxy : str | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var response_url : str | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var ssl : ssl.SSLContext | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -171,7 +182,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/respond/internals.html b/docs/static/api-docs/slack_bolt/context/respond/internals.html index 982d41ce..295a793a 100644 --- a/docs/static/api-docs/slack_bolt/context/respond/internals.html +++ b/docs/static/api-docs/slack_bolt/context/respond/internals.html @@ -3,19 +3,30 @@ - + slack_bolt.context.respond.internals API documentation - + @@ -49,7 +60,7 @@

                                                                                Module slack_bolt.context.respond.internals

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/respond/respond.html b/docs/static/api-docs/slack_bolt/context/respond/respond.html index e22a7e9f..5fb010d2 100644 --- a/docs/static/api-docs/slack_bolt/context/respond/respond.html +++ b/docs/static/api-docs/slack_bolt/context/respond/respond.html @@ -3,19 +3,30 @@ - + slack_bolt.context.respond.respond API documentation - + @@ -40,7 +51,6 @@

                                                                                Classes

                                                                                (*,
                                                                                response_url: str | None,
                                                                                proxy: str | None = None,
                                                                                ssl: ssl.SSLContext | None = None)
                                                                                -
                                                                                Expand source code @@ -104,19 +114,20 @@

                                                                                Classes

                                                                                else: raise ValueError("respond is unsupported here as there is no response_url")
                                                                                +

                                                                                Class variables

                                                                                var proxy : str | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var response_url : str | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var ssl : ssl.SSLContext | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -149,7 +160,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/save_thread_context/async_save_thread_context.html b/docs/static/api-docs/slack_bolt/context/save_thread_context/async_save_thread_context.html index fe62dda1..796970dd 100644 --- a/docs/static/api-docs/slack_bolt/context/save_thread_context/async_save_thread_context.html +++ b/docs/static/api-docs/slack_bolt/context/save_thread_context/async_save_thread_context.html @@ -3,19 +3,30 @@ - + slack_bolt.context.save_thread_context.async_save_thread_context API documentation - + @@ -40,7 +51,6 @@

                                                                                Classes

                                                                                (thread_context_store: AsyncAssistantThreadContextStore,
                                                                                channel_id: str,
                                                                                thread_ts: str)
                                                                                -
                                                                                Expand source code @@ -67,19 +77,20 @@

                                                                                Classes

                                                                                context=new_context, )
                                                                                +

                                                                                Class variables

                                                                                var channel_id : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_context_storeAsyncAssistantThreadContextStore
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -112,7 +123,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/save_thread_context/index.html b/docs/static/api-docs/slack_bolt/context/save_thread_context/index.html index 54807717..8b974a21 100644 --- a/docs/static/api-docs/slack_bolt/context/save_thread_context/index.html +++ b/docs/static/api-docs/slack_bolt/context/save_thread_context/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.save_thread_context API documentation - + @@ -51,7 +62,6 @@

                                                                                Classes

                                                                                (thread_context_store: AssistantThreadContextStore,
                                                                                channel_id: str,
                                                                                thread_ts: str)
                                                                                -
                                                                                Expand source code @@ -78,19 +88,20 @@

                                                                                Classes

                                                                                context=new_context, )
                                                                                +

                                                                                Class variables

                                                                                var channel_id : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_context_storeAssistantThreadContextStore
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -129,7 +140,7 @@

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/save_thread_context/save_thread_context.html b/docs/static/api-docs/slack_bolt/context/save_thread_context/save_thread_context.html index 25d589fb..17c14750 100644 --- a/docs/static/api-docs/slack_bolt/context/save_thread_context/save_thread_context.html +++ b/docs/static/api-docs/slack_bolt/context/save_thread_context/save_thread_context.html @@ -3,19 +3,30 @@ - + slack_bolt.context.save_thread_context.save_thread_context API documentation - + @@ -40,7 +51,6 @@

                                                                                Classes

                                                                                (thread_context_store: AssistantThreadContextStore,
                                                                                channel_id: str,
                                                                                thread_ts: str)
                                                                                -
                                                                                Expand source code @@ -67,19 +77,20 @@

                                                                                Classes

                                                                                context=new_context, )
                                                                                +

                                                                                Class variables

                                                                                var channel_id : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_context_storeAssistantThreadContextStore
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -112,7 +123,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/say/async_say.html b/docs/static/api-docs/slack_bolt/context/say/async_say.html index 4a05abb8..78d0b83a 100644 --- a/docs/static/api-docs/slack_bolt/context/say/async_say.html +++ b/docs/static/api-docs/slack_bolt/context/say/async_say.html @@ -3,19 +3,30 @@ - + slack_bolt.context.say.async_say API documentation - + @@ -40,7 +51,6 @@

                                                                                Classes

                                                                                (client: slack_sdk.web.async_client.AsyncWebClient | None,
                                                                                channel: str | None,
                                                                                thread_ts: str | None = None,
                                                                                build_metadata: Callable[[], Awaitable[Dict | slack_sdk.models.metadata.Metadata]] | None = None)
                                                                                -
                                                                                Expand source code @@ -122,23 +132,24 @@

                                                                                Classes

                                                                                else: raise ValueError("say without channel_id here is unsupported")
                                                                                +

                                                                                Class variables

                                                                                var build_metadata : Callable[[], Awaitable[Dict | slack_sdk.models.metadata.Metadata]] | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var channel : str | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var client : slack_sdk.web.async_client.AsyncWebClient | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -172,7 +183,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/say/index.html b/docs/static/api-docs/slack_bolt/context/say/index.html index 5225d3a0..5e2897f3 100644 --- a/docs/static/api-docs/slack_bolt/context/say/index.html +++ b/docs/static/api-docs/slack_bolt/context/say/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.say API documentation - + @@ -55,7 +66,6 @@

                                                                                Classes

                                                                                (client: slack_sdk.web.client.WebClient | None,
                                                                                channel: str | None,
                                                                                thread_ts: str | None = None,
                                                                                metadata: Dict | slack_sdk.models.metadata.Metadata | None = None,
                                                                                build_metadata: Callable[[], Dict | slack_sdk.models.metadata.Metadata | None] | None = None)
                                                                                -
                                                                                Expand source code @@ -141,27 +151,28 @@

                                                                                Classes

                                                                                else: raise ValueError("say without channel_id here is unsupported")
                                                                                +

                                                                                Class variables

                                                                                var build_metadata : Callable[[], Dict | slack_sdk.models.metadata.Metadata | None] | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var channel : str | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var client : slack_sdk.web.client.WebClient | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var metadata : Dict | slack_sdk.models.metadata.Metadata | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -203,7 +214,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/say/internals.html b/docs/static/api-docs/slack_bolt/context/say/internals.html index b807954f..ac349a4b 100644 --- a/docs/static/api-docs/slack_bolt/context/say/internals.html +++ b/docs/static/api-docs/slack_bolt/context/say/internals.html @@ -3,19 +3,30 @@ - + slack_bolt.context.say.internals API documentation - + @@ -49,7 +60,7 @@

                                                                                Module slack_bolt.context.say.internals

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/say/say.html b/docs/static/api-docs/slack_bolt/context/say/say.html index 26f00319..20ad41c0 100644 --- a/docs/static/api-docs/slack_bolt/context/say/say.html +++ b/docs/static/api-docs/slack_bolt/context/say/say.html @@ -3,19 +3,30 @@ - + slack_bolt.context.say.say API documentation - + @@ -40,7 +51,6 @@

                                                                                Classes

                                                                                (client: slack_sdk.web.client.WebClient | None,
                                                                                channel: str | None,
                                                                                thread_ts: str | None = None,
                                                                                metadata: Dict | slack_sdk.models.metadata.Metadata | None = None,
                                                                                build_metadata: Callable[[], Dict | slack_sdk.models.metadata.Metadata | None] | None = None)
                                                                                -
                                                                                Expand source code @@ -126,27 +136,28 @@

                                                                                Classes

                                                                                else: raise ValueError("say without channel_id here is unsupported")
                                                                                +

                                                                                Class variables

                                                                                var build_metadata : Callable[[], Dict | slack_sdk.models.metadata.Metadata | None] | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var channel : str | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var client : slack_sdk.web.client.WebClient | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var metadata : Dict | slack_sdk.models.metadata.Metadata | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str | None
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -181,7 +192,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/set_status/async_set_status.html b/docs/static/api-docs/slack_bolt/context/set_status/async_set_status.html index d78b37f3..d22fb3aa 100644 --- a/docs/static/api-docs/slack_bolt/context/set_status/async_set_status.html +++ b/docs/static/api-docs/slack_bolt/context/set_status/async_set_status.html @@ -3,19 +3,30 @@ - + slack_bolt.context.set_status.async_set_status API documentation - + @@ -40,7 +51,6 @@

                                                                                Classes

                                                                                (client: slack_sdk.web.async_client.AsyncWebClient,
                                                                                channel_id: str,
                                                                                thread_ts: str)
                                                                                -
                                                                                Expand source code @@ -67,19 +77,20 @@

                                                                                Classes

                                                                                thread_ts=self.thread_ts, )
                                                                                +

                                                                                Class variables

                                                                                var channel_id : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var client : slack_sdk.web.async_client.AsyncWebClient
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -112,7 +123,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/set_status/index.html b/docs/static/api-docs/slack_bolt/context/set_status/index.html index 81d1b924..5a2e8be4 100644 --- a/docs/static/api-docs/slack_bolt/context/set_status/index.html +++ b/docs/static/api-docs/slack_bolt/context/set_status/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.set_status API documentation - + @@ -51,7 +62,6 @@

                                                                                Classes

                                                                                (client: slack_sdk.web.client.WebClient, channel_id: str, thread_ts: str)
                                                                                -
                                                                                Expand source code @@ -78,19 +88,20 @@

                                                                                Classes

                                                                                thread_ts=self.thread_ts, )
                                                                                +

                                                                                Class variables

                                                                                var channel_id : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var client : slack_sdk.web.client.WebClient
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -129,7 +140,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/set_status/set_status.html b/docs/static/api-docs/slack_bolt/context/set_status/set_status.html index 98dc060f..337fbf57 100644 --- a/docs/static/api-docs/slack_bolt/context/set_status/set_status.html +++ b/docs/static/api-docs/slack_bolt/context/set_status/set_status.html @@ -3,19 +3,30 @@ - + slack_bolt.context.set_status.set_status API documentation - + @@ -40,7 +51,6 @@

                                                                                Classes

                                                                                (client: slack_sdk.web.client.WebClient, channel_id: str, thread_ts: str)
                                                                                -
                                                                                Expand source code @@ -67,19 +77,20 @@

                                                                                Classes

                                                                                thread_ts=self.thread_ts, )
                                                                                +

                                                                                Class variables

                                                                                var channel_id : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var client : slack_sdk.web.client.WebClient
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -112,7 +123,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/set_suggested_prompts/async_set_suggested_prompts.html b/docs/static/api-docs/slack_bolt/context/set_suggested_prompts/async_set_suggested_prompts.html index 1b8ae3c7..ee7458fb 100644 --- a/docs/static/api-docs/slack_bolt/context/set_suggested_prompts/async_set_suggested_prompts.html +++ b/docs/static/api-docs/slack_bolt/context/set_suggested_prompts/async_set_suggested_prompts.html @@ -3,19 +3,30 @@ - + slack_bolt.context.set_suggested_prompts.async_set_suggested_prompts API documentation - + @@ -40,7 +51,6 @@

                                                                                Classes

                                                                                (client: slack_sdk.web.async_client.AsyncWebClient,
                                                                                channel_id: str,
                                                                                thread_ts: str)
                                                                                -
                                                                                Expand source code @@ -79,19 +89,20 @@

                                                                                Classes

                                                                                title=title, )
                                                                                +

                                                                                Class variables

                                                                                var channel_id : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var client : slack_sdk.web.async_client.AsyncWebClient
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -124,7 +135,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/set_suggested_prompts/index.html b/docs/static/api-docs/slack_bolt/context/set_suggested_prompts/index.html index 612c3b74..f3084288 100644 --- a/docs/static/api-docs/slack_bolt/context/set_suggested_prompts/index.html +++ b/docs/static/api-docs/slack_bolt/context/set_suggested_prompts/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.set_suggested_prompts API documentation - + @@ -51,7 +62,6 @@

                                                                                Classes

                                                                                (client: slack_sdk.web.client.WebClient, channel_id: str, thread_ts: str)
                                                                                -
                                                                                Expand source code @@ -90,19 +100,20 @@

                                                                                Classes

                                                                                title=title, )
                                                                                +

                                                                                Class variables

                                                                                var channel_id : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var client : slack_sdk.web.client.WebClient
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -141,7 +152,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/set_suggested_prompts/set_suggested_prompts.html b/docs/static/api-docs/slack_bolt/context/set_suggested_prompts/set_suggested_prompts.html index b106c588..bdb31a3c 100644 --- a/docs/static/api-docs/slack_bolt/context/set_suggested_prompts/set_suggested_prompts.html +++ b/docs/static/api-docs/slack_bolt/context/set_suggested_prompts/set_suggested_prompts.html @@ -3,19 +3,30 @@ - + slack_bolt.context.set_suggested_prompts.set_suggested_prompts API documentation - + @@ -40,7 +51,6 @@

                                                                                Classes

                                                                                (client: slack_sdk.web.client.WebClient, channel_id: str, thread_ts: str)
                                                                                -
                                                                                Expand source code @@ -79,19 +89,20 @@

                                                                                Classes

                                                                                title=title, )
                                                                                +

                                                                                Class variables

                                                                                var channel_id : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var client : slack_sdk.web.client.WebClient
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -124,7 +135,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/set_title/async_set_title.html b/docs/static/api-docs/slack_bolt/context/set_title/async_set_title.html index 954edca4..9c195664 100644 --- a/docs/static/api-docs/slack_bolt/context/set_title/async_set_title.html +++ b/docs/static/api-docs/slack_bolt/context/set_title/async_set_title.html @@ -3,19 +3,30 @@ - + slack_bolt.context.set_title.async_set_title API documentation - + @@ -40,7 +51,6 @@

                                                                                Classes

                                                                                (client: slack_sdk.web.async_client.AsyncWebClient,
                                                                                channel_id: str,
                                                                                thread_ts: str)
                                                                                -
                                                                                Expand source code @@ -67,19 +77,20 @@

                                                                                Classes

                                                                                thread_ts=self.thread_ts, )
                                                                                +

                                                                                Class variables

                                                                                var channel_id : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var client : slack_sdk.web.async_client.AsyncWebClient
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -112,7 +123,7 @@

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/set_title/index.html b/docs/static/api-docs/slack_bolt/context/set_title/index.html index a27c7425..4c88c853 100644 --- a/docs/static/api-docs/slack_bolt/context/set_title/index.html +++ b/docs/static/api-docs/slack_bolt/context/set_title/index.html @@ -3,19 +3,30 @@ - + slack_bolt.context.set_title API documentation - + @@ -51,7 +62,6 @@

                                                                                Classes

                                                                                (client: slack_sdk.web.client.WebClient, channel_id: str, thread_ts: str)
                                                                                -
                                                                                Expand source code @@ -78,19 +88,20 @@

                                                                                Classes

                                                                                thread_ts=self.thread_ts, )
                                                                                +

                                                                                Class variables

                                                                                var channel_id : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var client : slack_sdk.web.client.WebClient
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -129,7 +140,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/context/set_title/set_title.html b/docs/static/api-docs/slack_bolt/context/set_title/set_title.html index c5f1e8e0..59a4498b 100644 --- a/docs/static/api-docs/slack_bolt/context/set_title/set_title.html +++ b/docs/static/api-docs/slack_bolt/context/set_title/set_title.html @@ -3,19 +3,30 @@ - + slack_bolt.context.set_title.set_title API documentation - + @@ -40,7 +51,6 @@

                                                                                Classes

                                                                                (client: slack_sdk.web.client.WebClient, channel_id: str, thread_ts: str)
                                                                                -
                                                                                Expand source code @@ -67,19 +77,20 @@

                                                                                Classes

                                                                                thread_ts=self.thread_ts, )
                                                                                +

                                                                                Class variables

                                                                                var channel_id : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var client : slack_sdk.web.client.WebClient
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                var thread_ts : str
                                                                                -
                                                                                +

                                                                                The type of the None singleton.

                                                                                @@ -112,7 +123,7 @@

                                                                                -

                                                                                Generated by pdoc 0.11.3.

                                                                                +

                                                                                Generated by pdoc 0.11.5.

                                                                                diff --git a/docs/static/api-docs/slack_bolt/error/index.html b/docs/static/api-docs/slack_bolt/error/index.html index 196b8c43..8e578eb6 100644 --- a/docs/static/api-docs/slack_bolt/error/index.html +++ b/docs/static/api-docs/slack_bolt/error/index.html @@ -3,19 +3,30 @@ - + slack_bolt.error API documentation - + @@ -41,7 +52,6 @@

                                                                                Classes

                                                                                (*args, **kwargs)
                                                                                -

                                                                                General class in a Bolt app

                                                                                Expand source code @@ -49,6 +59,7 @@

                                                                                Classes

                                                                                class BoltError(Exception):
                                                                                     """General class in a Bolt app"""
                                                                                +

                                                                                General class in a Bolt app

                                                                                Ancestors

                                                                                • builtins.Exception
                                                                                • @@ -64,7 +75,6 @@

                                                                                  Subclasses

                                                                                  (*,
                                                                                  request: ForwardRef('BoltRequest') | ForwardRef('AsyncBoltRequest'),
                                                                                  current_response: ForwardRef('BoltResponse') | None,
                                                                                  last_global_middleware_name: str | None = None)
                                                                                  -

                                                                                  General class in a Bolt app

                                                                                  Expand source code @@ -90,6 +100,7 @@

                                                                                  Subclasses

                                                                                  def __str__(self) -> str: return "unhandled request error"
                                                                                  +

                                                                                  General class in a Bolt app

                                                                                  Ancestors

                                                                                  • BoltError
                                                                                  • @@ -100,19 +111,19 @@

                                                                                    Class variables

                                                                                    var body : dict
                                                                                    -
                                                                                    +

                                                                                    The type of the None singleton.

                                                                                    var current_response : BoltResponse | None
                                                                                    -
                                                                                    +

                                                                                    The type of the None singleton.

                                                                                    var last_global_middleware_name : str | None
                                                                                    -
                                                                                    +

                                                                                    The type of the None singleton.

                                                                                    var request : BoltRequest
                                                                                    -
                                                                                    +

                                                                                    The type of the None singleton.

                                                                                  @@ -149,7 +160,7 @@

                                                                                  -

                                                                                  Generated by pdoc 0.11.3.

                                                                                  +

                                                                                  Generated by pdoc 0.11.5.

                                                                                  diff --git a/docs/static/api-docs/slack_bolt/index.html b/docs/static/api-docs/slack_bolt/index.html index 35b4600d..ced72594 100644 --- a/docs/static/api-docs/slack_bolt/index.html +++ b/docs/static/api-docs/slack_bolt/index.html @@ -3,19 +3,30 @@ - + slack_bolt API documentation - + @@ -125,7 +136,6 @@

                                                                                  Classes

                                                                                  class Ack
                                                                                  -
                                                                                  Expand source code @@ -167,11 +177,12 @@

                                                                                  Classes

                                                                                  view=view, )
                                                                                  +

                                                                                  Class variables

                                                                                  var responseBoltResponse | None
                                                                                  -
                                                                                  +

                                                                                  The type of the None singleton.

                                                                                  @@ -180,101 +191,6 @@

                                                                                  Class variables

                                                                                  (*,
                                                                                  logger: logging.Logger | None = None,
                                                                                  name: str | None = None,
                                                                                  process_before_response: bool = False,
                                                                                  raise_error_for_unhandled_request: bool = False,
                                                                                  signing_secret: str | None = None,
                                                                                  token: str | None = None,
                                                                                  token_verification_enabled: bool = True,
                                                                                  client: slack_sdk.web.client.WebClient | None = None,
                                                                                  before_authorize: Middleware | Callable[..., Any] | None = None,
                                                                                  authorize: Callable[..., AuthorizeResult] | None = None,
                                                                                  user_facing_authorize_error_message: str | None = None,
                                                                                  installation_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore | None = None,
                                                                                  installation_store_bot_only: bool | None = None,
                                                                                  request_verification_enabled: bool = True,
                                                                                  ignoring_self_events_enabled: bool = True,
                                                                                  ignoring_self_assistant_message_events_enabled: bool = True,
                                                                                  ssl_check_enabled: bool = True,
                                                                                  url_verification_enabled: bool = True,
                                                                                  attaching_function_token_enabled: bool = True,
                                                                                  oauth_settings: OAuthSettings | None = None,
                                                                                  oauth_flow: OAuthFlow | None = None,
                                                                                  verification_token: str | None = None,
                                                                                  listener_executor: concurrent.futures._base.Executor | None = None,
                                                                                  assistant_thread_context_store: AssistantThreadContextStore | None = None)
                                                                                  -

                                                                                  Bolt App that provides functionalities to register middleware/listeners.

                                                                                  -
                                                                                  import os
                                                                                  -from slack_bolt import App
                                                                                  -
                                                                                  -# Initializes your app with your bot token and signing secret
                                                                                  -app = App(
                                                                                  -    token=os.environ.get("SLACK_BOT_TOKEN"),
                                                                                  -    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
                                                                                  -)
                                                                                  -
                                                                                  -# Listens to incoming messages that contain "hello"
                                                                                  -@app.message("hello")
                                                                                  -def message_hello(message, say):
                                                                                  -    # say() sends a message to the channel where the event was triggered
                                                                                  -    say(f"Hey there <@{message['user']}>!")
                                                                                  -
                                                                                  -# Start your app
                                                                                  -if __name__ == "__main__":
                                                                                  -    app.start(port=int(os.environ.get("PORT", 3000)))
                                                                                  -
                                                                                  -

                                                                                  Refer to https://slack.dev/bolt-python/tutorial/getting-started for details.

                                                                                  -

                                                                                  If you would like to build an OAuth app for enabling the app to run with multiple workspaces, -refer to https://slack.dev/bolt-python/concepts#authenticating-oauth to learn how to configure the app.

                                                                                  -

                                                                                  Args

                                                                                  -
                                                                                  -
                                                                                  logger
                                                                                  -
                                                                                  The custom logger that can be used in this app.
                                                                                  -
                                                                                  name
                                                                                  -
                                                                                  The application name that will be used in logging. If absent, the source file name will be used.
                                                                                  -
                                                                                  process_before_response
                                                                                  -
                                                                                  True if this app runs on Function as a Service. (Default: False)
                                                                                  -
                                                                                  raise_error_for_unhandled_request
                                                                                  -
                                                                                  True if you want to raise exceptions for unhandled requests -and use @app.error listeners instead of -the built-in handler, which pints warning logs and returns 404 to Slack (Default: False)
                                                                                  -
                                                                                  signing_secret
                                                                                  -
                                                                                  The Signing Secret value used for verifying requests from Slack.
                                                                                  -
                                                                                  token
                                                                                  -
                                                                                  The bot/user access token required only for single-workspace app.
                                                                                  -
                                                                                  token_verification_enabled
                                                                                  -
                                                                                  Verifies the validity of the given token if True.
                                                                                  -
                                                                                  client
                                                                                  -
                                                                                  The singleton slack_sdk.WebClient instance for this app.
                                                                                  -
                                                                                  before_authorize
                                                                                  -
                                                                                  A global middleware that can be executed right before authorize function
                                                                                  -
                                                                                  authorize
                                                                                  -
                                                                                  The function to authorize an incoming request from Slack -by checking if there is a team/user in the installation data.
                                                                                  -
                                                                                  user_facing_authorize_error_message
                                                                                  -
                                                                                  The user-facing error message to display -when the app is installed but the installation is not managed by this app's installation store
                                                                                  -
                                                                                  installation_store
                                                                                  -
                                                                                  The module offering save/find operations of installation data
                                                                                  -
                                                                                  installation_store_bot_only
                                                                                  -
                                                                                  Use InstallationStore#find_bot() if True (Default: False)
                                                                                  -
                                                                                  request_verification_enabled
                                                                                  -
                                                                                  False if you would like to disable the built-in middleware (Default: True). -RequestVerification is a built-in middleware that verifies the signature in HTTP Mode requests. -Make sure if it's safe enough when you turn a built-in middleware off. -We strongly recommend using RequestVerification for better security. -If you have a proxy that verifies request signature in front of the Bolt app, -it's totally fine to disable RequestVerification to avoid duplication of work. -Don't turn it off just for easiness of development.
                                                                                  -
                                                                                  ignoring_self_events_enabled
                                                                                  -
                                                                                  False if you would like to disable the built-in middleware (Default: True). -IgnoringSelfEvents is a built-in middleware that enables Bolt apps to easily skip the events -generated by this app's bot user (this is useful for avoiding code error causing an infinite loop).
                                                                                  -
                                                                                  ignoring_self_assistant_message_events_enabled
                                                                                  -
                                                                                  False if you would like to disable the built-in middleware. -IgnoringSelfEvents for this app's bot user message events within an assistant thread -This is useful for avoiding code error causing an infinite loop; Default: True
                                                                                  -
                                                                                  url_verification_enabled
                                                                                  -
                                                                                  False if you would like to disable the built-in middleware (Default: True). -UrlVerification is a built-in middleware that handles url_verification requests -that verify the endpoint for Events API in HTTP Mode requests.
                                                                                  -
                                                                                  attaching_function_token_enabled
                                                                                  -
                                                                                  False if you would like to disable the built-in middleware (Default: True). -AttachingFunctionToken is a built-in middleware that injects the just-in-time workflow-execution tokens -when your app receives function_executed or interactivity events scoped to a custom step.
                                                                                  -
                                                                                  ssl_check_enabled
                                                                                  -
                                                                                  bool = False if you would like to disable the built-in middleware (Default: True). -SslCheck is a built-in middleware that handles ssl_check requests from Slack.
                                                                                  -
                                                                                  oauth_settings
                                                                                  -
                                                                                  The settings related to Slack app installation flow (OAuth flow)
                                                                                  -
                                                                                  oauth_flow
                                                                                  -
                                                                                  Instantiated OAuthFlow. This is always prioritized over oauth_settings.
                                                                                  -
                                                                                  verification_token
                                                                                  -
                                                                                  Deprecated verification mechanism. This can be used only for ssl_check requests.
                                                                                  -
                                                                                  listener_executor
                                                                                  -
                                                                                  Custom executor to run background tasks. If absent, the default ThreadPoolExecutor will -be used.
                                                                                  -
                                                                                  assistant_thread_context_store
                                                                                  -
                                                                                  Custom AssistantThreadContext store (Default: the built-in implementation, -which uses a parent message's metadata to store the latest context)
                                                                                  -
                                                                                  Expand source code @@ -1639,11 +1555,105 @@

                                                                                  Args

                                                                                  ) return value_to_return
                                                                                  +

                                                                                  Bolt App that provides functionalities to register middleware/listeners.

                                                                                  +
                                                                                  import os
                                                                                  +from slack_bolt import App
                                                                                  +
                                                                                  +# Initializes your app with your bot token and signing secret
                                                                                  +app = App(
                                                                                  +    token=os.environ.get("SLACK_BOT_TOKEN"),
                                                                                  +    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
                                                                                  +)
                                                                                  +
                                                                                  +# Listens to incoming messages that contain "hello"
                                                                                  +@app.message("hello")
                                                                                  +def message_hello(message, say):
                                                                                  +    # say() sends a message to the channel where the event was triggered
                                                                                  +    say(f"Hey there <@{message['user']}>!")
                                                                                  +
                                                                                  +# Start your app
                                                                                  +if __name__ == "__main__":
                                                                                  +    app.start(port=int(os.environ.get("PORT", 3000)))
                                                                                  +
                                                                                  +

                                                                                  Refer to https://slack.dev/bolt-python/tutorial/getting-started for details.

                                                                                  +

                                                                                  If you would like to build an OAuth app for enabling the app to run with multiple workspaces, +refer to https://slack.dev/bolt-python/concepts#authenticating-oauth to learn how to configure the app.

                                                                                  +

                                                                                  Args

                                                                                  +
                                                                                  +
                                                                                  logger
                                                                                  +
                                                                                  The custom logger that can be used in this app.
                                                                                  +
                                                                                  name
                                                                                  +
                                                                                  The application name that will be used in logging. If absent, the source file name will be used.
                                                                                  +
                                                                                  process_before_response
                                                                                  +
                                                                                  True if this app runs on Function as a Service. (Default: False)
                                                                                  +
                                                                                  raise_error_for_unhandled_request
                                                                                  +
                                                                                  True if you want to raise exceptions for unhandled requests +and use @app.error listeners instead of +the built-in handler, which pints warning logs and returns 404 to Slack (Default: False)
                                                                                  +
                                                                                  signing_secret
                                                                                  +
                                                                                  The Signing Secret value used for verifying requests from Slack.
                                                                                  +
                                                                                  token
                                                                                  +
                                                                                  The bot/user access token required only for single-workspace app.
                                                                                  +
                                                                                  token_verification_enabled
                                                                                  +
                                                                                  Verifies the validity of the given token if True.
                                                                                  +
                                                                                  client
                                                                                  +
                                                                                  The singleton slack_sdk.WebClient instance for this app.
                                                                                  +
                                                                                  before_authorize
                                                                                  +
                                                                                  A global middleware that can be executed right before authorize function
                                                                                  +
                                                                                  authorize
                                                                                  +
                                                                                  The function to authorize an incoming request from Slack +by checking if there is a team/user in the installation data.
                                                                                  +
                                                                                  user_facing_authorize_error_message
                                                                                  +
                                                                                  The user-facing error message to display +when the app is installed but the installation is not managed by this app's installation store
                                                                                  +
                                                                                  installation_store
                                                                                  +
                                                                                  The module offering save/find operations of installation data
                                                                                  +
                                                                                  installation_store_bot_only
                                                                                  +
                                                                                  Use InstallationStore#find_bot() if True (Default: False)
                                                                                  +
                                                                                  request_verification_enabled
                                                                                  +
                                                                                  False if you would like to disable the built-in middleware (Default: True). +RequestVerification is a built-in middleware that verifies the signature in HTTP Mode requests. +Make sure if it's safe enough when you turn a built-in middleware off. +We strongly recommend using RequestVerification for better security. +If you have a proxy that verifies request signature in front of the Bolt app, +it's totally fine to disable RequestVerification to avoid duplication of work. +Don't turn it off just for easiness of development.
                                                                                  +
                                                                                  ignoring_self_events_enabled
                                                                                  +
                                                                                  False if you would like to disable the built-in middleware (Default: True). +IgnoringSelfEvents is a built-in middleware that enables Bolt apps to easily skip the events +generated by this app's bot user (this is useful for avoiding code error causing an infinite loop).
                                                                                  +
                                                                                  ignoring_self_assistant_message_events_enabled
                                                                                  +
                                                                                  False if you would like to disable the built-in middleware. +IgnoringSelfEvents for this app's bot user message events within an assistant thread +This is useful for avoiding code error causing an infinite loop; Default: True
                                                                                  +
                                                                                  url_verification_enabled
                                                                                  +
                                                                                  False if you would like to disable the built-in middleware (Default: True). +UrlVerification is a built-in middleware that handles url_verification requests +that verify the endpoint for Events API in HTTP Mode requests.
                                                                                  +
                                                                                  attaching_function_token_enabled
                                                                                  +
                                                                                  False if you would like to disable the built-in middleware (Default: True). +AttachingFunctionToken is a built-in middleware that injects the just-in-time workflow-execution tokens +when your app receives function_executed or interactivity events scoped to a custom step.
                                                                                  +
                                                                                  ssl_check_enabled
                                                                                  +
                                                                                  bool = False if you would like to disable the built-in middleware (Default: True). +SslCheck is a built-in middleware that handles ssl_check requests from Slack.
                                                                                  +
                                                                                  oauth_settings
                                                                                  +
                                                                                  The settings related to Slack app installation flow (OAuth flow)
                                                                                  +
                                                                                  oauth_flow
                                                                                  +
                                                                                  Instantiated OAuthFlow. This is always prioritized over oauth_settings.
                                                                                  +
                                                                                  verification_token
                                                                                  +
                                                                                  Deprecated verification mechanism. This can be used only for ssl_check requests.
                                                                                  +
                                                                                  listener_executor
                                                                                  +
                                                                                  Custom executor to run background tasks. If absent, the default ThreadPoolExecutor will +be used.
                                                                                  +
                                                                                  assistant_thread_context_store
                                                                                  +
                                                                                  Custom AssistantThreadContext store (Default: the built-in implementation, +which uses a parent message's metadata to store the latest context)
                                                                                  +

                                                                                  Instance variables

                                                                                  prop client : slack_sdk.web.client.WebClient
                                                                                  -

                                                                                  The singleton slack_sdk.WebClient instance in this app.

                                                                                  Expand source code @@ -1653,10 +1663,10 @@

                                                                                  Instance variables

                                                                                  """The singleton `slack_sdk.WebClient` instance in this app.""" return self._client
                                                                                  +

                                                                                  The singleton slack_sdk.WebClient instance in this app.

                                                                                  prop installation_store : slack_sdk.oauth.installation_store.installation_store.InstallationStore | None
                                                                                  -

                                                                                  The slack_sdk.oauth.InstallationStore that can be used in the authorize middleware.

                                                                                  Expand source code @@ -1666,10 +1676,10 @@

                                                                                  Instance variables

                                                                                  """The `slack_sdk.oauth.InstallationStore` that can be used in the `authorize` middleware.""" return self._installation_store
                                                                                  +

                                                                                  The slack_sdk.oauth.InstallationStore that can be used in the authorize middleware.

                                                                                  prop listener_runnerThreadListenerRunner
                                                                                  -

                                                                                  The thread executor for asynchronously running listeners.

                                                                                  Expand source code @@ -1679,10 +1689,10 @@

                                                                                  Instance variables

                                                                                  """The thread executor for asynchronously running listeners.""" return self._listener_runner
                                                                                  +

                                                                                  The thread executor for asynchronously running listeners.

                                                                                  prop logger : logging.Logger
                                                                                  -

                                                                                  The logger this app uses.

                                                                                  Expand source code @@ -1692,10 +1702,10 @@

                                                                                  Instance variables

                                                                                  """The logger this app uses.""" return self._framework_logger
                                                                                  +

                                                                                  The logger this app uses.

                                                                                  prop name : str
                                                                                  -

                                                                                  The name of this app (default: the filename)

                                                                                  Expand source code @@ -1705,10 +1715,10 @@

                                                                                  Instance variables

                                                                                  """The name of this app (default: the filename)""" return self._name
                                                                                  +

                                                                                  The name of this app (default: the filename)

                                                                                  prop oauth_flowOAuthFlow | None
                                                                                  -

                                                                                  Configured OAuthFlow object if exists.

                                                                                  Expand source code @@ -1718,10 +1728,10 @@

                                                                                  Instance variables

                                                                                  """Configured `OAuthFlow` object if exists.""" return self._oauth_flow
                                                                                  +

                                                                                  Configured OAuthFlow object if exists.

                                                                                  prop process_before_response : bool
                                                                                  -
                                                                                  Expand source code @@ -1730,6 +1740,7 @@

                                                                                  Instance variables

                                                                                  def process_before_response(self) -> bool: return self._process_before_response or False
                                                                                  +

                                                                                  Methods

                                                                                  @@ -1738,6 +1749,47 @@

                                                                                  Methods

                                                                                  def action(self,
                                                                                  constraints: str | Pattern | Dict[str, str | Pattern],
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def action(
                                                                                  +    self,
                                                                                  +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new action listener. This method can be used as either a decorator or a method.
                                                                                  +
                                                                                  +        # Use this method as a decorator
                                                                                  +        @app.action("approve_button")
                                                                                  +        def update_message(ack):
                                                                                  +            ack()
                                                                                  +
                                                                                  +        # Pass a function to this method
                                                                                  +        app.action("approve_button")(update_message)
                                                                                  +
                                                                                  +    * Refer to https://api.slack.com/reference/interaction-payloads/block-actions for actions in `blocks`.
                                                                                  +    * Refer to https://api.slack.com/legacy/message-buttons for actions in `attachments`.
                                                                                  +    * Refer to https://api.slack.com/dialogs for actions in dialogs.
                                                                                  +
                                                                                  +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        constraints: The conditions that match a request payload
                                                                                  +        matchers: A list of listener matcher functions.
                                                                                  +            Only when all the matchers return True, the listener function can be invoked.
                                                                                  +        middleware: A list of lister middleware functions.
                                                                                  +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                                                  +    """
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.action(constraints, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new action listener. This method can be used as either a decorator or a method.

                                                                                  # Use this method as a decorator
                                                                                   @app.action("approve_button")
                                                                                  @@ -1769,12 +1821,39 @@ 

                                                                                  Args

                                                                                  def assistant(self,
                                                                                  assistant: Assistant) ‑> Callable | None
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def assistant(self, assistant: Assistant) -> Optional[Callable]:
                                                                                  +    return self.middleware(assistant)
                                                                                  +
                                                                                  def attachment_action(self,
                                                                                  callback_id: str | Pattern,
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def attachment_action(
                                                                                  +    self,
                                                                                  +    callback_id: Union[str, Pattern],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new `interactive_message` action listener.
                                                                                  +    Refer to https://api.slack.com/legacy/message-buttons for details."""
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.attachment_action(callback_id, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new interactive_message action listener. Refer to https://api.slack.com/legacy/message-buttons for details.

                                                                                  @@ -1782,6 +1861,27 @@

                                                                                  Args

                                                                                  def block_action(self,
                                                                                  constraints: str | Pattern | Dict[str, str | Pattern],
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def block_action(
                                                                                  +    self,
                                                                                  +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new `block_actions` action listener.
                                                                                  +    Refer to https://api.slack.com/reference/interaction-payloads/block-actions for details.
                                                                                  +    """
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.block_action(constraints, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new block_actions action listener. Refer to https://api.slack.com/reference/interaction-payloads/block-actions for details.

                                                                                  @@ -1789,12 +1889,73 @@

                                                                                  Args

                                                                                  def block_suggestion(self,
                                                                                  action_id: str | Pattern,
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def block_suggestion(
                                                                                  +    self,
                                                                                  +    action_id: Union[str, Pattern],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new `block_suggestion` listener."""
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.block_suggestion(action_id, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new block_suggestion listener.

                                                                                  def command(self,
                                                                                  command: str | Pattern,
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def command(
                                                                                  +    self,
                                                                                  +    command: Union[str, Pattern],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new slash command listener.
                                                                                  +    This method can be used as either a decorator or a method.
                                                                                  +
                                                                                  +        # Use this method as a decorator
                                                                                  +        @app.command("/echo")
                                                                                  +        def repeat_text(ack, say, command):
                                                                                  +            # Acknowledge command request
                                                                                  +            ack()
                                                                                  +            say(f"{command['text']}")
                                                                                  +
                                                                                  +        # Pass a function to this method
                                                                                  +        app.command("/echo")(repeat_text)
                                                                                  +
                                                                                  +    Refer to https://api.slack.com/interactivity/slash-commands for details of Slash Commands.
                                                                                  +
                                                                                  +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        command: The conditions that match a request payload
                                                                                  +        matchers: A list of listener matcher functions.
                                                                                  +            Only when all the matchers return True, the listener function can be invoked.
                                                                                  +        middleware: A list of lister middleware functions.
                                                                                  +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                                                  +    """
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.command(command, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new slash command listener. This method can be used as either a decorator or a method.

                                                                                  # Use this method as a decorator
                                                                                  @@ -1825,18 +1986,60 @@ 

                                                                                  Args

                                                                                  def default_app_uninstalled_event_listener(self) ‑> Callable[..., BoltResponse | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def default_app_uninstalled_event_listener(
                                                                                  +    self,
                                                                                  +) -> Callable[..., Optional[BoltResponse]]:
                                                                                  +    if self._tokens_revocation_listeners is None:
                                                                                  +        raise BoltError(error_installation_store_required_for_builtin_listeners())
                                                                                  +    return self._tokens_revocation_listeners.handle_app_uninstalled_events
                                                                                  +
                                                                                  def default_tokens_revoked_event_listener(self) ‑> Callable[..., BoltResponse | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def default_tokens_revoked_event_listener(
                                                                                  +    self,
                                                                                  +) -> Callable[..., Optional[BoltResponse]]:
                                                                                  +    if self._tokens_revocation_listeners is None:
                                                                                  +        raise BoltError(error_installation_store_required_for_builtin_listeners())
                                                                                  +    return self._tokens_revocation_listeners.handle_tokens_revoked_events
                                                                                  +
                                                                                  def dialog_cancellation(self,
                                                                                  callback_id: str | Pattern,
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def dialog_cancellation(
                                                                                  +    self,
                                                                                  +    callback_id: Union[str, Pattern],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new `dialog_cancellation` listener.
                                                                                  +    Refer to https://api.slack.com/dialogs for details."""
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.dialog_cancellation(callback_id, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new dialog_cancellation listener. Refer to https://api.slack.com/dialogs for details.

                                                                                  @@ -1844,6 +2047,26 @@

                                                                                  Args

                                                                                  def dialog_submission(self,
                                                                                  callback_id: str | Pattern,
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def dialog_submission(
                                                                                  +    self,
                                                                                  +    callback_id: Union[str, Pattern],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new `dialog_submission` listener.
                                                                                  +    Refer to https://api.slack.com/dialogs for details."""
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.dialog_submission(callback_id, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new dialog_submission listener. Refer to https://api.slack.com/dialogs for details.

                                                                                  @@ -1851,6 +2074,26 @@

                                                                                  Args

                                                                                  def dialog_suggestion(self,
                                                                                  callback_id: str | Pattern,
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def dialog_suggestion(
                                                                                  +    self,
                                                                                  +    callback_id: Union[str, Pattern],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new `dialog_suggestion` listener.
                                                                                  +    Refer to https://api.slack.com/dialogs for details."""
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.dialog_suggestion(callback_id, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new dialog_suggestion listener. Refer to https://api.slack.com/dialogs for details.

                                                                                  @@ -1858,6 +2101,118 @@

                                                                                  Args

                                                                                  def dispatch(self,
                                                                                  req: BoltRequest) ‑> BoltResponse
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def dispatch(self, req: BoltRequest) -> BoltResponse:
                                                                                  +    """Applies all middleware and dispatches an incoming request from Slack to the right code path.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        req: An incoming request from Slack
                                                                                  +
                                                                                  +    Returns:
                                                                                  +        The response generated by this Bolt app
                                                                                  +    """
                                                                                  +    starting_time = time.time()
                                                                                  +    self._init_context(req)
                                                                                  +
                                                                                  +    resp: Optional[BoltResponse] = BoltResponse(status=200, body="")
                                                                                  +    middleware_state = {"next_called": False}
                                                                                  +
                                                                                  +    def middleware_next():
                                                                                  +        middleware_state["next_called"] = True
                                                                                  +
                                                                                  +    try:
                                                                                  +        for middleware in self._middleware_list:
                                                                                  +            middleware_state["next_called"] = False
                                                                                  +            if self._framework_logger.level <= logging.DEBUG:
                                                                                  +                self._framework_logger.debug(debug_applying_middleware(middleware.name))
                                                                                  +            resp = middleware.process(req=req, resp=resp, next=middleware_next)  # type: ignore[arg-type]
                                                                                  +            if not middleware_state["next_called"]:
                                                                                  +                if resp is None:
                                                                                  +                    # next() method was not called without providing the response to return to Slack
                                                                                  +                    # This should not be an intentional handling in usual use cases.
                                                                                  +                    resp = BoltResponse(status=404, body={"error": "no next() calls in middleware"})
                                                                                  +                    if self._raise_error_for_unhandled_request is True:
                                                                                  +                        try:
                                                                                  +                            raise BoltUnhandledRequestError(
                                                                                  +                                request=req,
                                                                                  +                                current_response=resp,
                                                                                  +                                last_global_middleware_name=middleware.name,
                                                                                  +                            )
                                                                                  +                        except BoltUnhandledRequestError as e:
                                                                                  +                            self._listener_runner.listener_error_handler.handle(
                                                                                  +                                error=e,
                                                                                  +                                request=req,
                                                                                  +                                response=resp,
                                                                                  +                            )
                                                                                  +                        return resp
                                                                                  +                    self._framework_logger.warning(warning_unhandled_by_global_middleware(middleware.name, req))
                                                                                  +                    return resp
                                                                                  +                return resp
                                                                                  +
                                                                                  +        for listener in self._listeners:
                                                                                  +            listener_name = get_name_for_callable(listener.ack_function)
                                                                                  +            self._framework_logger.debug(debug_checking_listener(listener_name))
                                                                                  +            if listener.matches(req=req, resp=resp):  # type: ignore[arg-type]
                                                                                  +                # run all the middleware attached to this listener first
                                                                                  +                middleware_resp, next_was_not_called = listener.run_middleware(
                                                                                  +                    req=req, resp=resp  # type: ignore[arg-type]
                                                                                  +                )
                                                                                  +                if next_was_not_called:
                                                                                  +                    if middleware_resp is not None:
                                                                                  +                        if self._framework_logger.level <= logging.DEBUG:
                                                                                  +                            debug_message = debug_return_listener_middleware_response(
                                                                                  +                                listener_name,
                                                                                  +                                middleware_resp.status,
                                                                                  +                                middleware_resp.body,
                                                                                  +                                starting_time,
                                                                                  +                            )
                                                                                  +                            self._framework_logger.debug(debug_message)
                                                                                  +                        return middleware_resp
                                                                                  +                    # The last listener middleware didn't call next() method.
                                                                                  +                    # This means the listener is not for this incoming request.
                                                                                  +                    continue
                                                                                  +
                                                                                  +                if middleware_resp is not None:
                                                                                  +                    resp = middleware_resp
                                                                                  +
                                                                                  +                self._framework_logger.debug(debug_running_listener(listener_name))
                                                                                  +                listener_response: Optional[BoltResponse] = self._listener_runner.run(
                                                                                  +                    request=req,
                                                                                  +                    response=resp,  # type: ignore[arg-type]
                                                                                  +                    listener_name=listener_name,
                                                                                  +                    listener=listener,
                                                                                  +                )
                                                                                  +                if listener_response is not None:
                                                                                  +                    return listener_response
                                                                                  +
                                                                                  +        if resp is None:
                                                                                  +            resp = BoltResponse(status=404, body={"error": "unhandled request"})
                                                                                  +        if self._raise_error_for_unhandled_request is True:
                                                                                  +            try:
                                                                                  +                raise BoltUnhandledRequestError(
                                                                                  +                    request=req,
                                                                                  +                    current_response=resp,
                                                                                  +                )
                                                                                  +            except BoltUnhandledRequestError as e:
                                                                                  +                self._listener_runner.listener_error_handler.handle(
                                                                                  +                    error=e,
                                                                                  +                    request=req,
                                                                                  +                    response=resp,
                                                                                  +                )
                                                                                  +            return resp
                                                                                  +        return self._handle_unmatched_requests(req, resp)
                                                                                  +    except Exception as error:
                                                                                  +        resp = BoltResponse(status=500, body="")
                                                                                  +        self._middleware_error_handler.handle(
                                                                                  +            error=error,
                                                                                  +            request=req,
                                                                                  +            response=resp,
                                                                                  +        )
                                                                                  +        return resp
                                                                                  +

                                                                                  Applies all middleware and dispatches an incoming request from Slack to the right code path.

                                                                                  Args

                                                                                  @@ -1871,12 +2226,52 @@

                                                                                  Returns

                                                                                  def enable_token_revocation_listeners(self) ‑> None
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def enable_token_revocation_listeners(self) -> None:
                                                                                  +    self.event("tokens_revoked")(self.default_tokens_revoked_event_listener())
                                                                                  +    self.event("app_uninstalled")(self.default_app_uninstalled_event_listener())
                                                                                  +
                                                                                  def error(self,
                                                                                  func: Callable[..., BoltResponse | None]) ‑> Callable[..., BoltResponse | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def error(self, func: Callable[..., Optional[BoltResponse]]) -> Callable[..., Optional[BoltResponse]]:
                                                                                  +    """Updates the global error handler. This method can be used as either a decorator or a method.
                                                                                  +
                                                                                  +        # Use this method as a decorator
                                                                                  +        @app.error
                                                                                  +        def custom_error_handler(error, body, logger):
                                                                                  +            logger.exception(f"Error: {error}")
                                                                                  +            logger.info(f"Request body: {body}")
                                                                                  +
                                                                                  +        # Pass a function to this method
                                                                                  +        app.error(custom_error_handler)
                                                                                  +
                                                                                  +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        func: The function that is supposed to be executed
                                                                                  +            when getting an unhandled error in Bolt app.
                                                                                  +    """
                                                                                  +    self._listener_runner.listener_error_handler = CustomListenerErrorHandler(
                                                                                  +        logger=self._framework_logger,
                                                                                  +        func=func,
                                                                                  +    )
                                                                                  +    self._middleware_error_handler = CustomMiddlewareErrorHandler(
                                                                                  +        logger=self._framework_logger,
                                                                                  +        func=func,
                                                                                  +    )
                                                                                  +    return func
                                                                                  +

                                                                                  Updates the global error handler. This method can be used as either a decorator or a method.

                                                                                  # Use this method as a decorator
                                                                                   @app.error
                                                                                  @@ -1899,6 +2294,53 @@ 

                                                                                  Args

                                                                                  def event(self,
                                                                                  event: str | Pattern | Dict[str, str | Sequence[str | Pattern | None] | None],
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def event(
                                                                                  +    self,
                                                                                  +    event: Union[
                                                                                  +        str,
                                                                                  +        Pattern,
                                                                                  +        Dict[str, Optional[Union[str, Sequence[Optional[Union[str, Pattern]]]]]],
                                                                                  +    ],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new event listener. This method can be used as either a decorator or a method.
                                                                                  +
                                                                                  +        # Use this method as a decorator
                                                                                  +        @app.event("team_join")
                                                                                  +        def ask_for_introduction(event, say):
                                                                                  +            welcome_channel_id = "C12345"
                                                                                  +            user_id = event["user"]
                                                                                  +            text = f"Welcome to the team, <@{user_id}>! :tada: You can introduce yourself in this channel."
                                                                                  +            say(text=text, channel=welcome_channel_id)
                                                                                  +
                                                                                  +        # Pass a function to this method
                                                                                  +        app.event("team_join")(ask_for_introduction)
                                                                                  +
                                                                                  +    Refer to https://api.slack.com/apis/connections/events-api for details of Events API.
                                                                                  +
                                                                                  +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        event: The conditions that match a request payload.
                                                                                  +            If you pass a dict for this, you can have type, subtype in the constraint.
                                                                                  +        matchers: A list of listener matcher functions.
                                                                                  +            Only when all the matchers return True, the listener function can be invoked.
                                                                                  +        middleware: A list of lister middleware functions.
                                                                                  +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                                                  +    """
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.event(event, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new event listener. This method can be used as either a decorator or a method.

                                                                                  # Use this method as a decorator
                                                                                   @app.event("team_join")
                                                                                  @@ -1930,6 +2372,54 @@ 

                                                                                  Args

                                                                                  def function(self,
                                                                                  callback_id: str | Pattern,
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None,
                                                                                  auto_acknowledge: bool = True) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def function(
                                                                                  +    self,
                                                                                  +    callback_id: Union[str, Pattern],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +    auto_acknowledge: bool = True,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new Function listener.
                                                                                  +    This method can be used as either a decorator or a method.
                                                                                  +
                                                                                  +        # Use this method as a decorator
                                                                                  +        @app.function("reverse")
                                                                                  +        def reverse_string(ack: Ack, inputs: dict, complete: Complete, fail: Fail):
                                                                                  +            try:
                                                                                  +                ack()
                                                                                  +                string_to_reverse = inputs["stringToReverse"]
                                                                                  +                complete(outputs={"reverseString": string_to_reverse[::-1]})
                                                                                  +            except Exception as e:
                                                                                  +                fail(f"Cannot reverse string (error: {e})")
                                                                                  +                raise e
                                                                                  +
                                                                                  +        # Pass a function to this method
                                                                                  +        app.function("reverse")(reverse_string)
                                                                                  +
                                                                                  +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        callback_id: The callback id to identify the function
                                                                                  +        matchers: A list of listener matcher functions.
                                                                                  +            Only when all the matchers return True, the listener function can be invoked.
                                                                                  +        middleware: A list of lister middleware functions.
                                                                                  +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                                                  +    """
                                                                                  +
                                                                                  +    matchers = list(matchers) if matchers else []
                                                                                  +    middleware = list(middleware) if middleware else []
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.function_executed(callback_id=callback_id, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(functions, primary_matcher, matchers, middleware, auto_acknowledge)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new Function listener. This method can be used as either a decorator or a method.

                                                                                  # Use this method as a decorator
                                                                                  @@ -1963,12 +2453,93 @@ 

                                                                                  Args

                                                                                  def global_shortcut(self,
                                                                                  callback_id: str | Pattern,
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def global_shortcut(
                                                                                  +    self,
                                                                                  +    callback_id: Union[str, Pattern],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new global shortcut listener."""
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.global_shortcut(callback_id, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new global shortcut listener.

                                                                                  def message(self,
                                                                                  keyword: str | Pattern = '',
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def message(
                                                                                  +    self,
                                                                                  +    keyword: Union[str, Pattern] = "",
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new message event listener. This method can be used as either a decorator or a method.
                                                                                  +    Check the `App#event` method's docstring for details.
                                                                                  +
                                                                                  +        # Use this method as a decorator
                                                                                  +        @app.message(":wave:")
                                                                                  +        def say_hello(message, say):
                                                                                  +            user = message['user']
                                                                                  +            say(f"Hi there, <@{user}>!")
                                                                                  +
                                                                                  +        # Pass a function to this method
                                                                                  +        app.message(":wave:")(say_hello)
                                                                                  +
                                                                                  +    Refer to https://api.slack.com/events/message for details of `message` events.
                                                                                  +
                                                                                  +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        keyword: The keyword to match
                                                                                  +        matchers: A list of listener matcher functions.
                                                                                  +            Only when all the matchers return True, the listener function can be invoked.
                                                                                  +        middleware: A list of lister middleware functions.
                                                                                  +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                                                  +    """
                                                                                  +    matchers = list(matchers) if matchers else []
                                                                                  +    middleware = list(middleware) if middleware else []
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        constraints = {
                                                                                  +            "type": "message",
                                                                                  +            "subtype": (
                                                                                  +                # In most cases, new message events come with no subtype.
                                                                                  +                None,
                                                                                  +                # As of Jan 2021, most bot messages no longer have the subtype bot_message.
                                                                                  +                # By contrast, messages posted using classic app's bot token still have the subtype.
                                                                                  +                "bot_message",
                                                                                  +                # If an end-user posts a message with "Also send to #channel" checked,
                                                                                  +                # the message event comes with this subtype.
                                                                                  +                "thread_broadcast",
                                                                                  +                # If an end-user posts a message with attached files,
                                                                                  +                # the message event comes with this subtype.
                                                                                  +                "file_share",
                                                                                  +            ),
                                                                                  +        }
                                                                                  +        primary_matcher = builtin_matchers.message_event(
                                                                                  +            keyword=keyword, constraints=constraints, base_logger=self._base_logger
                                                                                  +        )
                                                                                  +        middleware.insert(0, MessageListenerMatches(keyword))
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new message event listener. This method can be used as either a decorator or a method. Check the App#event method's docstring for details.

                                                                                  # Use this method as a decorator
                                                                                  @@ -1998,12 +2569,75 @@ 

                                                                                  Args

                                                                                  def message_shortcut(self,
                                                                                  callback_id: str | Pattern,
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def message_shortcut(
                                                                                  +    self,
                                                                                  +    callback_id: Union[str, Pattern],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new message shortcut listener."""
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.message_shortcut(callback_id, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new message shortcut listener.

                                                                                  def middleware(self, *args) ‑> Callable | None
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def middleware(self, *args) -> Optional[Callable]:
                                                                                  +    """Registers a new middleware to this app.
                                                                                  +    This method can be used as either a decorator or a method.
                                                                                  +
                                                                                  +        # Use this method as a decorator
                                                                                  +        @app.middleware
                                                                                  +        def middleware_func(logger, body, next):
                                                                                  +            logger.info(f"request body: {body}")
                                                                                  +            next()
                                                                                  +
                                                                                  +        # Pass a function to this method
                                                                                  +        app.middleware(middleware_func)
                                                                                  +
                                                                                  +    Refer to https://slack.dev/bolt-python/concepts#global-middleware for details.
                                                                                  +
                                                                                  +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        *args: A function that works as a global middleware.
                                                                                  +    """
                                                                                  +    if len(args) > 0:
                                                                                  +        middleware_or_callable = args[0]
                                                                                  +        if isinstance(middleware_or_callable, Middleware):
                                                                                  +            middleware: Middleware = middleware_or_callable
                                                                                  +            self._middleware_list.append(middleware)
                                                                                  +            if isinstance(middleware, Assistant) and middleware.thread_context_store is not None:
                                                                                  +                self._assistant_thread_context_store = middleware.thread_context_store
                                                                                  +        elif callable(middleware_or_callable):
                                                                                  +            self._middleware_list.append(
                                                                                  +                CustomMiddleware(
                                                                                  +                    app_name=self.name,
                                                                                  +                    func=middleware_or_callable,
                                                                                  +                    base_logger=self._base_logger,
                                                                                  +                )
                                                                                  +            )
                                                                                  +            return middleware_or_callable
                                                                                  +        else:
                                                                                  +            raise BoltError(f"Unexpected type for a middleware ({type(middleware_or_callable)})")
                                                                                  +    return None
                                                                                  +

                                                                                  Registers a new middleware to this app. This method can be used as either a decorator or a method.

                                                                                  # Use this method as a decorator
                                                                                  @@ -2027,6 +2661,58 @@ 

                                                                                  Args

                                                                                  def options(self,
                                                                                  constraints: str | Pattern | Dict[str, str | Pattern],
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def options(
                                                                                  +    self,
                                                                                  +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new options listener.
                                                                                  +    This method can be used as either a decorator or a method.
                                                                                  +
                                                                                  +        # Use this method as a decorator
                                                                                  +        @app.options("menu_selection")
                                                                                  +        def show_menu_options(ack):
                                                                                  +            options = [
                                                                                  +                {
                                                                                  +                    "text": {"type": "plain_text", "text": "Option 1"},
                                                                                  +                    "value": "1-1",
                                                                                  +                },
                                                                                  +                {
                                                                                  +                    "text": {"type": "plain_text", "text": "Option 2"},
                                                                                  +                    "value": "1-2",
                                                                                  +                },
                                                                                  +            ]
                                                                                  +            ack(options=options)
                                                                                  +
                                                                                  +        # Pass a function to this method
                                                                                  +        app.options("menu_selection")(show_menu_options)
                                                                                  +
                                                                                  +    Refer to the following documents for details:
                                                                                  +
                                                                                  +    * https://api.slack.com/reference/block-kit/block-elements#external_select
                                                                                  +    * https://api.slack.com/reference/block-kit/block-elements#external_multi_select
                                                                                  +
                                                                                  +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        matchers: A list of listener matcher functions.
                                                                                  +            Only when all the matchers return True, the listener function can be invoked.
                                                                                  +        middleware: A list of lister middleware functions.
                                                                                  +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                                                  +    """
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.options(constraints, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new options listener. This method can be used as either a decorator or a method.

                                                                                  # Use this method as a decorator
                                                                                  @@ -2067,6 +2753,54 @@ 

                                                                                  Args

                                                                                  def shortcut(self,
                                                                                  constraints: str | Pattern | Dict[str, str | Pattern],
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def shortcut(
                                                                                  +    self,
                                                                                  +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new shortcut listener.
                                                                                  +    This method can be used as either a decorator or a method.
                                                                                  +
                                                                                  +        # Use this method as a decorator
                                                                                  +        @app.shortcut("open_modal")
                                                                                  +        def open_modal(ack, body, client):
                                                                                  +            # Acknowledge the command request
                                                                                  +            ack()
                                                                                  +            # Call views_open with the built-in client
                                                                                  +            client.views_open(
                                                                                  +                # Pass a valid trigger_id within 3 seconds of receiving it
                                                                                  +                trigger_id=body["trigger_id"],
                                                                                  +                # View payload
                                                                                  +                view={ ... }
                                                                                  +            )
                                                                                  +
                                                                                  +        # Pass a function to this method
                                                                                  +        app.shortcut("open_modal")(open_modal)
                                                                                  +
                                                                                  +    Refer to https://api.slack.com/interactivity/shortcuts for details about Shortcuts.
                                                                                  +
                                                                                  +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        constraints: The conditions that match a request payload.
                                                                                  +        matchers: A list of listener matcher functions.
                                                                                  +            Only when all the matchers return True, the listener function can be invoked.
                                                                                  +        middleware: A list of lister middleware functions.
                                                                                  +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                                                  +    """
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.shortcut(constraints, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new shortcut listener. This method can be used as either a decorator or a method.

                                                                                  # Use this method as a decorator
                                                                                  @@ -2103,6 +2837,39 @@ 

                                                                                  Args

                                                                                  def start(self,
                                                                                  port: int = 3000,
                                                                                  path: str = '/slack/events',
                                                                                  http_server_logger_enabled: bool = True) ‑> None
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def start(
                                                                                  +    self,
                                                                                  +    port: int = 3000,
                                                                                  +    path: str = "/slack/events",
                                                                                  +    http_server_logger_enabled: bool = True,
                                                                                  +) -> None:
                                                                                  +    """Starts a web server for local development.
                                                                                  +
                                                                                  +        # With the default settings, `http://localhost:3000/slack/events`
                                                                                  +        # is available for handling incoming requests from Slack
                                                                                  +        app.start()
                                                                                  +
                                                                                  +    This method internally starts a Web server process built with the `http.server` module.
                                                                                  +    For production, consider using a production-ready WSGI server such as Gunicorn.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        port: The port to listen on (Default: 3000)
                                                                                  +        path: The path to handle request from Slack (Default: `/slack/events`)
                                                                                  +        http_server_logger_enabled: The flag to enable http.server logging if True (Default: True)
                                                                                  +    """
                                                                                  +    self._development_server = SlackAppDevelopmentServer(
                                                                                  +        port=port,
                                                                                  +        path=path,
                                                                                  +        app=self,
                                                                                  +        oauth_flow=self.oauth_flow,
                                                                                  +        http_server_logger_enabled=http_server_logger_enabled,
                                                                                  +    )
                                                                                  +    self._development_server.start()
                                                                                  +

                                                                                  Starts a web server for local development.

                                                                                  # With the default settings, `http://localhost:3000/slack/events`
                                                                                   # is available for handling incoming requests from Slack
                                                                                  @@ -2124,6 +2891,75 @@ 

                                                                                  Args

                                                                                  def step(self,
                                                                                  callback_id: str | Pattern | WorkflowStep | WorkflowStepBuilder,
                                                                                  edit: Callable[..., BoltResponse | None] | Listener | Sequence[Callable] | None = None,
                                                                                  save: Callable[..., BoltResponse | None] | Listener | Sequence[Callable] | None = None,
                                                                                  execute: Callable[..., BoltResponse | None] | Listener | Sequence[Callable] | None = None)
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def step(
                                                                                  +    self,
                                                                                  +    callback_id: Union[str, Pattern, WorkflowStep, WorkflowStepBuilder],
                                                                                  +    edit: Optional[Union[Callable[..., Optional[BoltResponse]], Listener, Sequence[Callable]]] = None,
                                                                                  +    save: Optional[Union[Callable[..., Optional[BoltResponse]], Listener, Sequence[Callable]]] = None,
                                                                                  +    execute: Optional[Union[Callable[..., Optional[BoltResponse]], Listener, Sequence[Callable]]] = None,
                                                                                  +):
                                                                                  +    """
                                                                                  +    Deprecated:
                                                                                  +        Steps from apps for legacy workflows are now deprecated.
                                                                                  +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                                                  +
                                                                                  +    Registers a new step from app listener.
                                                                                  +
                                                                                  +    Unlike others, this method doesn't behave as a decorator.
                                                                                  +    If you want to register a step from app by a decorator, use `WorkflowStepBuilder`'s methods.
                                                                                  +
                                                                                  +        # Create a new WorkflowStep instance
                                                                                  +        from slack_bolt.workflows.step import WorkflowStep
                                                                                  +        ws = WorkflowStep(
                                                                                  +            callback_id="add_task",
                                                                                  +            edit=edit,
                                                                                  +            save=save,
                                                                                  +            execute=execute,
                                                                                  +        )
                                                                                  +        # Pass Step to set up listeners
                                                                                  +        app.step(ws)
                                                                                  +
                                                                                  +    Refer to https://api.slack.com/workflows/steps for details of steps from apps.
                                                                                  +
                                                                                  +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                                                  +
                                                                                  +    For further information about WorkflowStep specific function arguments
                                                                                  +    such as `configure`, `update`, `complete`, and `fail`,
                                                                                  +    refer to `slack_bolt.workflows.step.utilities` API documents.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        callback_id: The Callback ID for this step from app
                                                                                  +        edit: The function for displaying a modal in the Workflow Builder
                                                                                  +        save: The function for handling configuration in the Workflow Builder
                                                                                  +        execute: The function for handling the step execution
                                                                                  +    """
                                                                                  +    warnings.warn(
                                                                                  +        (
                                                                                  +            "Steps from apps for legacy workflows are now deprecated. "
                                                                                  +            "Use new custom steps: https://api.slack.com/automation/functions/custom-bolt"
                                                                                  +        ),
                                                                                  +        category=DeprecationWarning,
                                                                                  +    )
                                                                                  +    step = callback_id
                                                                                  +    if isinstance(callback_id, (str, Pattern)):
                                                                                  +        step = WorkflowStep(
                                                                                  +            callback_id=callback_id,
                                                                                  +            edit=edit,  # type: ignore[arg-type]
                                                                                  +            save=save,  # type: ignore[arg-type]
                                                                                  +            execute=execute,  # type: ignore[arg-type]
                                                                                  +            base_logger=self._base_logger,
                                                                                  +        )
                                                                                  +    elif isinstance(step, WorkflowStepBuilder):
                                                                                  +        step = step.build(base_logger=self._base_logger)
                                                                                  +    elif not isinstance(step, WorkflowStep):
                                                                                  +        raise BoltError(f"Invalid step object ({type(step)})")
                                                                                  +
                                                                                  +    self.use(WorkflowStepMiddleware(step))
                                                                                  +

                                                                                  Deprecated

                                                                                  Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                  @@ -2162,6 +2998,16 @@

                                                                                  Args

                                                                                  def use(self, *args) ‑> Callable | None
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def use(self, *args) -> Optional[Callable]:
                                                                                  +    """Registers a new global middleware to this app. This method can be used as either a decorator or a method.
                                                                                  +
                                                                                  +    Refer to `App#middleware()` method's docstring for details."""
                                                                                  +    return self.middleware(*args)
                                                                                  +

                                                                                  Registers a new global middleware to this app. This method can be used as either a decorator or a method.

                                                                                  Refer to App#middleware() method's docstring for details.

                                                                                  @@ -2169,6 +3015,58 @@

                                                                                  Args

                                                                                  def view(self,
                                                                                  constraints: str | Pattern | Dict[str, str | Pattern],
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def view(
                                                                                  +    self,
                                                                                  +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new `view_submission`/`view_closed` event listener.
                                                                                  +    This method can be used as either a decorator or a method.
                                                                                  +
                                                                                  +        # Use this method as a decorator
                                                                                  +        @app.view("view_1")
                                                                                  +        def handle_submission(ack, body, client, view):
                                                                                  +            # Assume there's an input block with `block_c` as the block_id and `dreamy_input`
                                                                                  +            hopes_and_dreams = view["state"]["values"]["block_c"]["dreamy_input"]
                                                                                  +            user = body["user"]["id"]
                                                                                  +            # Validate the inputs
                                                                                  +            errors = {}
                                                                                  +            if hopes_and_dreams is not None and len(hopes_and_dreams) <= 5:
                                                                                  +                errors["block_c"] = "The value must be longer than 5 characters"
                                                                                  +            if len(errors) > 0:
                                                                                  +                ack(response_action="errors", errors=errors)
                                                                                  +                return
                                                                                  +            # Acknowledge the view_submission event and close the modal
                                                                                  +            ack()
                                                                                  +            # Do whatever you want with the input data - here we're saving it to a DB
                                                                                  +
                                                                                  +        # Pass a function to this method
                                                                                  +        app.view("view_1")(handle_submission)
                                                                                  +
                                                                                  +    Refer to https://api.slack.com/reference/interaction-payloads/views for details of payloads.
                                                                                  +
                                                                                  +    To learn available arguments for middleware/listeners, see `slack_bolt.kwargs_injection.args`'s API document.
                                                                                  +
                                                                                  +    Args:
                                                                                  +        constraints: The conditions that match a request payload
                                                                                  +        matchers: A list of listener matcher functions.
                                                                                  +            Only when all the matchers return True, the listener function can be invoked.
                                                                                  +        middleware: A list of lister middleware functions.
                                                                                  +            Only when all the middleware call `next()` method, the listener function can be invoked.
                                                                                  +    """
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.view(constraints, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new view_submission/view_closed event listener. This method can be used as either a decorator or a method.

                                                                                  # Use this method as a decorator
                                                                                  @@ -2209,6 +3107,26 @@ 

                                                                                  Args

                                                                                  def view_closed(self,
                                                                                  constraints: str | Pattern,
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def view_closed(
                                                                                  +    self,
                                                                                  +    constraints: Union[str, Pattern],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new `view_closed` listener.
                                                                                  +    Refer to https://api.slack.com/reference/interaction-payloads/views#view_closed for details."""
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.view_closed(constraints, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new view_closed listener. Refer to https://api.slack.com/reference/interaction-payloads/views#view_closed for details.

                                                                                  @@ -2216,6 +3134,26 @@

                                                                                  Args

                                                                                  def view_submission(self,
                                                                                  constraints: str | Pattern,
                                                                                  matchers: Sequence[Callable[..., bool]] | None = None,
                                                                                  middleware: Sequence[Callable | Middleware] | None = None) ‑> Callable[..., Callable[..., BoltResponse | None] | None]
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def view_submission(
                                                                                  +    self,
                                                                                  +    constraints: Union[str, Pattern],
                                                                                  +    matchers: Optional[Sequence[Callable[..., bool]]] = None,
                                                                                  +    middleware: Optional[Sequence[Union[Callable, Middleware]]] = None,
                                                                                  +) -> Callable[..., Optional[Callable[..., Optional[BoltResponse]]]]:
                                                                                  +    """Registers a new `view_submission` listener.
                                                                                  +    Refer to https://api.slack.com/reference/interaction-payloads/views#view_submission for details."""
                                                                                  +
                                                                                  +    def __call__(*args, **kwargs):
                                                                                  +        functions = self._to_listener_functions(kwargs) if kwargs else list(args)
                                                                                  +        primary_matcher = builtin_matchers.view_submission(constraints, base_logger=self._base_logger)
                                                                                  +        return self._register_listener(list(functions), primary_matcher, matchers, middleware)
                                                                                  +
                                                                                  +    return __call__
                                                                                  +

                                                                                  Registers a new view_submission listener. Refer to https://api.slack.com/reference/interaction-payloads/views#view_submission for details.

                                                                                  @@ -2226,31 +3164,6 @@

                                                                                  Args

                                                                                  (*,
                                                                                  logger: logging.Logger,
                                                                                  client: slack_sdk.web.client.WebClient,
                                                                                  req: BoltRequest,
                                                                                  resp: BoltResponse,
                                                                                  context: BoltContext,
                                                                                  body: Dict[str, Any],
                                                                                  payload: Dict[str, Any],
                                                                                  options: Dict[str, Any] | None = None,
                                                                                  shortcut: Dict[str, Any] | None = None,
                                                                                  action: Dict[str, Any] | None = None,
                                                                                  view: Dict[str, Any] | None = None,
                                                                                  command: Dict[str, Any] | None = None,
                                                                                  event: Dict[str, Any] | None = None,
                                                                                  message: Dict[str, Any] | None = None,
                                                                                  ack: Ack,
                                                                                  say: Say,
                                                                                  respond: Respond,
                                                                                  complete: Complete,
                                                                                  fail: Fail,
                                                                                  set_status: SetStatus | None = None,
                                                                                  set_title: SetTitle | None = None,
                                                                                  set_suggested_prompts: SetSuggestedPrompts | None = None,
                                                                                  get_thread_context: GetThreadContext | None = None,
                                                                                  save_thread_context: SaveThreadContext | None = None,
                                                                                  next: Callable[[], None],
                                                                                  **kwargs)
                                                                                  -

                                                                                  All the arguments in this class are available in any middleware / listeners. -You can inject the named variables in the argument list in arbitrary order.

                                                                                  -
                                                                                  @app.action("link_button")
                                                                                  -def handle_buttons(ack, respond, logger, context, body, client):
                                                                                  -    logger.info(f"request body: {body}")
                                                                                  -    ack()
                                                                                  -    if context.channel_id is not None:
                                                                                  -        respond("Hi!")
                                                                                  -    client.views_open(
                                                                                  -        trigger_id=body["trigger_id"],
                                                                                  -        view={ ... }
                                                                                  -    )
                                                                                  -
                                                                                  -

                                                                                  Alternatively, you can include a parameter named args and it will be injected with an instance of this class.

                                                                                  -
                                                                                  @app.action("link_button")
                                                                                  -def handle_buttons(args):
                                                                                  -    args.logger.info(f"request body: {args.body}")
                                                                                  -    args.ack()
                                                                                  -    if args.context.channel_id is not None:
                                                                                  -        args.respond("Hi!")
                                                                                  -    args.client.views_open(
                                                                                  -        trigger_id=args.body["trigger_id"],
                                                                                  -        view={ ... }
                                                                                  -    )
                                                                                  -
                                                                                  Expand source code @@ -2409,6 +3322,31 @@

                                                                                  Args

                                                                                  self.next: Callable[[], None] = next self.next_: Callable[[], None] = next
                                                                                  +

                                                                                  All the arguments in this class are available in any middleware / listeners. +You can inject the named variables in the argument list in arbitrary order.

                                                                                  +
                                                                                  @app.action("link_button")
                                                                                  +def handle_buttons(ack, respond, logger, context, body, client):
                                                                                  +    logger.info(f"request body: {body}")
                                                                                  +    ack()
                                                                                  +    if context.channel_id is not None:
                                                                                  +        respond("Hi!")
                                                                                  +    client.views_open(
                                                                                  +        trigger_id=body["trigger_id"],
                                                                                  +        view={ ... }
                                                                                  +    )
                                                                                  +
                                                                                  +

                                                                                  Alternatively, you can include a parameter named args and it will be injected with an instance of this class.

                                                                                  +
                                                                                  @app.action("link_button")
                                                                                  +def handle_buttons(args):
                                                                                  +    args.logger.info(f"request body: {args.body}")
                                                                                  +    args.ack()
                                                                                  +    if args.context.channel_id is not None:
                                                                                  +        args.respond("Hi!")
                                                                                  +    args.client.views_open(
                                                                                  +        trigger_id=args.body["trigger_id"],
                                                                                  +        view={ ... }
                                                                                  +    )
                                                                                  +

                                                                                  Class variables

                                                                                  var ackAck
                                                                                  @@ -2530,7 +3468,6 @@

                                                                                  Class variables

                                                                                  (*,
                                                                                  app_name: str = 'assistant',
                                                                                  thread_context_store: AssistantThreadContextStore | None = None,
                                                                                  logger: logging.Logger | None = None)
                                                                                  -

                                                                                  A middleware can process request data before other middleware and listener functions.

                                                                                  Expand source code @@ -2799,6 +3736,7 @@

                                                                                  Class variables

                                                                                  else: raise BoltError(f"Invalid listener: {type(listener_or_functions)} detected")
                                                                                  +

                                                                                  A middleware can process request data before other middleware and listener functions.

                                                                                  Ancestors

                                                                                  • Middleware
                                                                                  • @@ -2807,11 +3745,11 @@

                                                                                    Class variables

                                                                                    var base_logger : logging.Logger | None
                                                                                    -
                                                                                    +

                                                                                    The type of the None singleton.

                                                                                    var thread_context_storeAssistantThreadContextStore | None
                                                                                    -
                                                                                    +

                                                                                    The type of the None singleton.

                                                                                    Static methods

                                                                                    @@ -2820,6 +3758,14 @@

                                                                                    Static methods

                                                                                    def default_thread_context_changed(save_thread_context: SaveThreadContext,
                                                                                    payload: dict)
                                                                                    +
                                                                                    + +Expand source code + +
                                                                                    @staticmethod
                                                                                    +def default_thread_context_changed(save_thread_context: SaveThreadContext, payload: dict):
                                                                                    +    save_thread_context(payload["assistant_thread"]["context"])
                                                                                    +
                                                                                  @@ -2829,30 +3775,248 @@

                                                                                  Methods

                                                                                  def bot_message(self,
                                                                                  *args,
                                                                                  matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                  middleware: Callable | Middleware | None = None,
                                                                                  lazy: List[Callable[..., None]] | None = None)
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def bot_message(
                                                                                  +    self,
                                                                                  +    *args,
                                                                                  +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                  +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                  +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                  +):
                                                                                  +    if self._bot_message_listeners is None:
                                                                                  +        self._bot_message_listeners = []
                                                                                  +    all_matchers = self._merge_matchers(is_bot_message_event_in_assistant_thread, matchers)
                                                                                  +    if is_used_without_argument(args):
                                                                                  +        func = args[0]
                                                                                  +        self._bot_message_listeners.append(
                                                                                  +            self.build_listener(
                                                                                  +                listener_or_functions=func,
                                                                                  +                matchers=all_matchers,
                                                                                  +                middleware=middleware,  # type:ignore[arg-type]
                                                                                  +            )
                                                                                  +        )
                                                                                  +        return func
                                                                                  +
                                                                                  +    def _inner(func):
                                                                                  +        functions = [func] + (lazy if lazy is not None else [])
                                                                                  +        self._bot_message_listeners.append(
                                                                                  +            self.build_listener(
                                                                                  +                listener_or_functions=functions,
                                                                                  +                matchers=all_matchers,
                                                                                  +                middleware=middleware,
                                                                                  +            )
                                                                                  +        )
                                                                                  +
                                                                                  +        @wraps(func)
                                                                                  +        def _wrapper(*args, **kwargs):
                                                                                  +            return func(*args, **kwargs)
                                                                                  +
                                                                                  +        return _wrapper
                                                                                  +
                                                                                  +    return _inner
                                                                                  +
                                                                                  def build_listener(self,
                                                                                  listener_or_functions: Listener | Callable | List[Callable],
                                                                                  matchers: List[ListenerMatcher | Callable[..., bool]] | None = None,
                                                                                  middleware: List[Middleware] | None = None,
                                                                                  base_logger: logging.Logger | None = None) ‑> Listener
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def build_listener(
                                                                                  +    self,
                                                                                  +    listener_or_functions: Union[Listener, Callable, List[Callable]],
                                                                                  +    matchers: Optional[List[Union[ListenerMatcher, Callable[..., bool]]]] = None,
                                                                                  +    middleware: Optional[List[Middleware]] = None,
                                                                                  +    base_logger: Optional[Logger] = None,
                                                                                  +) -> Listener:
                                                                                  +    if isinstance(listener_or_functions, Callable):  # type:ignore[arg-type]
                                                                                  +        listener_or_functions = [listener_or_functions]  # type:ignore[list-item]
                                                                                  +
                                                                                  +    if isinstance(listener_or_functions, Listener):
                                                                                  +        return listener_or_functions
                                                                                  +    elif isinstance(listener_or_functions, list):
                                                                                  +        middleware = middleware if middleware else []
                                                                                  +        functions = listener_or_functions
                                                                                  +        ack_function = functions.pop(0)
                                                                                  +
                                                                                  +        matchers = matchers if matchers else []
                                                                                  +        listener_matchers: List[ListenerMatcher] = []
                                                                                  +        for matcher in matchers:
                                                                                  +            if isinstance(matcher, ListenerMatcher):
                                                                                  +                listener_matchers.append(matcher)
                                                                                  +            elif isinstance(matcher, Callable):  # type:ignore[arg-type]
                                                                                  +                listener_matchers.append(
                                                                                  +                    build_listener_matcher(
                                                                                  +                        func=matcher,
                                                                                  +                        asyncio=False,
                                                                                  +                        base_logger=base_logger,
                                                                                  +                    )
                                                                                  +                )
                                                                                  +        return CustomListener(
                                                                                  +            app_name=self.app_name,
                                                                                  +            matchers=listener_matchers,
                                                                                  +            middleware=middleware,
                                                                                  +            ack_function=ack_function,
                                                                                  +            lazy_functions=functions,
                                                                                  +            auto_acknowledgement=True,
                                                                                  +            base_logger=base_logger or self.base_logger,
                                                                                  +        )
                                                                                  +    else:
                                                                                  +        raise BoltError(f"Invalid listener: {type(listener_or_functions)} detected")
                                                                                  +
                                                                                  def thread_context_changed(self,
                                                                                  *args,
                                                                                  matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                  middleware: Callable | Middleware | None = None,
                                                                                  lazy: List[Callable[..., None]] | None = None)
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def thread_context_changed(
                                                                                  +    self,
                                                                                  +    *args,
                                                                                  +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                  +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                  +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                  +):
                                                                                  +    if self._thread_context_changed_listeners is None:
                                                                                  +        self._thread_context_changed_listeners = []
                                                                                  +    all_matchers = self._merge_matchers(is_assistant_thread_context_changed_event, matchers)
                                                                                  +    if is_used_without_argument(args):
                                                                                  +        func = args[0]
                                                                                  +        self._thread_context_changed_listeners.append(
                                                                                  +            self.build_listener(
                                                                                  +                listener_or_functions=func,
                                                                                  +                matchers=all_matchers,
                                                                                  +                middleware=middleware,  # type:ignore[arg-type]
                                                                                  +            )
                                                                                  +        )
                                                                                  +        return func
                                                                                  +
                                                                                  +    def _inner(func):
                                                                                  +        functions = [func] + (lazy if lazy is not None else [])
                                                                                  +        self._thread_context_changed_listeners.append(
                                                                                  +            self.build_listener(
                                                                                  +                listener_or_functions=functions,
                                                                                  +                matchers=all_matchers,
                                                                                  +                middleware=middleware,
                                                                                  +            )
                                                                                  +        )
                                                                                  +
                                                                                  +        @wraps(func)
                                                                                  +        def _wrapper(*args, **kwargs):
                                                                                  +            return func(*args, **kwargs)
                                                                                  +
                                                                                  +        return _wrapper
                                                                                  +
                                                                                  +    return _inner
                                                                                  +
                                                                                  def thread_started(self,
                                                                                  *args,
                                                                                  matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                  middleware: Callable | Middleware | None = None,
                                                                                  lazy: List[Callable[..., None]] | None = None)
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def thread_started(
                                                                                  +    self,
                                                                                  +    *args,
                                                                                  +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                  +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                  +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                  +):
                                                                                  +    if self._thread_started_listeners is None:
                                                                                  +        self._thread_started_listeners = []
                                                                                  +    all_matchers = self._merge_matchers(is_assistant_thread_started_event, matchers)
                                                                                  +    if is_used_without_argument(args):
                                                                                  +        func = args[0]
                                                                                  +        self._thread_started_listeners.append(
                                                                                  +            self.build_listener(
                                                                                  +                listener_or_functions=func,
                                                                                  +                matchers=all_matchers,
                                                                                  +                middleware=middleware,  # type:ignore[arg-type]
                                                                                  +            )
                                                                                  +        )
                                                                                  +        return func
                                                                                  +
                                                                                  +    def _inner(func):
                                                                                  +        functions = [func] + (lazy if lazy is not None else [])
                                                                                  +        self._thread_started_listeners.append(
                                                                                  +            self.build_listener(
                                                                                  +                listener_or_functions=functions,
                                                                                  +                matchers=all_matchers,
                                                                                  +                middleware=middleware,
                                                                                  +            )
                                                                                  +        )
                                                                                  +
                                                                                  +        @wraps(func)
                                                                                  +        def _wrapper(*args, **kwargs):
                                                                                  +            return func(*args, **kwargs)
                                                                                  +
                                                                                  +        return _wrapper
                                                                                  +
                                                                                  +    return _inner
                                                                                  +
                                                                                  def user_message(self,
                                                                                  *args,
                                                                                  matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                  middleware: Callable | Middleware | None = None,
                                                                                  lazy: List[Callable[..., None]] | None = None)
                                                                                  +
                                                                                  + +Expand source code + +
                                                                                  def user_message(
                                                                                  +    self,
                                                                                  +    *args,
                                                                                  +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                  +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                  +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                  +):
                                                                                  +    if self._user_message_listeners is None:
                                                                                  +        self._user_message_listeners = []
                                                                                  +    all_matchers = self._merge_matchers(is_user_message_event_in_assistant_thread, matchers)
                                                                                  +    if is_used_without_argument(args):
                                                                                  +        func = args[0]
                                                                                  +        self._user_message_listeners.append(
                                                                                  +            self.build_listener(
                                                                                  +                listener_or_functions=func,
                                                                                  +                matchers=all_matchers,
                                                                                  +                middleware=middleware,  # type:ignore[arg-type]
                                                                                  +            )
                                                                                  +        )
                                                                                  +        return func
                                                                                  +
                                                                                  +    def _inner(func):
                                                                                  +        functions = [func] + (lazy if lazy is not None else [])
                                                                                  +        self._user_message_listeners.append(
                                                                                  +            self.build_listener(
                                                                                  +                listener_or_functions=functions,
                                                                                  +                matchers=all_matchers,
                                                                                  +                middleware=middleware,
                                                                                  +            )
                                                                                  +        )
                                                                                  +
                                                                                  +        @wraps(func)
                                                                                  +        def _wrapper(*args, **kwargs):
                                                                                  +            return func(*args, **kwargs)
                                                                                  +
                                                                                  +        return _wrapper
                                                                                  +
                                                                                  +    return _inner
                                                                                  +
                                                                                  @@ -2871,17 +4035,6 @@

                                                                                  Inherited members

                                                                                  (payload: dict)
                                                                                  -

                                                                                  dict() -> new empty dictionary -dict(mapping) -> new dictionary initialized from a mapping object's -(key, value) pairs -dict(iterable) -> new dictionary initialized as if via: -d = {} -for k, v in iterable: -d[k] = v -dict(**kwargs) -> new dictionary initialized with the name=value pairs -in the keyword argument list. -For example: -dict(one=1, two=2)

                                                                                  Expand source code @@ -2897,6 +4050,17 @@

                                                                                  Inherited members

                                                                                  self.team_id = payload.get("team_id") self.channel_id = payload["channel_id"]
                                                                                  +

                                                                                  dict() -> new empty dictionary +dict(mapping) -> new dictionary initialized from a mapping object's +(key, value) pairs +dict(iterable) -> new dictionary initialized as if via: +d = {} +for k, v in iterable: +d[k] = v +dict(**kwargs) -> new dictionary initialized with the name=value pairs +in the keyword argument list. +For example: +dict(one=1, two=2)

                                                                                  Ancestors

                                                                                  • builtins.dict
                                                                                  • @@ -2905,15 +4069,15 @@

                                                                                    Class variables

                                                                                    var channel_id : str
                                                                                    -
                                                                                    +

                                                                                    The type of the None singleton.

                                                                                    var enterprise_id : str | None
                                                                                    -
                                                                                    +

                                                                                    The type of the None singleton.

                                                                                    var team_id : str | None
                                                                                    -
                                                                                    +

                                                                                    The type of the None singleton.

                                                                                  @@ -2921,7 +4085,6 @@

                                                                                  Class variables

                                                                                  class AssistantThreadContextStore
                                                                                  -
                                                                                  Expand source code @@ -2933,6 +4096,7 @@

                                                                                  Class variables

                                                                                  def find(self, *, channel_id: str, thread_ts: str) -> Optional[AssistantThreadContext]: raise NotImplementedError()
                                                                                  +

                                                                                  Subclasses

                                                                                  • DefaultAssistantThreadContextStore
                                                                                  • @@ -2944,12 +4108,26 @@

                                                                                    Methods

                                                                                    def find(self, *, channel_id: str, thread_ts: str) ‑> AssistantThreadContext | None
                                                                                    +
                                                                                    + +Expand source code + +
                                                                                    def find(self, *, channel_id: str, thread_ts: str) -> Optional[AssistantThreadContext]:
                                                                                    +    raise NotImplementedError()
                                                                                    +
                                                                                    def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) ‑> None
                                                                                    +
                                                                                    + +Expand source code + +
                                                                                    def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) -> None:
                                                                                    +    raise NotImplementedError()
                                                                                    +
                                                                                    @@ -2959,7 +4137,6 @@

                                                                                    Methods

                                                                                    (*args, **kwargs)
                                                                                    -

                                                                                    Context object associated with a request from Slack.

                                                                                    Expand source code @@ -3156,6 +4333,7 @@

                                                                                    Methods

                                                                                    def save_thread_context(self) -> Optional[SaveThreadContext]: return self.get("save_thread_context")
                                                                                    +

                                                                                    Context object associated with a request from Slack.

                                                                                    Ancestors

                                                                                    • BaseContext
                                                                                    • @@ -3165,18 +4343,6 @@

                                                                                      Instance variables

                                                                                      prop ackAck
                                                                                      -

                                                                                      ack() function for this request.

                                                                                      -
                                                                                      @app.action("button")
                                                                                      -def handle_button_clicks(context):
                                                                                      -    context.ack()
                                                                                      -
                                                                                      -# You can access "ack" this way too.
                                                                                      -@app.action("button")
                                                                                      -def handle_button_clicks(ack):
                                                                                      -    ack()
                                                                                      -
                                                                                      -

                                                                                      Returns

                                                                                      -

                                                                                      Callable ack() function

                                                                                      Expand source code @@ -3201,27 +4367,21 @@

                                                                                      Returns

                                                                                      self["ack"] = Ack() return self["ack"]
                                                                                      -
                                                                                      -
                                                                                      prop client : slack_sdk.web.client.WebClient
                                                                                      -
                                                                                      -

                                                                                      The WebClient instance available for this request.

                                                                                      -
                                                                                      @app.event("app_mention")
                                                                                      -def handle_events(context):
                                                                                      -    context.client.chat_postMessage(
                                                                                      -        channel=context.channel_id,
                                                                                      -        text="Thanks!",
                                                                                      -    )
                                                                                      +

                                                                                      ack() function for this request.

                                                                                      +
                                                                                      @app.action("button")
                                                                                      +def handle_button_clicks(context):
                                                                                      +    context.ack()
                                                                                       
                                                                                      -# You can access "client" this way too.
                                                                                      -@app.event("app_mention")
                                                                                      -def handle_events(client, context):
                                                                                      -    client.chat_postMessage(
                                                                                      -        channel=context.channel_id,
                                                                                      -        text="Thanks!",
                                                                                      -    )
                                                                                      +# You can access "ack" this way too.
                                                                                      +@app.action("button")
                                                                                      +def handle_button_clicks(ack):
                                                                                      +    ack()
                                                                                       

                                                                                      Returns

                                                                                      -

                                                                                      WebClient instance

                                                                                      +

                                                                                      Callable ack() function

                                                                                      +
                                                                                      +
                                                                                      prop client : slack_sdk.web.client.WebClient
                                                                                      +
                                                                                      Expand source code @@ -3252,25 +4412,27 @@

                                                                                      Returns

                                                                                      self["client"] = WebClient(token=None) return self["client"]
                                                                                      -
                                                                                      -
                                                                                      prop completeComplete
                                                                                      -
                                                                                      -

                                                                                      complete() function for this request. Once a custom function's state is set to complete, -any outputs the function returns will be passed along to the next step of its housing workflow, -or complete the workflow if the function is the last step in a workflow. Additionally, -any interactivity handlers associated to a function invocation will no longer be invocable.

                                                                                      -
                                                                                      @app.function("reverse")
                                                                                      -def handle_button_clicks(ack, complete):
                                                                                      -    ack()
                                                                                      -    complete(outputs={"stringReverse":"olleh"})
                                                                                      +

                                                                                      The WebClient instance available for this request.

                                                                                      +
                                                                                      @app.event("app_mention")
                                                                                      +def handle_events(context):
                                                                                      +    context.client.chat_postMessage(
                                                                                      +        channel=context.channel_id,
                                                                                      +        text="Thanks!",
                                                                                      +    )
                                                                                       
                                                                                      -@app.function("reverse")
                                                                                      -def handle_button_clicks(context):
                                                                                      -    context.ack()
                                                                                      -    context.complete(outputs={"stringReverse":"olleh"})
                                                                                      +# You can access "client" this way too.
                                                                                      +@app.event("app_mention")
                                                                                      +def handle_events(client, context):
                                                                                      +    client.chat_postMessage(
                                                                                      +        channel=context.channel_id,
                                                                                      +        text="Thanks!",
                                                                                      +    )
                                                                                       

                                                                                      Returns

                                                                                      -

                                                                                      Callable complete() function

                                                                                      +

                                                                                      WebClient instance

                                                                                      +
                                                                                      +
                                                                                      prop completeComplete
                                                                                      +
                                                                                      Expand source code @@ -3299,25 +4461,25 @@

                                                                                      Returns

                                                                                      self["complete"] = Complete(client=self.client, function_execution_id=self.function_execution_id) return self["complete"]
                                                                                      -
                                                                                      -
                                                                                      prop failFail
                                                                                      -
                                                                                      -

                                                                                      fail() function for this request. Once a custom function's state is set to error, -its housing workflow will be interrupted and any provided error message will be passed -on to the end user through SlackBot. Additionally, any interactivity handlers associated -to a function invocation will no longer be invocable.

                                                                                      +

                                                                                      complete() function for this request. Once a custom function's state is set to complete, +any outputs the function returns will be passed along to the next step of its housing workflow, +or complete the workflow if the function is the last step in a workflow. Additionally, +any interactivity handlers associated to a function invocation will no longer be invocable.

                                                                                      @app.function("reverse")
                                                                                      -def handle_button_clicks(ack, fail):
                                                                                      +def handle_button_clicks(ack, complete):
                                                                                           ack()
                                                                                      -    fail(error="something went wrong")
                                                                                      +    complete(outputs={"stringReverse":"olleh"})
                                                                                       
                                                                                       @app.function("reverse")
                                                                                       def handle_button_clicks(context):
                                                                                           context.ack()
                                                                                      -    context.fail(error="something went wrong")
                                                                                      +    context.complete(outputs={"stringReverse":"olleh"})
                                                                                       

                                                                                      Returns

                                                                                      -

                                                                                      Callable fail() function

                                                                                      +

                                                                                      Callable complete() function

                                                                                      +
                                                                                      +
                                                                                      prop failFail
                                                                                      +
                                                                                      Expand source code @@ -3346,10 +4508,25 @@

                                                                                      Returns

                                                                                      self["fail"] = Fail(client=self.client, function_execution_id=self.function_execution_id) return self["fail"]
                                                                                      +

                                                                                      fail() function for this request. Once a custom function's state is set to error, +its housing workflow will be interrupted and any provided error message will be passed +on to the end user through SlackBot. Additionally, any interactivity handlers associated +to a function invocation will no longer be invocable.

                                                                                      +
                                                                                      @app.function("reverse")
                                                                                      +def handle_button_clicks(ack, fail):
                                                                                      +    ack()
                                                                                      +    fail(error="something went wrong")
                                                                                      +
                                                                                      +@app.function("reverse")
                                                                                      +def handle_button_clicks(context):
                                                                                      +    context.ack()
                                                                                      +    context.fail(error="something went wrong")
                                                                                      +
                                                                                      +

                                                                                      Returns

                                                                                      +

                                                                                      Callable fail() function

                                                                                      prop get_thread_contextGetThreadContext | None
                                                                                      -
                                                                                      Expand source code @@ -3358,10 +4535,10 @@

                                                                                      Returns

                                                                                      def get_thread_context(self) -> Optional[GetThreadContext]: return self.get("get_thread_context")
                                                                                      +
                                                                                      prop listener_runner : ThreadListenerRunner
                                                                                      -

                                                                                      The properly configured listener_runner that is available for middleware/listeners.

                                                                                      Expand source code @@ -3371,23 +4548,10 @@

                                                                                      Returns

                                                                                      """The properly configured listener_runner that is available for middleware/listeners.""" return self["listener_runner"]
                                                                                      +

                                                                                      The properly configured listener_runner that is available for middleware/listeners.

                                                                                      prop respondRespond | None
                                                                                      -

                                                                                      respond() function for this request.

                                                                                      -
                                                                                      @app.action("button")
                                                                                      -def handle_button_clicks(context):
                                                                                      -    context.ack()
                                                                                      -    context.respond("Hi!")
                                                                                      -
                                                                                      -# You can access "ack" this way too.
                                                                                      -@app.action("button")
                                                                                      -def handle_button_clicks(ack, respond):
                                                                                      -    ack()
                                                                                      -    respond("Hi!")
                                                                                      -
                                                                                      -

                                                                                      Returns

                                                                                      -

                                                                                      Callable respond() function

                                                                                      Expand source code @@ -3418,10 +4582,23 @@

                                                                                      Returns

                                                                                      ) return self["respond"]
                                                                                      +

                                                                                      respond() function for this request.

                                                                                      +
                                                                                      @app.action("button")
                                                                                      +def handle_button_clicks(context):
                                                                                      +    context.ack()
                                                                                      +    context.respond("Hi!")
                                                                                      +
                                                                                      +# You can access "ack" this way too.
                                                                                      +@app.action("button")
                                                                                      +def handle_button_clicks(ack, respond):
                                                                                      +    ack()
                                                                                      +    respond("Hi!")
                                                                                      +
                                                                                      +

                                                                                      Returns

                                                                                      +

                                                                                      Callable respond() function

                                                                                      prop save_thread_contextSaveThreadContext | None
                                                                                      -
                                                                                      Expand source code @@ -3430,23 +4607,10 @@

                                                                                      Returns

                                                                                      def save_thread_context(self) -> Optional[SaveThreadContext]: return self.get("save_thread_context")
                                                                                      +
                                                                                      prop saySay
                                                                                      -

                                                                                      say() function for this request.

                                                                                      -
                                                                                      @app.action("button")
                                                                                      -def handle_button_clicks(context):
                                                                                      -    context.ack()
                                                                                      -    context.say("Hi!")
                                                                                      -
                                                                                      -# You can access "ack" this way too.
                                                                                      -@app.action("button")
                                                                                      -def handle_button_clicks(ack, say):
                                                                                      -    ack()
                                                                                      -    say("Hi!")
                                                                                      -
                                                                                      -

                                                                                      Returns

                                                                                      -

                                                                                      Callable say() function

                                                                                      Expand source code @@ -3473,10 +4637,23 @@

                                                                                      Returns

                                                                                      self["say"] = Say(client=self.client, channel=self.channel_id, thread_ts=self.thread_ts) return self["say"]
                                                                                      +

                                                                                      say() function for this request.

                                                                                      +
                                                                                      @app.action("button")
                                                                                      +def handle_button_clicks(context):
                                                                                      +    context.ack()
                                                                                      +    context.say("Hi!")
                                                                                      +
                                                                                      +# You can access "ack" this way too.
                                                                                      +@app.action("button")
                                                                                      +def handle_button_clicks(ack, say):
                                                                                      +    ack()
                                                                                      +    say("Hi!")
                                                                                      +
                                                                                      +

                                                                                      Returns

                                                                                      +

                                                                                      Callable say() function

                                                                                      prop set_statusSetStatus | None
                                                                                      -
                                                                                      Expand source code @@ -3485,10 +4662,10 @@

                                                                                      Returns

                                                                                      def set_status(self) -> Optional[SetStatus]: return self.get("set_status")
                                                                                      +
                                                                                      prop set_suggested_promptsSetSuggestedPrompts | None
                                                                                      -
                                                                                      Expand source code @@ -3497,10 +4674,10 @@

                                                                                      Returns

                                                                                      def set_suggested_prompts(self) -> Optional[SetSuggestedPrompts]: return self.get("set_suggested_prompts")
                                                                                      +
                                                                                      prop set_titleSetTitle | None
                                                                                      -
                                                                                      Expand source code @@ -3509,6 +4686,7 @@

                                                                                      Returns

                                                                                      def set_title(self) -> Optional[SetTitle]: return self.get("set_title")
                                                                                      +

                                                                                      Methods

                                                                                      @@ -3517,6 +4695,31 @@

                                                                                      Methods

                                                                                      def to_copyable(self) ‑> BoltContext
                                                                                      +
                                                                                      + +Expand source code + +
                                                                                      def to_copyable(self) -> "BoltContext":
                                                                                      +    new_dict = {}
                                                                                      +    for prop_name, prop_value in self.items():
                                                                                      +        if prop_name in self.copyable_standard_property_names:
                                                                                      +            # all the standard properties are copiable
                                                                                      +            new_dict[prop_name] = prop_value
                                                                                      +        elif prop_name in self.non_copyable_standard_property_names:
                                                                                      +            # Do nothing with this property (e.g., listener_runner)
                                                                                      +            continue
                                                                                      +        else:
                                                                                      +            try:
                                                                                      +                copied_value = create_copy(prop_value)
                                                                                      +                new_dict[prop_name] = copied_value
                                                                                      +            except TypeError as te:
                                                                                      +                self.logger.warning(
                                                                                      +                    f"Skipped setting '{prop_name}' to a copied request for lazy listeners "
                                                                                      +                    "due to a deep-copy creation error. Consider passing the value not as part of context object "
                                                                                      +                    f"(error: {te})"
                                                                                      +                )
                                                                                      +    return BoltContext(new_dict)
                                                                                      +
                                                                                      @@ -3532,6 +4735,7 @@

                                                                                      Inherited members

                                                                                    • bot_token
                                                                                    • bot_user_id
                                                                                    • channel_id
                                                                                    • +
                                                                                    • copyable_standard_property_names
                                                                                    • enterprise_id
                                                                                    • function_bot_access_token
                                                                                    • function_execution_id
                                                                                    • @@ -3539,7 +4743,9 @@

                                                                                      Inherited members

                                                                                    • is_enterprise_install
                                                                                    • logger
                                                                                    • matches
                                                                                    • +
                                                                                    • non_copyable_standard_property_names
                                                                                    • response_url
                                                                                    • +
                                                                                    • standard_property_names
                                                                                    • team_id
                                                                                    • thread_ts
                                                                                    • token
                                                                                    • @@ -3554,20 +4760,6 @@

                                                                                      Inherited members

                                                                                      (*,
                                                                                      body: str | dict,
                                                                                      query: str | Dict[str, str] | Dict[str, Sequence[str]] | None = None,
                                                                                      headers: Dict[str, str | Sequence[str]] | None = None,
                                                                                      context: Dict[str, Any] | None = None,
                                                                                      mode: str = 'http')
                                                                                      -

                                                                                      Request to a Bolt app.

                                                                                      -

                                                                                      Args

                                                                                      -
                                                                                      -
                                                                                      body
                                                                                      -
                                                                                      The raw request body (only plain text is supported for "http" mode)
                                                                                      -
                                                                                      query
                                                                                      -
                                                                                      The query string data in any data format.
                                                                                      -
                                                                                      headers
                                                                                      -
                                                                                      The request headers.
                                                                                      -
                                                                                      context
                                                                                      -
                                                                                      The context in this request.
                                                                                      -
                                                                                      mode
                                                                                      -
                                                                                      The mode used for this request. (either "http" or "socket_mode")
                                                                                      -
                                                                                      Expand source code @@ -3641,43 +4833,57 @@

                                                                                      Args

                                                                                      mode=self.mode, )
                                                                                      +

                                                                                      Request to a Bolt app.

                                                                                      +

                                                                                      Args

                                                                                      +
                                                                                      +
                                                                                      body
                                                                                      +
                                                                                      The raw request body (only plain text is supported for "http" mode)
                                                                                      +
                                                                                      query
                                                                                      +
                                                                                      The query string data in any data format.
                                                                                      +
                                                                                      headers
                                                                                      +
                                                                                      The request headers.
                                                                                      +
                                                                                      context
                                                                                      +
                                                                                      The context in this request.
                                                                                      +
                                                                                      mode
                                                                                      +
                                                                                      The mode used for this request. (either "http" or "socket_mode")
                                                                                      +

                                                                                      Class variables

                                                                                      var body : Dict[str, Any]
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      var content_type : str | None
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      var contextBoltContext
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      var headers : Dict[str, Sequence[str]]
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      var lazy_function_name : str | None
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      var lazy_only : bool
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      var mode : str
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      var query : Dict[str, Sequence[str]]
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      var raw_body : str
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      Methods

                                                                                      @@ -3686,6 +4892,20 @@

                                                                                      Methods

                                                                                      def to_copyable(self) ‑> BoltRequest
                                                                                      +
                                                                                      + +Expand source code + +
                                                                                      def to_copyable(self) -> "BoltRequest":
                                                                                      +    body: Union[str, dict] = self.raw_body if self.mode == "http" else self.body
                                                                                      +    return BoltRequest(
                                                                                      +        body=body,
                                                                                      +        query=self.query,
                                                                                      +        headers=self.headers,
                                                                                      +        context=self.context.to_copyable(),
                                                                                      +        mode=self.mode,
                                                                                      +    )
                                                                                      +
                                                                                      @@ -3695,16 +4915,6 @@

                                                                                      Methods

                                                                                      (*,
                                                                                      status: int,
                                                                                      body: str | dict = '',
                                                                                      headers: Dict[str, str | Sequence[str]] | None = None)
                                                                                      -

                                                                                      The response from a Bolt app.

                                                                                      -

                                                                                      Args

                                                                                      -
                                                                                      -
                                                                                      status
                                                                                      -
                                                                                      HTTP status code
                                                                                      -
                                                                                      body
                                                                                      -
                                                                                      The response body (dict and str are supported)
                                                                                      -
                                                                                      headers
                                                                                      -
                                                                                      The response headers.
                                                                                      -
                                                                                      Expand source code @@ -3764,19 +4974,29 @@

                                                                                      Args

                                                                                      c.load(header_value) return c
                                                                                      +

                                                                                      The response from a Bolt app.

                                                                                      +

                                                                                      Args

                                                                                      +
                                                                                      +
                                                                                      status
                                                                                      +
                                                                                      HTTP status code
                                                                                      +
                                                                                      body
                                                                                      +
                                                                                      The response body (dict and str are supported)
                                                                                      +
                                                                                      headers
                                                                                      +
                                                                                      The response headers.
                                                                                      +

                                                                                      Class variables

                                                                                      var body : str
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      var headers : Dict[str, Sequence[str]]
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      var status : int
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      Methods

                                                                                      @@ -3785,18 +5005,40 @@

                                                                                      Methods

                                                                                      def cookies(self) ‑> Sequence[http.cookies.SimpleCookie]
                                                                                      +
                                                                                      + +Expand source code + +
                                                                                      def cookies(self) -> Sequence[SimpleCookie]:
                                                                                      +    header_values = self.headers.get("set-cookie", [])
                                                                                      +    return [self._to_simple_cookie(v) for v in header_values]
                                                                                      +
                                                                                      def first_headers(self) ‑> Dict[str, str]
                                                                                      +
                                                                                      + +Expand source code + +
                                                                                      def first_headers(self) -> Dict[str, str]:
                                                                                      +    return {k: list(v)[0] for k, v in self.headers.items()}
                                                                                      +
                                                                                      +
                                                                                      + +Expand source code + +
                                                                                      def first_headers_without_set_cookie(self) -> Dict[str, str]:
                                                                                      +    return {k: list(v)[0] for k, v in self.headers.items() if k != "set-cookie"}
                                                                                      +
                                                                                      @@ -3806,7 +5048,6 @@

                                                                                      Methods

                                                                                      (client: slack_sdk.web.client.WebClient, function_execution_id: str | None)
                                                                                      -
                                                                                      Expand source code @@ -3840,15 +5081,16 @@

                                                                                      Methods

                                                                                      return self.client.functions_completeSuccess(function_execution_id=self.function_execution_id, outputs=outputs or {})
                                                                                      +

                                                                                      Class variables

                                                                                      var client : slack_sdk.web.client.WebClient
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      var function_execution_id : str | None
                                                                                      -
                                                                                      +

                                                                                      The type of the None singleton.

                                                                                      @@ -3857,7 +5099,6 @@

                                                                                      Class variables

                                                                                      (*,
                                                                                      app_name: str,
                                                                                      func: Callable[..., bool],
                                                                                      base_logger: logging.Logger | None = None)
                                                                                      -
                                                                                      Expand source code @@ -3885,6 +5126,7 @@

                                                                                      Class variables

                                                                                      ) )
                                                                                      +

                                                                                      Ancestors

                                                                                      • ListenerMatcher
                                                                                      • @@ -3893,19 +5135,19 @@

                                                                                        Class variables

                                                                                        var app_name : str
                                                                                        -
                                                                                        +

                                                                                        The type of the None singleton.

                                                                                        var arg_names : MutableSequence[str]
                                                                                        -
                                                                                        +

                                                                                        The type of the None singleton.

                                                                                        var func : Callable[..., bool]
                                                                                        -
                                                                                        +

                                                                                        The type of the None singleton.

                                                                                        var logger : logging.Logger
                                                                                        -
                                                                                        +

                                                                                        The type of the None singleton.

                                                                                        Inherited members

                                                                                        @@ -3922,7 +5164,6 @@

                                                                                        Inherited members

                                                                                        (client: slack_sdk.web.client.WebClient, function_execution_id: str | None)
                                                                                        -
                                                                                        Expand source code @@ -3956,24 +5197,24 @@

                                                                                        Inherited members

                                                                                        return self.client.functions_completeError(function_execution_id=self.function_execution_id, error=error)
                                                                                        +

                                                                                        Class variables

                                                                                        var client : slack_sdk.web.client.WebClient
                                                                                        -
                                                                                        +

                                                                                        The type of the None singleton.

                                                                                        var function_execution_id : str | None
                                                                                        -
                                                                                        +

                                                                                        The type of the None singleton.

                                                                                        class FileAssistantThreadContextStore -(base_dir: str = '/Users/kazuhiro.sera/.bolt-app-assistant-thread-contexts') +(base_dir: str = '/Users/wbergamin/.bolt-app-assistant-thread-contexts')
                                                                                        -
                                                                                        Expand source code @@ -4009,6 +5250,7 @@

                                                                                        Class variables

                                                                                        path = Path(path) path.mkdir(parents=True, exist_ok=True)
                                                                                        +

                                                                                        Ancestors

                                                                                        • AssistantThreadContextStore
                                                                                        • @@ -4019,12 +5261,36 @@

                                                                                          Methods

                                                                                          def find(self, *, channel_id: str, thread_ts: str) ‑> AssistantThreadContext | None
                                                                                          +
                                                                                          + +Expand source code + +
                                                                                          def find(self, *, channel_id: str, thread_ts: str) -> Optional[AssistantThreadContext]:
                                                                                          +    path = f"{self.base_dir}/{channel_id}-{thread_ts}.json"
                                                                                          +    try:
                                                                                          +        with open(path) as f:
                                                                                          +            data = json.loads(f.read())
                                                                                          +            if data.get("channel_id") is not None:
                                                                                          +                return AssistantThreadContext(data)
                                                                                          +    except FileNotFoundError:
                                                                                          +        pass
                                                                                          +    return None
                                                                                          +
                                                                                          def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) ‑> None
                                                                                          +
                                                                                          + +Expand source code + +
                                                                                          def save(self, *, channel_id: str, thread_ts: str, context: Dict[str, str]) -> None:
                                                                                          +    path = f"{self.base_dir}/{channel_id}-{thread_ts}.json"
                                                                                          +    with open(path, "w") as f:
                                                                                          +        f.write(json.dumps(context))
                                                                                          +
                                                                                          @@ -4033,7 +5299,6 @@

                                                                                          Methods

                                                                                          class Listener
                                                                                          -
                                                                                          Expand source code @@ -4098,6 +5363,7 @@

                                                                                          Methods

                                                                                          """ raise NotImplementedError()
                                                                                          +

                                                                                          Subclasses

                                                                                          • CustomListener
                                                                                          • @@ -4106,23 +5372,23 @@

                                                                                            Class variables

                                                                                            var ack_function : Callable[..., BoltResponse]
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var auto_acknowledgement : bool
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var lazy_functions : Sequence[Callable[..., None]]
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var matchers : Sequence[ListenerMatcher]
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var middleware : Sequence[Middleware]
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            Methods

                                                                                            @@ -4131,12 +5397,46 @@

                                                                                            Methods

                                                                                            def matches(self,
                                                                                            *,
                                                                                            req: BoltRequest,
                                                                                            resp: BoltResponse) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def matches(
                                                                                            +    self,
                                                                                            +    *,
                                                                                            +    req: BoltRequest,
                                                                                            +    resp: BoltResponse,
                                                                                            +) -> bool:
                                                                                            +    is_matched: bool = False
                                                                                            +    for matcher in self.matchers:
                                                                                            +        is_matched = matcher.matches(req, resp)
                                                                                            +        if not is_matched:
                                                                                            +            return is_matched
                                                                                            +    return is_matched
                                                                                            +
                                                                                            def run_ack_function(self,
                                                                                            *,
                                                                                            request: BoltRequest,
                                                                                            response: BoltResponse) ‑> BoltResponse | None
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            @abstractmethod
                                                                                            +def run_ack_function(self, *, request: BoltRequest, response: BoltResponse) -> Optional[BoltResponse]:
                                                                                            +    """Runs all the registered middleware and then run the listener function.
                                                                                            +
                                                                                            +    Args:
                                                                                            +        request: The incoming request
                                                                                            +        response: The current response
                                                                                            +
                                                                                            +    Returns:
                                                                                            +        The processed response
                                                                                            +    """
                                                                                            +    raise NotImplementedError()
                                                                                            +

                                                                                            Runs all the registered middleware and then run the listener function.

                                                                                            Args

                                                                                            @@ -4152,6 +5452,37 @@

                                                                                            Returns

                                                                                            def run_middleware(self,
                                                                                            *,
                                                                                            req: BoltRequest,
                                                                                            resp: BoltResponse) ‑> Tuple[BoltResponse | None, bool]
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def run_middleware(
                                                                                            +    self,
                                                                                            +    *,
                                                                                            +    req: BoltRequest,
                                                                                            +    resp: BoltResponse,
                                                                                            +) -> Tuple[Optional[BoltResponse], bool]:
                                                                                            +    """Runs a middleware.
                                                                                            +
                                                                                            +    Args:
                                                                                            +        req: The incoming request
                                                                                            +        resp: The current response
                                                                                            +
                                                                                            +    Returns:
                                                                                            +        A tuple of the processed response and a flag indicating termination
                                                                                            +    """
                                                                                            +    for m in self.middleware:
                                                                                            +        middleware_state = {"next_called": False}
                                                                                            +
                                                                                            +        def next_():
                                                                                            +            middleware_state["next_called"] = True
                                                                                            +
                                                                                            +        resp = m.process(req=req, resp=resp, next=next_)  # type: ignore[assignment]
                                                                                            +        if not middleware_state["next_called"]:
                                                                                            +            # next() was not called in this middleware
                                                                                            +            return (resp, True)
                                                                                            +    return (resp, False)
                                                                                            +

                                                                                            Runs a middleware.

                                                                                            Args

                                                                                            @@ -4170,7 +5501,6 @@

                                                                                            Returns

                                                                                            (*,
                                                                                            response_url: str | None,
                                                                                            proxy: str | None = None,
                                                                                            ssl: ssl.SSLContext | None = None)
                                                                                            -
                                                                                            Expand source code @@ -4234,19 +5564,20 @@

                                                                                            Returns

                                                                                            else: raise ValueError("respond is unsupported here as there is no response_url")
                                                                                            +

                                                                                            Class variables

                                                                                            var proxy : str | None
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var response_url : str | None
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var ssl : ssl.SSLContext | None
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            @@ -4255,7 +5586,6 @@

                                                                                            Class variables

                                                                                            (thread_context_store: AssistantThreadContextStore,
                                                                                            channel_id: str,
                                                                                            thread_ts: str)
                                                                                            -
                                                                                            Expand source code @@ -4282,19 +5612,20 @@

                                                                                            Class variables

                                                                                            context=new_context, )
                                                                                            +

                                                                                            Class variables

                                                                                            var channel_id : str
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var thread_context_storeAssistantThreadContextStore
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var thread_ts : str
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            @@ -4303,7 +5634,6 @@

                                                                                            Class variables

                                                                                            (client: slack_sdk.web.client.WebClient | None,
                                                                                            channel: str | None,
                                                                                            thread_ts: str | None = None,
                                                                                            metadata: Dict | slack_sdk.models.metadata.Metadata | None = None,
                                                                                            build_metadata: Callable[[], Dict | slack_sdk.models.metadata.Metadata | None] | None = None)
                                                                                            -
                                                                                            Expand source code @@ -4389,27 +5719,28 @@

                                                                                            Class variables

                                                                                            else: raise ValueError("say without channel_id here is unsupported")
                                                                                            +

                                                                                            Class variables

                                                                                            var build_metadata : Callable[[], Dict | slack_sdk.models.metadata.Metadata | None] | None
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var channel : str | None
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var client : slack_sdk.web.client.WebClient | None
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var metadata : Dict | slack_sdk.models.metadata.Metadata | None
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var thread_ts : str | None
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            @@ -4418,7 +5749,6 @@

                                                                                            Class variables

                                                                                            (client: slack_sdk.web.client.WebClient, channel_id: str, thread_ts: str)
                                                                                            -
                                                                                            Expand source code @@ -4445,19 +5775,20 @@

                                                                                            Class variables

                                                                                            thread_ts=self.thread_ts, )
                                                                                            +

                                                                                            Class variables

                                                                                            var channel_id : str
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var client : slack_sdk.web.client.WebClient
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var thread_ts : str
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            @@ -4466,7 +5797,6 @@

                                                                                            Class variables

                                                                                            (client: slack_sdk.web.client.WebClient, channel_id: str, thread_ts: str)
                                                                                            -
                                                                                            Expand source code @@ -4505,19 +5835,20 @@

                                                                                            Class variables

                                                                                            title=title, )
                                                                                            +

                                                                                            Class variables

                                                                                            var channel_id : str
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var client : slack_sdk.web.client.WebClient
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var thread_ts : str
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            @@ -4526,7 +5857,6 @@

                                                                                            Class variables

                                                                                            (client: slack_sdk.web.client.WebClient, channel_id: str, thread_ts: str)
                                                                                            -
                                                                                            Expand source code @@ -4553,19 +5883,20 @@

                                                                                            Class variables

                                                                                            thread_ts=self.thread_ts, )
                                                                                            +

                                                                                            Class variables

                                                                                            var channel_id : str
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var client : slack_sdk.web.client.WebClient
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var thread_ts : str
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            @@ -4851,7 +6182,7 @@

                                                                                            SetTitle diff --git a/docs/static/api-docs/slack_bolt/kwargs_injection/args.html b/docs/static/api-docs/slack_bolt/kwargs_injection/args.html index ee930282..9d2eb2c4 100644 --- a/docs/static/api-docs/slack_bolt/kwargs_injection/args.html +++ b/docs/static/api-docs/slack_bolt/kwargs_injection/args.html @@ -3,19 +3,30 @@ - + slack_bolt.kwargs_injection.args API documentation - + @@ -40,31 +51,6 @@

                                                                                            Classes

                                                                                            (*,
                                                                                            logger: logging.Logger,
                                                                                            client: slack_sdk.web.client.WebClient,
                                                                                            req: BoltRequest,
                                                                                            resp: BoltResponse,
                                                                                            context: BoltContext,
                                                                                            body: Dict[str, Any],
                                                                                            payload: Dict[str, Any],
                                                                                            options: Dict[str, Any] | None = None,
                                                                                            shortcut: Dict[str, Any] | None = None,
                                                                                            action: Dict[str, Any] | None = None,
                                                                                            view: Dict[str, Any] | None = None,
                                                                                            command: Dict[str, Any] | None = None,
                                                                                            event: Dict[str, Any] | None = None,
                                                                                            message: Dict[str, Any] | None = None,
                                                                                            ack: Ack,
                                                                                            say: Say,
                                                                                            respond: Respond,
                                                                                            complete: Complete,
                                                                                            fail: Fail,
                                                                                            set_status: SetStatus | None = None,
                                                                                            set_title: SetTitle | None = None,
                                                                                            set_suggested_prompts: SetSuggestedPrompts | None = None,
                                                                                            get_thread_context: GetThreadContext | None = None,
                                                                                            save_thread_context: SaveThreadContext | None = None,
                                                                                            next: Callable[[], None],
                                                                                            **kwargs)
                                                                                            -

                                                                                            All the arguments in this class are available in any middleware / listeners. -You can inject the named variables in the argument list in arbitrary order.

                                                                                            -
                                                                                            @app.action("link_button")
                                                                                            -def handle_buttons(ack, respond, logger, context, body, client):
                                                                                            -    logger.info(f"request body: {body}")
                                                                                            -    ack()
                                                                                            -    if context.channel_id is not None:
                                                                                            -        respond("Hi!")
                                                                                            -    client.views_open(
                                                                                            -        trigger_id=body["trigger_id"],
                                                                                            -        view={ ... }
                                                                                            -    )
                                                                                            -
                                                                                            -

                                                                                            Alternatively, you can include a parameter named args and it will be injected with an instance of this class.

                                                                                            -
                                                                                            @app.action("link_button")
                                                                                            -def handle_buttons(args):
                                                                                            -    args.logger.info(f"request body: {args.body}")
                                                                                            -    args.ack()
                                                                                            -    if args.context.channel_id is not None:
                                                                                            -        args.respond("Hi!")
                                                                                            -    args.client.views_open(
                                                                                            -        trigger_id=args.body["trigger_id"],
                                                                                            -        view={ ... }
                                                                                            -    )
                                                                                            -
                                                                                            Expand source code @@ -223,6 +209,31 @@

                                                                                            Classes

                                                                                            self.next: Callable[[], None] = next self.next_: Callable[[], None] = next
                                                                                            +

                                                                                            All the arguments in this class are available in any middleware / listeners. +You can inject the named variables in the argument list in arbitrary order.

                                                                                            +
                                                                                            @app.action("link_button")
                                                                                            +def handle_buttons(ack, respond, logger, context, body, client):
                                                                                            +    logger.info(f"request body: {body}")
                                                                                            +    ack()
                                                                                            +    if context.channel_id is not None:
                                                                                            +        respond("Hi!")
                                                                                            +    client.views_open(
                                                                                            +        trigger_id=body["trigger_id"],
                                                                                            +        view={ ... }
                                                                                            +    )
                                                                                            +
                                                                                            +

                                                                                            Alternatively, you can include a parameter named args and it will be injected with an instance of this class.

                                                                                            +
                                                                                            @app.action("link_button")
                                                                                            +def handle_buttons(args):
                                                                                            +    args.logger.info(f"request body: {args.body}")
                                                                                            +    args.ack()
                                                                                            +    if args.context.channel_id is not None:
                                                                                            +        args.respond("Hi!")
                                                                                            +    args.client.views_open(
                                                                                            +        trigger_id=args.body["trigger_id"],
                                                                                            +        view={ ... }
                                                                                            +    )
                                                                                            +

                                                                                            Class variables

                                                                                            var ackAck
                                                                                            @@ -393,7 +404,7 @@

                                                                                            -

                                                                                            Generated by pdoc 0.11.3.

                                                                                            +

                                                                                            Generated by pdoc 0.11.5.

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/kwargs_injection/async_args.html b/docs/static/api-docs/slack_bolt/kwargs_injection/async_args.html index 97bc4b32..65a14c2d 100644 --- a/docs/static/api-docs/slack_bolt/kwargs_injection/async_args.html +++ b/docs/static/api-docs/slack_bolt/kwargs_injection/async_args.html @@ -3,19 +3,30 @@ - + slack_bolt.kwargs_injection.async_args API documentation - + @@ -40,31 +51,6 @@

                                                                                            Classes

                                                                                            (*,
                                                                                            logger: logging.Logger,
                                                                                            client: slack_sdk.web.async_client.AsyncWebClient,
                                                                                            req: AsyncBoltRequest,
                                                                                            resp: BoltResponse,
                                                                                            context: AsyncBoltContext,
                                                                                            body: Dict[str, Any],
                                                                                            payload: Dict[str, Any],
                                                                                            options: Dict[str, Any] | None = None,
                                                                                            shortcut: Dict[str, Any] | None = None,
                                                                                            action: Dict[str, Any] | None = None,
                                                                                            view: Dict[str, Any] | None = None,
                                                                                            command: Dict[str, Any] | None = None,
                                                                                            event: Dict[str, Any] | None = None,
                                                                                            message: Dict[str, Any] | None = None,
                                                                                            ack: AsyncAck,
                                                                                            say: AsyncSay,
                                                                                            respond: AsyncRespond,
                                                                                            complete: AsyncComplete,
                                                                                            fail: AsyncFail,
                                                                                            set_status: AsyncSetStatus | None = None,
                                                                                            set_title: AsyncSetTitle | None = None,
                                                                                            set_suggested_prompts: AsyncSetSuggestedPrompts | None = None,
                                                                                            get_thread_context: AsyncGetThreadContext | None = None,
                                                                                            save_thread_context: AsyncSaveThreadContext | None = None,
                                                                                            next: Callable[[], Awaitable[None]],
                                                                                            **kwargs)
                                                                                            -

                                                                                            All the arguments in this class are available in any middleware / listeners. -You can inject the named variables in the argument list in arbitrary order.

                                                                                            -
                                                                                            @app.action("link_button")
                                                                                            -async def handle_buttons(ack, respond, logger, context, body, client):
                                                                                            -    logger.info(f"request body: {body}")
                                                                                            -    await ack()
                                                                                            -    if context.channel_id is not None:
                                                                                            -        await respond("Hi!")
                                                                                            -    await client.views_open(
                                                                                            -        trigger_id=body["trigger_id"],
                                                                                            -        view={ ... }
                                                                                            -    )
                                                                                            -
                                                                                            -

                                                                                            Alternatively, you can include a parameter named args and it will be injected with an instance of this class.

                                                                                            -
                                                                                            @app.action("link_button")
                                                                                            -async def handle_buttons(args):
                                                                                            -    args.logger.info(f"request body: {args.body}")
                                                                                            -    await args.ack()
                                                                                            -    if args.context.channel_id is not None:
                                                                                            -        await args.respond("Hi!")
                                                                                            -    await args.client.views_open(
                                                                                            -        trigger_id=args.body["trigger_id"],
                                                                                            -        view={ ... }
                                                                                            -    )
                                                                                            -
                                                                                            Expand source code @@ -220,6 +206,31 @@

                                                                                            Classes

                                                                                            self.next: Callable[[], Awaitable[None]] = next self.next_: Callable[[], Awaitable[None]] = next
                                                                                            +

                                                                                            All the arguments in this class are available in any middleware / listeners. +You can inject the named variables in the argument list in arbitrary order.

                                                                                            +
                                                                                            @app.action("link_button")
                                                                                            +async def handle_buttons(ack, respond, logger, context, body, client):
                                                                                            +    logger.info(f"request body: {body}")
                                                                                            +    await ack()
                                                                                            +    if context.channel_id is not None:
                                                                                            +        await respond("Hi!")
                                                                                            +    await client.views_open(
                                                                                            +        trigger_id=body["trigger_id"],
                                                                                            +        view={ ... }
                                                                                            +    )
                                                                                            +
                                                                                            +

                                                                                            Alternatively, you can include a parameter named args and it will be injected with an instance of this class.

                                                                                            +
                                                                                            @app.action("link_button")
                                                                                            +async def handle_buttons(args):
                                                                                            +    args.logger.info(f"request body: {args.body}")
                                                                                            +    await args.ack()
                                                                                            +    if args.context.channel_id is not None:
                                                                                            +        await args.respond("Hi!")
                                                                                            +    await args.client.views_open(
                                                                                            +        trigger_id=args.body["trigger_id"],
                                                                                            +        view={ ... }
                                                                                            +    )
                                                                                            +

                                                                                            Class variables

                                                                                            var ackAsyncAck
                                                                                            @@ -390,7 +401,7 @@

                                                                                            -

                                                                                            Generated by pdoc 0.11.3.

                                                                                            +

                                                                                            Generated by pdoc 0.11.5.

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/kwargs_injection/async_utils.html b/docs/static/api-docs/slack_bolt/kwargs_injection/async_utils.html index 368050d2..6f433ddc 100644 --- a/docs/static/api-docs/slack_bolt/kwargs_injection/async_utils.html +++ b/docs/static/api-docs/slack_bolt/kwargs_injection/async_utils.html @@ -3,19 +3,30 @@ - + slack_bolt.kwargs_injection.async_utils API documentation - + @@ -37,6 +48,103 @@

                                                                                            Functions

                                                                                            def build_async_required_kwargs(*,
                                                                                            logger: logging.Logger,
                                                                                            required_arg_names: MutableSequence[str],
                                                                                            request: AsyncBoltRequest,
                                                                                            response: BoltResponse | None,
                                                                                            next_func: Callable[[], None] | None = None,
                                                                                            this_func: Callable | None = None,
                                                                                            error: Exception | None = None,
                                                                                            next_keys_required: bool = True) ‑> Dict[str, Any]
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def build_async_required_kwargs(
                                                                                            +    *,
                                                                                            +    logger: logging.Logger,
                                                                                            +    required_arg_names: MutableSequence[str],
                                                                                            +    request: AsyncBoltRequest,
                                                                                            +    response: Optional[BoltResponse],
                                                                                            +    next_func: Optional[Callable[[], None]] = None,
                                                                                            +    this_func: Optional[Callable] = None,
                                                                                            +    error: Optional[Exception] = None,  # for error handlers
                                                                                            +    next_keys_required: bool = True,  # False for listeners / middleware / error handlers
                                                                                            +) -> Dict[str, Any]:
                                                                                            +    all_available_args = {
                                                                                            +        "logger": logger,
                                                                                            +        "client": request.context.client,
                                                                                            +        "req": request,
                                                                                            +        "request": request,
                                                                                            +        "resp": response,
                                                                                            +        "response": response,
                                                                                            +        "context": request.context,
                                                                                            +        "body": request.body,
                                                                                            +        # payload
                                                                                            +        "options": to_options(request.body),
                                                                                            +        "shortcut": to_shortcut(request.body),
                                                                                            +        "action": to_action(request.body),
                                                                                            +        "view": to_view(request.body),
                                                                                            +        "command": to_command(request.body),
                                                                                            +        "event": to_event(request.body),
                                                                                            +        "message": to_message(request.body),
                                                                                            +        "step": to_step(request.body),
                                                                                            +        # utilities
                                                                                            +        "ack": request.context.ack,
                                                                                            +        "say": request.context.say,
                                                                                            +        "respond": request.context.respond,
                                                                                            +        "complete": request.context.complete,
                                                                                            +        "fail": request.context.fail,
                                                                                            +        "set_status": request.context.set_status,
                                                                                            +        "set_title": request.context.set_title,
                                                                                            +        "set_suggested_prompts": request.context.set_suggested_prompts,
                                                                                            +        "get_thread_context": request.context.get_thread_context,
                                                                                            +        "save_thread_context": request.context.save_thread_context,
                                                                                            +        # middleware
                                                                                            +        "next": next_func,
                                                                                            +        "next_": next_func,  # for the middleware using Python's built-in `next()` function
                                                                                            +        # error handler
                                                                                            +        "error": error,  # Exception
                                                                                            +    }
                                                                                            +    if not next_keys_required:
                                                                                            +        all_available_args.pop("next")
                                                                                            +        all_available_args.pop("next_")
                                                                                            +
                                                                                            +    all_available_args["payload"] = (
                                                                                            +        all_available_args["options"]
                                                                                            +        or all_available_args["shortcut"]
                                                                                            +        or all_available_args["action"]
                                                                                            +        or all_available_args["view"]
                                                                                            +        or all_available_args["command"]
                                                                                            +        or all_available_args["event"]
                                                                                            +        or all_available_args["message"]
                                                                                            +        or all_available_args["step"]
                                                                                            +        or request.body
                                                                                            +    )
                                                                                            +    for k, v in request.context.items():
                                                                                            +        if k not in all_available_args:
                                                                                            +            all_available_args[k] = v
                                                                                            +
                                                                                            +    if len(required_arg_names) > 0:
                                                                                            +        # To support instance/class methods in a class for listeners/middleware,
                                                                                            +        # check if the first argument is either self or cls
                                                                                            +        first_arg_name = required_arg_names[0]
                                                                                            +        if first_arg_name in {"self", "cls"}:
                                                                                            +            required_arg_names.pop(0)
                                                                                            +        elif first_arg_name not in all_available_args.keys() and first_arg_name != "args":
                                                                                            +            if this_func is None:
                                                                                            +                logger.warning(warning_skip_uncommon_arg_name(first_arg_name))
                                                                                            +                required_arg_names.pop(0)
                                                                                            +            elif inspect.ismethod(this_func):
                                                                                            +                # We are sure that we should skip manipulating this arg
                                                                                            +                required_arg_names.pop(0)
                                                                                            +
                                                                                            +    kwargs: Dict[str, Any] = {k: v for k, v in all_available_args.items() if k in required_arg_names}
                                                                                            +    found_arg_names = kwargs.keys()
                                                                                            +    for name in required_arg_names:
                                                                                            +        if name == "args":
                                                                                            +            if isinstance(request, AsyncBoltRequest):
                                                                                            +                kwargs[name] = AsyncArgs(**all_available_args)  # type: ignore[arg-type]
                                                                                            +            else:
                                                                                            +                logger.warning(f"Unknown Request object type detected ({type(request)})")
                                                                                            +
                                                                                            +        elif name not in found_arg_names:
                                                                                            +            logger.warning(f"{name} is not a valid argument")
                                                                                            +            kwargs[name] = None
                                                                                            +    return kwargs
                                                                                            +

                                                                                            @@ -63,7 +171,7 @@

                                                                                            Functions

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/kwargs_injection/index.html b/docs/static/api-docs/slack_bolt/kwargs_injection/index.html index 850be483..4132bbab 100644 --- a/docs/static/api-docs/slack_bolt/kwargs_injection/index.html +++ b/docs/static/api-docs/slack_bolt/kwargs_injection/index.html @@ -3,19 +3,30 @@ - + slack_bolt.kwargs_injection API documentation - + @@ -59,6 +70,102 @@

                                                                                            Functions

                                                                                            def build_required_kwargs(*,
                                                                                            logger: logging.Logger,
                                                                                            required_arg_names: MutableSequence[str],
                                                                                            request: BoltRequest,
                                                                                            response: BoltResponse | None,
                                                                                            next_func: Callable[[], None] | None = None,
                                                                                            this_func: Callable | None = None,
                                                                                            error: Exception | None = None,
                                                                                            next_keys_required: bool = True) ‑> Dict[str, Any]
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def build_required_kwargs(
                                                                                            +    *,
                                                                                            +    logger: logging.Logger,
                                                                                            +    required_arg_names: MutableSequence[str],
                                                                                            +    request: BoltRequest,
                                                                                            +    response: Optional[BoltResponse],
                                                                                            +    next_func: Optional[Callable[[], None]] = None,
                                                                                            +    this_func: Optional[Callable] = None,
                                                                                            +    error: Optional[Exception] = None,  # for error handlers
                                                                                            +    next_keys_required: bool = True,  # False for listeners / middleware / error handlers
                                                                                            +) -> Dict[str, Any]:
                                                                                            +    all_available_args = {
                                                                                            +        "logger": logger,
                                                                                            +        "client": request.context.client,
                                                                                            +        "req": request,
                                                                                            +        "request": request,
                                                                                            +        "resp": response,
                                                                                            +        "response": response,
                                                                                            +        "context": request.context,
                                                                                            +        # payload
                                                                                            +        "body": request.body,
                                                                                            +        "options": to_options(request.body),
                                                                                            +        "shortcut": to_shortcut(request.body),
                                                                                            +        "action": to_action(request.body),
                                                                                            +        "view": to_view(request.body),
                                                                                            +        "command": to_command(request.body),
                                                                                            +        "event": to_event(request.body),
                                                                                            +        "message": to_message(request.body),
                                                                                            +        "step": to_step(request.body),
                                                                                            +        # utilities
                                                                                            +        "ack": request.context.ack,
                                                                                            +        "say": request.context.say,
                                                                                            +        "respond": request.context.respond,
                                                                                            +        "complete": request.context.complete,
                                                                                            +        "fail": request.context.fail,
                                                                                            +        "set_status": request.context.set_status,
                                                                                            +        "set_title": request.context.set_title,
                                                                                            +        "set_suggested_prompts": request.context.set_suggested_prompts,
                                                                                            +        "save_thread_context": request.context.save_thread_context,
                                                                                            +        # middleware
                                                                                            +        "next": next_func,
                                                                                            +        "next_": next_func,  # for the middleware using Python's built-in `next()` function
                                                                                            +        # error handler
                                                                                            +        "error": error,  # Exception
                                                                                            +    }
                                                                                            +    if not next_keys_required:
                                                                                            +        all_available_args.pop("next")
                                                                                            +        all_available_args.pop("next_")
                                                                                            +
                                                                                            +    all_available_args["payload"] = (
                                                                                            +        all_available_args["options"]
                                                                                            +        or all_available_args["shortcut"]
                                                                                            +        or all_available_args["action"]
                                                                                            +        or all_available_args["view"]
                                                                                            +        or all_available_args["command"]
                                                                                            +        or all_available_args["event"]
                                                                                            +        or all_available_args["message"]
                                                                                            +        or all_available_args["step"]
                                                                                            +        or request.body
                                                                                            +    )
                                                                                            +    for k, v in request.context.items():
                                                                                            +        if k not in all_available_args:
                                                                                            +            all_available_args[k] = v
                                                                                            +
                                                                                            +    if len(required_arg_names) > 0:
                                                                                            +        # To support instance/class methods in a class for listeners/middleware,
                                                                                            +        # check if the first argument is either self or cls
                                                                                            +        first_arg_name = required_arg_names[0]
                                                                                            +        if first_arg_name in {"self", "cls"}:
                                                                                            +            required_arg_names.pop(0)
                                                                                            +        elif first_arg_name not in all_available_args.keys() and first_arg_name != "args":
                                                                                            +            if this_func is None:
                                                                                            +                logger.warning(warning_skip_uncommon_arg_name(first_arg_name))
                                                                                            +                required_arg_names.pop(0)
                                                                                            +            elif inspect.ismethod(this_func):
                                                                                            +                # We are sure that we should skip manipulating this arg
                                                                                            +                required_arg_names.pop(0)
                                                                                            +
                                                                                            +    kwargs: Dict[str, Any] = {k: v for k, v in all_available_args.items() if k in required_arg_names}
                                                                                            +    found_arg_names = kwargs.keys()
                                                                                            +    for name in required_arg_names:
                                                                                            +        if name == "args":
                                                                                            +            if isinstance(request, BoltRequest):
                                                                                            +                kwargs[name] = Args(**all_available_args)  # type: ignore[arg-type]
                                                                                            +            else:
                                                                                            +                logger.warning(f"Unknown Request object type detected ({type(request)})")
                                                                                            +
                                                                                            +        elif name not in found_arg_names:
                                                                                            +            logger.warning(f"{name} is not a valid argument")
                                                                                            +            kwargs[name] = None
                                                                                            +    return kwargs
                                                                                            +

                                                                                            @@ -71,31 +178,6 @@

                                                                                            Classes

                                                                                            (*,
                                                                                            logger: logging.Logger,
                                                                                            client: slack_sdk.web.client.WebClient,
                                                                                            req: BoltRequest,
                                                                                            resp: BoltResponse,
                                                                                            context: BoltContext,
                                                                                            body: Dict[str, Any],
                                                                                            payload: Dict[str, Any],
                                                                                            options: Dict[str, Any] | None = None,
                                                                                            shortcut: Dict[str, Any] | None = None,
                                                                                            action: Dict[str, Any] | None = None,
                                                                                            view: Dict[str, Any] | None = None,
                                                                                            command: Dict[str, Any] | None = None,
                                                                                            event: Dict[str, Any] | None = None,
                                                                                            message: Dict[str, Any] | None = None,
                                                                                            ack: Ack,
                                                                                            say: Say,
                                                                                            respond: Respond,
                                                                                            complete: Complete,
                                                                                            fail: Fail,
                                                                                            set_status: SetStatus | None = None,
                                                                                            set_title: SetTitle | None = None,
                                                                                            set_suggested_prompts: SetSuggestedPrompts | None = None,
                                                                                            get_thread_context: GetThreadContext | None = None,
                                                                                            save_thread_context: SaveThreadContext | None = None,
                                                                                            next: Callable[[], None],
                                                                                            **kwargs)
                                                                                            -

                                                                                            All the arguments in this class are available in any middleware / listeners. -You can inject the named variables in the argument list in arbitrary order.

                                                                                            -
                                                                                            @app.action("link_button")
                                                                                            -def handle_buttons(ack, respond, logger, context, body, client):
                                                                                            -    logger.info(f"request body: {body}")
                                                                                            -    ack()
                                                                                            -    if context.channel_id is not None:
                                                                                            -        respond("Hi!")
                                                                                            -    client.views_open(
                                                                                            -        trigger_id=body["trigger_id"],
                                                                                            -        view={ ... }
                                                                                            -    )
                                                                                            -
                                                                                            -

                                                                                            Alternatively, you can include a parameter named slack_bolt.kwargs_injection.args and it will be injected with an instance of this class.

                                                                                            -
                                                                                            @app.action("link_button")
                                                                                            -def handle_buttons(args):
                                                                                            -    args.logger.info(f"request body: {args.body}")
                                                                                            -    args.ack()
                                                                                            -    if args.context.channel_id is not None:
                                                                                            -        args.respond("Hi!")
                                                                                            -    args.client.views_open(
                                                                                            -        trigger_id=args.body["trigger_id"],
                                                                                            -        view={ ... }
                                                                                            -    )
                                                                                            -
                                                                                            Expand source code @@ -254,6 +336,31 @@

                                                                                            Classes

                                                                                            self.next: Callable[[], None] = next self.next_: Callable[[], None] = next
                                                                                            +

                                                                                            All the arguments in this class are available in any middleware / listeners. +You can inject the named variables in the argument list in arbitrary order.

                                                                                            +
                                                                                            @app.action("link_button")
                                                                                            +def handle_buttons(ack, respond, logger, context, body, client):
                                                                                            +    logger.info(f"request body: {body}")
                                                                                            +    ack()
                                                                                            +    if context.channel_id is not None:
                                                                                            +        respond("Hi!")
                                                                                            +    client.views_open(
                                                                                            +        trigger_id=body["trigger_id"],
                                                                                            +        view={ ... }
                                                                                            +    )
                                                                                            +
                                                                                            +

                                                                                            Alternatively, you can include a parameter named slack_bolt.kwargs_injection.args and it will be injected with an instance of this class.

                                                                                            +
                                                                                            @app.action("link_button")
                                                                                            +def handle_buttons(args):
                                                                                            +    args.logger.info(f"request body: {args.body}")
                                                                                            +    args.ack()
                                                                                            +    if args.context.channel_id is not None:
                                                                                            +        args.respond("Hi!")
                                                                                            +    args.client.views_open(
                                                                                            +        trigger_id=args.body["trigger_id"],
                                                                                            +        view={ ... }
                                                                                            +    )
                                                                                            +

                                                                                            Class variables

                                                                                            var ackAck
                                                                                            @@ -437,7 +544,7 @@

                                                                                            -

                                                                                            Generated by pdoc 0.11.3.

                                                                                            +

                                                                                            Generated by pdoc 0.11.5.

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/kwargs_injection/utils.html b/docs/static/api-docs/slack_bolt/kwargs_injection/utils.html index b5412827..a589350c 100644 --- a/docs/static/api-docs/slack_bolt/kwargs_injection/utils.html +++ b/docs/static/api-docs/slack_bolt/kwargs_injection/utils.html @@ -3,19 +3,30 @@ - + slack_bolt.kwargs_injection.utils API documentation - + @@ -37,6 +48,102 @@

                                                                                            Functions

                                                                                            def build_required_kwargs(*,
                                                                                            logger: logging.Logger,
                                                                                            required_arg_names: MutableSequence[str],
                                                                                            request: BoltRequest,
                                                                                            response: BoltResponse | None,
                                                                                            next_func: Callable[[], None] | None = None,
                                                                                            this_func: Callable | None = None,
                                                                                            error: Exception | None = None,
                                                                                            next_keys_required: bool = True) ‑> Dict[str, Any]
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def build_required_kwargs(
                                                                                            +    *,
                                                                                            +    logger: logging.Logger,
                                                                                            +    required_arg_names: MutableSequence[str],
                                                                                            +    request: BoltRequest,
                                                                                            +    response: Optional[BoltResponse],
                                                                                            +    next_func: Optional[Callable[[], None]] = None,
                                                                                            +    this_func: Optional[Callable] = None,
                                                                                            +    error: Optional[Exception] = None,  # for error handlers
                                                                                            +    next_keys_required: bool = True,  # False for listeners / middleware / error handlers
                                                                                            +) -> Dict[str, Any]:
                                                                                            +    all_available_args = {
                                                                                            +        "logger": logger,
                                                                                            +        "client": request.context.client,
                                                                                            +        "req": request,
                                                                                            +        "request": request,
                                                                                            +        "resp": response,
                                                                                            +        "response": response,
                                                                                            +        "context": request.context,
                                                                                            +        # payload
                                                                                            +        "body": request.body,
                                                                                            +        "options": to_options(request.body),
                                                                                            +        "shortcut": to_shortcut(request.body),
                                                                                            +        "action": to_action(request.body),
                                                                                            +        "view": to_view(request.body),
                                                                                            +        "command": to_command(request.body),
                                                                                            +        "event": to_event(request.body),
                                                                                            +        "message": to_message(request.body),
                                                                                            +        "step": to_step(request.body),
                                                                                            +        # utilities
                                                                                            +        "ack": request.context.ack,
                                                                                            +        "say": request.context.say,
                                                                                            +        "respond": request.context.respond,
                                                                                            +        "complete": request.context.complete,
                                                                                            +        "fail": request.context.fail,
                                                                                            +        "set_status": request.context.set_status,
                                                                                            +        "set_title": request.context.set_title,
                                                                                            +        "set_suggested_prompts": request.context.set_suggested_prompts,
                                                                                            +        "save_thread_context": request.context.save_thread_context,
                                                                                            +        # middleware
                                                                                            +        "next": next_func,
                                                                                            +        "next_": next_func,  # for the middleware using Python's built-in `next()` function
                                                                                            +        # error handler
                                                                                            +        "error": error,  # Exception
                                                                                            +    }
                                                                                            +    if not next_keys_required:
                                                                                            +        all_available_args.pop("next")
                                                                                            +        all_available_args.pop("next_")
                                                                                            +
                                                                                            +    all_available_args["payload"] = (
                                                                                            +        all_available_args["options"]
                                                                                            +        or all_available_args["shortcut"]
                                                                                            +        or all_available_args["action"]
                                                                                            +        or all_available_args["view"]
                                                                                            +        or all_available_args["command"]
                                                                                            +        or all_available_args["event"]
                                                                                            +        or all_available_args["message"]
                                                                                            +        or all_available_args["step"]
                                                                                            +        or request.body
                                                                                            +    )
                                                                                            +    for k, v in request.context.items():
                                                                                            +        if k not in all_available_args:
                                                                                            +            all_available_args[k] = v
                                                                                            +
                                                                                            +    if len(required_arg_names) > 0:
                                                                                            +        # To support instance/class methods in a class for listeners/middleware,
                                                                                            +        # check if the first argument is either self or cls
                                                                                            +        first_arg_name = required_arg_names[0]
                                                                                            +        if first_arg_name in {"self", "cls"}:
                                                                                            +            required_arg_names.pop(0)
                                                                                            +        elif first_arg_name not in all_available_args.keys() and first_arg_name != "args":
                                                                                            +            if this_func is None:
                                                                                            +                logger.warning(warning_skip_uncommon_arg_name(first_arg_name))
                                                                                            +                required_arg_names.pop(0)
                                                                                            +            elif inspect.ismethod(this_func):
                                                                                            +                # We are sure that we should skip manipulating this arg
                                                                                            +                required_arg_names.pop(0)
                                                                                            +
                                                                                            +    kwargs: Dict[str, Any] = {k: v for k, v in all_available_args.items() if k in required_arg_names}
                                                                                            +    found_arg_names = kwargs.keys()
                                                                                            +    for name in required_arg_names:
                                                                                            +        if name == "args":
                                                                                            +            if isinstance(request, BoltRequest):
                                                                                            +                kwargs[name] = Args(**all_available_args)  # type: ignore[arg-type]
                                                                                            +            else:
                                                                                            +                logger.warning(f"Unknown Request object type detected ({type(request)})")
                                                                                            +
                                                                                            +        elif name not in found_arg_names:
                                                                                            +            logger.warning(f"{name} is not a valid argument")
                                                                                            +            kwargs[name] = None
                                                                                            +    return kwargs
                                                                                            +

                                                                                            @@ -63,7 +170,7 @@

                                                                                            Functions

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/lazy_listener/async_internals.html b/docs/static/api-docs/slack_bolt/lazy_listener/async_internals.html index f1c66f36..19becac1 100644 --- a/docs/static/api-docs/slack_bolt/lazy_listener/async_internals.html +++ b/docs/static/api-docs/slack_bolt/lazy_listener/async_internals.html @@ -3,19 +3,30 @@ - + slack_bolt.lazy_listener.async_internals API documentation - + @@ -37,6 +48,34 @@

                                                                                            Functions

                                                                                            async def to_runnable_function(internal_func: Callable[..., Awaitable[None]],
                                                                                            logger: logging.Logger,
                                                                                            request: AsyncBoltRequest)
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            async def to_runnable_function(
                                                                                            +    internal_func: Callable[..., Awaitable[None]],
                                                                                            +    logger: Logger,
                                                                                            +    request: AsyncBoltRequest,
                                                                                            +):
                                                                                            +    arg_names = get_arg_names_of_callable(internal_func)
                                                                                            +
                                                                                            +    @wraps(internal_func)
                                                                                            +    async def request_wired_wrapper() -> None:
                                                                                            +        try:
                                                                                            +            await internal_func(
                                                                                            +                **build_async_required_kwargs(
                                                                                            +                    logger=logger,
                                                                                            +                    required_arg_names=arg_names,
                                                                                            +                    request=request,
                                                                                            +                    response=None,
                                                                                            +                    this_func=internal_func,
                                                                                            +                )
                                                                                            +            )
                                                                                            +        except Exception as e:
                                                                                            +            logger.error(f"Failed to run an internal function ({e})")
                                                                                            +
                                                                                            +    return await request_wired_wrapper()
                                                                                            +

                                                                                            @@ -63,7 +102,7 @@

                                                                                            Functions

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/lazy_listener/async_runner.html b/docs/static/api-docs/slack_bolt/lazy_listener/async_runner.html index 32b2fec7..e58b0a04 100644 --- a/docs/static/api-docs/slack_bolt/lazy_listener/async_runner.html +++ b/docs/static/api-docs/slack_bolt/lazy_listener/async_runner.html @@ -3,19 +3,30 @@ - + slack_bolt.lazy_listener.async_runner API documentation - + @@ -39,7 +50,6 @@

                                                                                            Classes

                                                                                            class AsyncLazyListenerRunner
                                                                                            -
                                                                                            Expand source code @@ -71,6 +81,7 @@

                                                                                            Classes

                                                                                            ) return await func() # type: ignore[operator]
                                                                                            +

                                                                                            Subclasses

                                                                                            • AsyncioLazyListenerRunner
                                                                                            • @@ -79,7 +90,7 @@

                                                                                              Class variables

                                                                                              var logger : logging.Logger
                                                                                              -
                                                                                              +

                                                                                              The type of the None singleton.

                                                                                              Methods

                                                                                              @@ -88,6 +99,24 @@

                                                                                              Methods

                                                                                              async def run(self,
                                                                                              function: Callable[..., Awaitable[None]],
                                                                                              request: AsyncBoltRequest) ‑> None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              async def run(self, function: Callable[..., Awaitable[None]], request: AsyncBoltRequest) -> None:
                                                                                              +    """Synchronously run the function with a given request data.
                                                                                              +
                                                                                              +    Args:
                                                                                              +        function: The function to run.
                                                                                              +        request: The request to pass to the function. The object must be thread-safe.
                                                                                              +    """
                                                                                              +    func = to_runnable_function(
                                                                                              +        internal_func=function,
                                                                                              +        logger=self.logger,
                                                                                              +        request=request,
                                                                                              +    )
                                                                                              +    return await func()  # type: ignore[operator]
                                                                                              +

                                                                                              Synchronously run the function with a given request data.

                                                                                              Args

                                                                                              @@ -101,6 +130,20 @@

                                                                                              Args

                                                                                              def start(self,
                                                                                              function: Callable[..., Awaitable[None]],
                                                                                              request: AsyncBoltRequest) ‑> None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              @abstractmethod
                                                                                              +def start(self, function: Callable[..., Awaitable[None]], request: AsyncBoltRequest) -> None:
                                                                                              +    """Starts a new lazy listener execution.
                                                                                              +
                                                                                              +    Args:
                                                                                              +        function: The function to run.
                                                                                              +        request: The request to pass to the function. The object must be thread-safe.
                                                                                              +    """
                                                                                              +    raise NotImplementedError()
                                                                                              +

                                                                                              Starts a new lazy listener execution.

                                                                                              Args

                                                                                              @@ -141,7 +184,7 @@

                                                                                              -

                                                                                              Generated by pdoc 0.11.3.

                                                                                              +

                                                                                              Generated by pdoc 0.11.5.

                                                                                              diff --git a/docs/static/api-docs/slack_bolt/lazy_listener/asyncio_runner.html b/docs/static/api-docs/slack_bolt/lazy_listener/asyncio_runner.html index 562e2457..d05a4c9a 100644 --- a/docs/static/api-docs/slack_bolt/lazy_listener/asyncio_runner.html +++ b/docs/static/api-docs/slack_bolt/lazy_listener/asyncio_runner.html @@ -3,19 +3,30 @@ - + slack_bolt.lazy_listener.asyncio_runner API documentation - + @@ -40,7 +51,6 @@

                                                                                              Classes

                                                                                              (logger: logging.Logger)
                                                                                              -
                                                                                              Expand source code @@ -63,21 +73,16 @@

                                                                                              Classes

                                                                                              ) )
                                                                                              +

                                                                                              Ancestors

                                                                                              -

                                                                                              Class variables

                                                                                              -
                                                                                              -
                                                                                              var logger : logging.Logger
                                                                                              -
                                                                                              -
                                                                                              -
                                                                                              -

                                                                                              Inherited members

                                                                                              • AsyncLazyListenerRunner: @@ -101,9 +106,6 @@

                                                                                                Inherited members

                                                                                              • @@ -111,7 +113,7 @@

                                                                                                -

                                                                                                Generated by pdoc 0.11.3.

                                                                                                +

                                                                                                Generated by pdoc 0.11.5.

                                                                                                diff --git a/docs/static/api-docs/slack_bolt/lazy_listener/index.html b/docs/static/api-docs/slack_bolt/lazy_listener/index.html index d7c866b2..374164af 100644 --- a/docs/static/api-docs/slack_bolt/lazy_listener/index.html +++ b/docs/static/api-docs/slack_bolt/lazy_listener/index.html @@ -3,19 +3,30 @@ - + slack_bolt.lazy_listener API documentation - + @@ -87,7 +98,6 @@

                                                                                                Classes

                                                                                                class LazyListenerRunner
                                                                                                -
                                                                                                Expand source code @@ -118,6 +128,7 @@

                                                                                                Classes

                                                                                                request=request, )()
                                                                                                +

                                                                                                Subclasses

                                                                                                • ChaliceLazyListenerRunner
                                                                                                • @@ -129,7 +140,7 @@

                                                                                                  Class variables

                                                                                                  var logger : logging.Logger
                                                                                                  -
                                                                                                  +

                                                                                                  The type of the None singleton.

                                                                                                  Methods

                                                                                                  @@ -138,6 +149,23 @@

                                                                                                  Methods

                                                                                                  def run(self,
                                                                                                  function: Callable[..., None],
                                                                                                  request: BoltRequest) ‑> None
                                                                                                  +
                                                                                                  + +Expand source code + +
                                                                                                  def run(self, function: Callable[..., None], request: BoltRequest) -> None:
                                                                                                  +    """Synchronously runs the function with a given request data.
                                                                                                  +
                                                                                                  +    Args:
                                                                                                  +        function: The function to run.
                                                                                                  +        request: The request to pass to the function. The object must be thread-safe.
                                                                                                  +    """
                                                                                                  +    build_runnable_function(
                                                                                                  +        func=function,
                                                                                                  +        logger=self.logger,
                                                                                                  +        request=request,
                                                                                                  +    )()
                                                                                                  +

                                                                                                  Synchronously runs the function with a given request data.

                                                                                                  Args

                                                                                                  @@ -151,6 +179,20 @@

                                                                                                  Args

                                                                                                  def start(self,
                                                                                                  function: Callable[..., None],
                                                                                                  request: BoltRequest) ‑> None
                                                                                                  +
                                                                                                  + +Expand source code + +
                                                                                                  @abstractmethod
                                                                                                  +def start(self, function: Callable[..., None], request: BoltRequest) -> None:
                                                                                                  +    """Starts a new lazy listener execution.
                                                                                                  +
                                                                                                  +    Args:
                                                                                                  +        function: The function to run.
                                                                                                  +        request: The request to pass to the function. The object must be thread-safe.
                                                                                                  +    """
                                                                                                  +    raise NotImplementedError()
                                                                                                  +

                                                                                                  Starts a new lazy listener execution.

                                                                                                  Args

                                                                                                  @@ -167,7 +209,6 @@

                                                                                                  Args

                                                                                                  (logger: logging.Logger, executor: concurrent.futures._base.Executor)
                                                                                                  -
                                                                                                  Expand source code @@ -192,6 +233,7 @@

                                                                                                  Args

                                                                                                  ) )
                                                                                                  +

                                                                                                  Ancestors

                                                                                                  • LazyListenerRunner
                                                                                                  • @@ -200,17 +242,11 @@

                                                                                                    Subclasses

                                                                                                    -

                                                                                                    Class variables

                                                                                                    -
                                                                                                    -
                                                                                                    var logger : logging.Logger
                                                                                                    -
                                                                                                    -
                                                                                                    -
                                                                                                    -

                                                                                                    Inherited members

                                                                                                    @@ -262,7 +295,7 @@

                                                                                                    -

                                                                                                    Generated by pdoc 0.11.3.

                                                                                                    +

                                                                                                    Generated by pdoc 0.11.5.

                                                                                                    diff --git a/docs/static/api-docs/slack_bolt/lazy_listener/internals.html b/docs/static/api-docs/slack_bolt/lazy_listener/internals.html index 32e7c59f..96c04a56 100644 --- a/docs/static/api-docs/slack_bolt/lazy_listener/internals.html +++ b/docs/static/api-docs/slack_bolt/lazy_listener/internals.html @@ -3,19 +3,30 @@ - + slack_bolt.lazy_listener.internals API documentation - + @@ -37,6 +48,34 @@

                                                                                                    Functions

                                                                                                    def build_runnable_function(func: Callable[..., None],
                                                                                                    logger: logging.Logger,
                                                                                                    request: BoltRequest) ‑> Callable[[], None]
                                                                                                    +
                                                                                                    + +Expand source code + +
                                                                                                    def build_runnable_function(
                                                                                                    +    func: Callable[..., None],
                                                                                                    +    logger: Logger,
                                                                                                    +    request: BoltRequest,
                                                                                                    +) -> Callable[[], None]:
                                                                                                    +    arg_names = get_arg_names_of_callable(func)
                                                                                                    +
                                                                                                    +    @wraps(func)
                                                                                                    +    def request_wired_func_wrapper() -> None:
                                                                                                    +        try:
                                                                                                    +            func(
                                                                                                    +                **build_required_kwargs(
                                                                                                    +                    logger=logger,
                                                                                                    +                    required_arg_names=arg_names,
                                                                                                    +                    request=request,
                                                                                                    +                    response=None,
                                                                                                    +                    this_func=func,
                                                                                                    +                )
                                                                                                    +            )
                                                                                                    +        except Exception as e:
                                                                                                    +            logger.error(f"Failed to run an internal function ({e})")
                                                                                                    +
                                                                                                    +    return request_wired_func_wrapper
                                                                                                    +

                                                                                                  @@ -63,7 +102,7 @@

                                                                                                  Functions

                                                                                                  diff --git a/docs/static/api-docs/slack_bolt/lazy_listener/runner.html b/docs/static/api-docs/slack_bolt/lazy_listener/runner.html index 6db47413..56216c9c 100644 --- a/docs/static/api-docs/slack_bolt/lazy_listener/runner.html +++ b/docs/static/api-docs/slack_bolt/lazy_listener/runner.html @@ -3,19 +3,30 @@ - + slack_bolt.lazy_listener.runner API documentation - + @@ -39,7 +50,6 @@

                                                                                                  Classes

                                                                                                  class LazyListenerRunner
                                                                                                  -
                                                                                                  Expand source code @@ -70,6 +80,7 @@

                                                                                                  Classes

                                                                                                  request=request, )()
                                                                                                  +

                                                                                                  Subclasses

                                                                                                  • ChaliceLazyListenerRunner
                                                                                                  • @@ -81,7 +92,7 @@

                                                                                                    Class variables

                                                                                                    var logger : logging.Logger
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    Methods

                                                                                                    @@ -90,6 +101,23 @@

                                                                                                    Methods

                                                                                                    def run(self,
                                                                                                    function: Callable[..., None],
                                                                                                    request: BoltRequest) ‑> None
                                                                                                    +
                                                                                                    + +Expand source code + +
                                                                                                    def run(self, function: Callable[..., None], request: BoltRequest) -> None:
                                                                                                    +    """Synchronously runs the function with a given request data.
                                                                                                    +
                                                                                                    +    Args:
                                                                                                    +        function: The function to run.
                                                                                                    +        request: The request to pass to the function. The object must be thread-safe.
                                                                                                    +    """
                                                                                                    +    build_runnable_function(
                                                                                                    +        func=function,
                                                                                                    +        logger=self.logger,
                                                                                                    +        request=request,
                                                                                                    +    )()
                                                                                                    +

                                                                                                    Synchronously runs the function with a given request data.

                                                                                                    Args

                                                                                                    @@ -103,6 +131,20 @@

                                                                                                    Args

                                                                                                    def start(self,
                                                                                                    function: Callable[..., None],
                                                                                                    request: BoltRequest) ‑> None
                                                                                                    +
                                                                                                    + +Expand source code + +
                                                                                                    @abstractmethod
                                                                                                    +def start(self, function: Callable[..., None], request: BoltRequest) -> None:
                                                                                                    +    """Starts a new lazy listener execution.
                                                                                                    +
                                                                                                    +    Args:
                                                                                                    +        function: The function to run.
                                                                                                    +        request: The request to pass to the function. The object must be thread-safe.
                                                                                                    +    """
                                                                                                    +    raise NotImplementedError()
                                                                                                    +

                                                                                                    Starts a new lazy listener execution.

                                                                                                    Args

                                                                                                    @@ -143,7 +185,7 @@

                                                                                                    -

                                                                                                    Generated by pdoc 0.11.3.

                                                                                                    +

                                                                                                    Generated by pdoc 0.11.5.

                                                                                                    diff --git a/docs/static/api-docs/slack_bolt/lazy_listener/thread_runner.html b/docs/static/api-docs/slack_bolt/lazy_listener/thread_runner.html index d0b69e6d..19e6ff29 100644 --- a/docs/static/api-docs/slack_bolt/lazy_listener/thread_runner.html +++ b/docs/static/api-docs/slack_bolt/lazy_listener/thread_runner.html @@ -3,19 +3,30 @@ - + slack_bolt.lazy_listener.thread_runner API documentation - + @@ -40,7 +51,6 @@

                                                                                                    Classes

                                                                                                    (logger: logging.Logger, executor: concurrent.futures._base.Executor)
                                                                                                    -
                                                                                                    Expand source code @@ -65,6 +75,7 @@

                                                                                                    Classes

                                                                                                    ) )
                                                                                                    +

                                                                                                    Ancestors

                                                                                                    • LazyListenerRunner
                                                                                                    • @@ -73,17 +84,11 @@

                                                                                                      Subclasses

                                                                                                      -

                                                                                                      Class variables

                                                                                                      -
                                                                                                      -
                                                                                                      var logger : logging.Logger
                                                                                                      -
                                                                                                      -
                                                                                                      -
                                                                                                      -

                                                                                                      Inherited members

                                                                                                      • LazyListenerRunner: @@ -107,9 +112,6 @@

                                                                                                        Inherited members

                                                                                                      • @@ -117,7 +119,7 @@

                                                                                                        -

                                                                                                        Generated by pdoc 0.11.3.

                                                                                                        +

                                                                                                        Generated by pdoc 0.11.5.

                                                                                                        diff --git a/docs/static/api-docs/slack_bolt/listener/async_builtins.html b/docs/static/api-docs/slack_bolt/listener/async_builtins.html index d4aa05a7..61e6fcd9 100644 --- a/docs/static/api-docs/slack_bolt/listener/async_builtins.html +++ b/docs/static/api-docs/slack_bolt/listener/async_builtins.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.async_builtins API documentation - + @@ -40,7 +51,6 @@

                                                                                                        Classes

                                                                                                        (installation_store: slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore)
                                                                                                        -

                                                                                                        Listener functions to handle token revocation / uninstallation events

                                                                                                        Expand source code @@ -75,11 +85,12 @@

                                                                                                        Classes

                                                                                                        team_id=context.team_id, )
                                                                                                        +

                                                                                                        Listener functions to handle token revocation / uninstallation events

                                                                                                        Class variables

                                                                                                        var installation_store : slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore
                                                                                                        -
                                                                                                        +

                                                                                                        The type of the None singleton.

                                                                                                        Methods

                                                                                                        @@ -88,12 +99,42 @@

                                                                                                        Methods

                                                                                                        async def handle_app_uninstalled_events(self,
                                                                                                        context: AsyncBoltContext) ‑> None
                                                                                                        +
                                                                                                        + +Expand source code + +
                                                                                                        async def handle_app_uninstalled_events(self, context: AsyncBoltContext) -> None:
                                                                                                        +    await self.installation_store.async_delete_all(
                                                                                                        +        enterprise_id=context.enterprise_id,
                                                                                                        +        team_id=context.team_id,
                                                                                                        +    )
                                                                                                        +
                                                                                                        async def handle_tokens_revoked_events(self,
                                                                                                        event: dict,
                                                                                                        context: AsyncBoltContext) ‑> None
                                                                                                        +
                                                                                                        + +Expand source code + +
                                                                                                        async def handle_tokens_revoked_events(self, event: dict, context: AsyncBoltContext) -> None:
                                                                                                        +    user_ids = event.get("tokens", {}).get("oauth", [])
                                                                                                        +    if len(user_ids) > 0:
                                                                                                        +        for user_id in user_ids:
                                                                                                        +            await self.installation_store.async_delete_installation(
                                                                                                        +                enterprise_id=context.enterprise_id,
                                                                                                        +                team_id=context.team_id,
                                                                                                        +                user_id=user_id,
                                                                                                        +            )
                                                                                                        +    bots = event.get("tokens", {}).get("bot", [])
                                                                                                        +    if len(bots) > 0:
                                                                                                        +        await self.installation_store.async_delete_bot(
                                                                                                        +            enterprise_id=context.enterprise_id,
                                                                                                        +            team_id=context.team_id,
                                                                                                        +        )
                                                                                                        +

                                                                                                    @@ -127,7 +168,7 @@

                                                                                                    -

                                                                                                    Generated by pdoc 0.11.3.

                                                                                                    +

                                                                                                    Generated by pdoc 0.11.5.

                                                                                                    diff --git a/docs/static/api-docs/slack_bolt/listener/async_listener.html b/docs/static/api-docs/slack_bolt/listener/async_listener.html index 53d1dbdf..52da6d34 100644 --- a/docs/static/api-docs/slack_bolt/listener/async_listener.html +++ b/docs/static/api-docs/slack_bolt/listener/async_listener.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.async_listener API documentation - + @@ -40,7 +51,6 @@

                                                                                                    Classes

                                                                                                    (*,
                                                                                                    app_name: str,
                                                                                                    ack_function: Callable[..., Awaitable[BoltResponse | None]],
                                                                                                    lazy_functions: Sequence[Callable[..., Awaitable[None]]],
                                                                                                    matchers: Sequence[AsyncListenerMatcher],
                                                                                                    middleware: Sequence[AsyncMiddleware],
                                                                                                    auto_acknowledgement: bool = False,
                                                                                                    base_logger: logging.Logger | None = None)
                                                                                                    -
                                                                                                    Expand source code @@ -91,6 +101,7 @@

                                                                                                    Classes

                                                                                                    ) )
                                                                                                    +

                                                                                                    Ancestors

                                                                                                    • AsyncListener
                                                                                                    • @@ -99,35 +110,35 @@

                                                                                                      Class variables

                                                                                                      var ack_function : Callable[..., Awaitable[BoltResponse | None]]
                                                                                                      -
                                                                                                      +

                                                                                                      The type of the None singleton.

                                                                                                      var app_name : str
                                                                                                      -
                                                                                                      +

                                                                                                      The type of the None singleton.

                                                                                                      var arg_names : MutableSequence[str]
                                                                                                      -
                                                                                                      +

                                                                                                      The type of the None singleton.

                                                                                                      var auto_acknowledgement : bool
                                                                                                      -
                                                                                                      +

                                                                                                      The type of the None singleton.

                                                                                                      var lazy_functions : Sequence[Callable[..., Awaitable[None]]]
                                                                                                      -
                                                                                                      +

                                                                                                      The type of the None singleton.

                                                                                                      var logger : logging.Logger
                                                                                                      -
                                                                                                      +

                                                                                                      The type of the None singleton.

                                                                                                      var matchers : Sequence[AsyncListenerMatcher]
                                                                                                      -
                                                                                                      +

                                                                                                      The type of the None singleton.

                                                                                                      var middleware : Sequence[AsyncMiddleware]
                                                                                                      -
                                                                                                      +

                                                                                                      The type of the None singleton.

                                                                                                      Methods

                                                                                                      @@ -136,6 +147,26 @@

                                                                                                      Methods

                                                                                                      async def run_ack_function(self,
                                                                                                      *,
                                                                                                      request: AsyncBoltRequest,
                                                                                                      response: BoltResponse) ‑> BoltResponse | None
                                                                                                      +
                                                                                                      + +Expand source code + +
                                                                                                      async def run_ack_function(
                                                                                                      +    self,
                                                                                                      +    *,
                                                                                                      +    request: AsyncBoltRequest,
                                                                                                      +    response: BoltResponse,
                                                                                                      +) -> Optional[BoltResponse]:
                                                                                                      +    return await self.ack_function(
                                                                                                      +        **build_async_required_kwargs(
                                                                                                      +            logger=self.logger,
                                                                                                      +            required_arg_names=self.arg_names,
                                                                                                      +            request=request,
                                                                                                      +            response=response,
                                                                                                      +            this_func=self.ack_function,
                                                                                                      +        )
                                                                                                      +    )
                                                                                                      +

                                                                                                      Runs all the registered middleware and then run the listener function.

                                                                                                      Args

                                                                                                      @@ -154,7 +185,6 @@

                                                                                                      Returns

                                                                                                      (*,
                                                                                                      app_name: str,
                                                                                                      ack_function: Callable[..., Awaitable[BoltResponse | None]],
                                                                                                      lazy_functions: Sequence[Callable[..., Awaitable[None]]],
                                                                                                      matchers: Sequence[AsyncListenerMatcher],
                                                                                                      middleware: Sequence[AsyncMiddleware],
                                                                                                      auto_acknowledgement: bool = False,
                                                                                                      base_logger: logging.Logger | None = None)
                                                                                                      -
                                                                                                      Expand source code @@ -205,49 +235,35 @@

                                                                                                      Returns

                                                                                                      ) )
                                                                                                      +

                                                                                                      Ancestors

                                                                                                      Class variables

                                                                                                      -
                                                                                                      var ack_function : Callable[..., Awaitable[BoltResponse | None]]
                                                                                                      -
                                                                                                      -
                                                                                                      -
                                                                                                      var app_name : str
                                                                                                      -
                                                                                                      +

                                                                                                      The type of the None singleton.

                                                                                                      var arg_names : MutableSequence[str]
                                                                                                      -
                                                                                                      -
                                                                                                      -
                                                                                                      var auto_acknowledgement : bool
                                                                                                      -
                                                                                                      -
                                                                                                      -
                                                                                                      -
                                                                                                      var lazy_functions : Sequence[Callable[..., Awaitable[None]]]
                                                                                                      -
                                                                                                      -
                                                                                                      +

                                                                                                      The type of the None singleton.

                                                                                                      var logger : logging.Logger
                                                                                                      -
                                                                                                      -
                                                                                                      -
                                                                                                      var matchers : Sequence[AsyncListenerMatcher]
                                                                                                      -
                                                                                                      -
                                                                                                      -
                                                                                                      -
                                                                                                      var middleware : Sequence[AsyncMiddleware]
                                                                                                      -
                                                                                                      -
                                                                                                      +

                                                                                                      The type of the None singleton.

                                                                                                      Inherited members

                                                                                                      • AsyncListener: @@ -258,7 +274,6 @@

                                                                                                        Inherited members

                                                                                                        class AsyncListener
                                                                                                        -
                                                                                                        Expand source code @@ -323,6 +338,7 @@

                                                                                                        Inherited members

                                                                                                        """ raise NotImplementedError()
                                                                                                        +

                                                                                                        Subclasses

                                                                                                        • AsyncCustomListener
                                                                                                        • @@ -331,23 +347,23 @@

                                                                                                          Class variables

                                                                                                          var ack_function : Callable[..., Awaitable[BoltResponse]]
                                                                                                          -
                                                                                                          +

                                                                                                          The type of the None singleton.

                                                                                                          var auto_acknowledgement : bool
                                                                                                          -
                                                                                                          +

                                                                                                          The type of the None singleton.

                                                                                                          var lazy_functions : Sequence[Callable[..., Awaitable[None]]]
                                                                                                          -
                                                                                                          +

                                                                                                          The type of the None singleton.

                                                                                                          var matchers : Sequence[AsyncListenerMatcher]
                                                                                                          -
                                                                                                          +

                                                                                                          The type of the None singleton.

                                                                                                          var middleware : Sequence[AsyncMiddleware]
                                                                                                          -
                                                                                                          +

                                                                                                          The type of the None singleton.

                                                                                                          Methods

                                                                                                          @@ -356,12 +372,46 @@

                                                                                                          Methods

                                                                                                          async def async_matches(self,
                                                                                                          *,
                                                                                                          req: AsyncBoltRequest,
                                                                                                          resp: BoltResponse) ‑> bool
                                                                                                          +
                                                                                                          + +Expand source code + +
                                                                                                          async def async_matches(
                                                                                                          +    self,
                                                                                                          +    *,
                                                                                                          +    req: AsyncBoltRequest,
                                                                                                          +    resp: BoltResponse,
                                                                                                          +) -> bool:
                                                                                                          +    is_matched: bool = False
                                                                                                          +    for matcher in self.matchers:
                                                                                                          +        is_matched = await matcher.async_matches(req, resp)
                                                                                                          +        if not is_matched:
                                                                                                          +            return is_matched
                                                                                                          +    return is_matched
                                                                                                          +
                                                                                                          async def run_ack_function(self,
                                                                                                          *,
                                                                                                          request: AsyncBoltRequest,
                                                                                                          response: BoltResponse) ‑> BoltResponse | None
                                                                                                          +
                                                                                                          + +Expand source code + +
                                                                                                          @abstractmethod
                                                                                                          +async def run_ack_function(self, *, request: AsyncBoltRequest, response: BoltResponse) -> Optional[BoltResponse]:
                                                                                                          +    """Runs all the registered middleware and then run the listener function.
                                                                                                          +
                                                                                                          +    Args:
                                                                                                          +        request: The incoming request
                                                                                                          +        response: The current response
                                                                                                          +
                                                                                                          +    Returns:
                                                                                                          +        The processed response
                                                                                                          +    """
                                                                                                          +    raise NotImplementedError()
                                                                                                          +

                                                                                                          Runs all the registered middleware and then run the listener function.

                                                                                                          Args

                                                                                                          @@ -377,6 +427,37 @@

                                                                                                          Returns

                                                                                                          async def run_async_middleware(self,
                                                                                                          *,
                                                                                                          req: AsyncBoltRequest,
                                                                                                          resp: BoltResponse) ‑> Tuple[BoltResponse | None, bool]
                                                                                                          +
                                                                                                          + +Expand source code + +
                                                                                                          async def run_async_middleware(
                                                                                                          +    self,
                                                                                                          +    *,
                                                                                                          +    req: AsyncBoltRequest,
                                                                                                          +    resp: BoltResponse,
                                                                                                          +) -> Tuple[Optional[BoltResponse], bool]:
                                                                                                          +    """Runs an async middleware.
                                                                                                          +
                                                                                                          +    Args:
                                                                                                          +        req: The incoming request
                                                                                                          +        resp: The current response
                                                                                                          +
                                                                                                          +    Returns:
                                                                                                          +        A tuple of the processed response and a flag indicating termination
                                                                                                          +    """
                                                                                                          +    for m in self.middleware:
                                                                                                          +        middleware_state = {"next_called": False}
                                                                                                          +
                                                                                                          +        async def _next():
                                                                                                          +            middleware_state["next_called"] = True
                                                                                                          +
                                                                                                          +        resp = await m.async_process(req=req, resp=resp, next=_next)  # type: ignore[assignment]
                                                                                                          +        if not middleware_state["next_called"]:
                                                                                                          +            # next() was not called in this middleware
                                                                                                          +            return (resp, True)
                                                                                                          +    return (resp, False)
                                                                                                          +

                                                                                                          Runs an async middleware.

                                                                                                          Args

                                                                                                          @@ -422,14 +503,9 @@

                                                                                                          AsyncCustomListener

                                                                                                        • @@ -451,7 +527,7 @@

                                                                                                          -

                                                                                                          Generated by pdoc 0.11.3.

                                                                                                          +

                                                                                                          Generated by pdoc 0.11.5.

                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/listener/async_listener_completion_handler.html b/docs/static/api-docs/slack_bolt/listener/async_listener_completion_handler.html index b7639582..2a05e021 100644 --- a/docs/static/api-docs/slack_bolt/listener/async_listener_completion_handler.html +++ b/docs/static/api-docs/slack_bolt/listener/async_listener_completion_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.async_listener_completion_handler API documentation - + @@ -40,7 +51,6 @@

                                                                                                          Classes

                                                                                                          (logger: logging.Logger, func: Callable[..., Awaitable[None]])
                                                                                                          -
                                                                                                          Expand source code @@ -65,6 +75,7 @@

                                                                                                          Classes

                                                                                                          ) await self.func(**kwargs)
                                                                                                          +

                                                                                                          Ancestors

                                                                                                          • AsyncListenerCompletionHandler
                                                                                                          • @@ -83,7 +94,6 @@

                                                                                                            Inherited members

                                                                                                            (logger: logging.Logger)
                                                                                                            -
                                                                                                            Expand source code @@ -99,6 +109,7 @@

                                                                                                            Inherited members

                                                                                                            ): pass
                                                                                                            +

                                                                                                            Ancestors

                                                                                                            • AsyncListenerCompletionHandler
                                                                                                            • @@ -116,7 +127,6 @@

                                                                                                              Inherited members

                                                                                                              class AsyncListenerCompletionHandler
                                                                                                              -
                                                                                                              Expand source code @@ -136,6 +146,7 @@

                                                                                                              Inherited members

                                                                                                              """ raise NotImplementedError()
                                                                                                              +

                                                                                                              Subclasses

                                                                                                              • AsyncCustomListenerCompletionHandler
                                                                                                              • @@ -147,6 +158,24 @@

                                                                                                                Methods

                                                                                                                async def handle(self,
                                                                                                                request: AsyncBoltRequest,
                                                                                                                response: BoltResponse | None) ‑> None
                                                                                                                +
                                                                                                                + +Expand source code + +
                                                                                                                @abstractmethod
                                                                                                                +async def handle(
                                                                                                                +    self,
                                                                                                                +    request: AsyncBoltRequest,
                                                                                                                +    response: Optional[BoltResponse],
                                                                                                                +) -> None:
                                                                                                                +    """Do something extra after the listener execution
                                                                                                                +
                                                                                                                +    Args:
                                                                                                                +        request: The request.
                                                                                                                +        response: The response.
                                                                                                                +    """
                                                                                                                +    raise NotImplementedError()
                                                                                                                +

                                                                                                                Do something extra after the listener execution

                                                                                                                Args

                                                                                                                @@ -191,7 +220,7 @@

                                                                                                                -

                                                                                                                Generated by pdoc 0.11.3.

                                                                                                                +

                                                                                                                Generated by pdoc 0.11.5.

                                                                                                                diff --git a/docs/static/api-docs/slack_bolt/listener/async_listener_error_handler.html b/docs/static/api-docs/slack_bolt/listener/async_listener_error_handler.html index f752e4c9..9600a2cf 100644 --- a/docs/static/api-docs/slack_bolt/listener/async_listener_error_handler.html +++ b/docs/static/api-docs/slack_bolt/listener/async_listener_error_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.async_listener_error_handler API documentation - + @@ -40,7 +51,6 @@

                                                                                                                Classes

                                                                                                                (logger: logging.Logger,
                                                                                                                func: Callable[..., Awaitable[BoltResponse | None]])
                                                                                                                -
                                                                                                                Expand source code @@ -71,6 +81,7 @@

                                                                                                                Classes

                                                                                                                response.headers = returned_response.headers # type: ignore[union-attr] response.body = returned_response.body # type: ignore[union-attr]
                                                                                                                +

                                                                                                                Ancestors

                                                                                                                • AsyncListenerErrorHandler
                                                                                                                • @@ -89,7 +100,6 @@

                                                                                                                  Inherited members

                                                                                                                  (logger: logging.Logger)
                                                                                                                  -
                                                                                                                  Expand source code @@ -107,6 +117,7 @@

                                                                                                                  Inherited members

                                                                                                                  message = f"Failed to run listener function (error: {error})" self.logger.exception(message)
                                                                                                                  +

                                                                                                                  Ancestors

                                                                                                                  • AsyncListenerErrorHandler
                                                                                                                  • @@ -124,7 +135,6 @@

                                                                                                                    Inherited members

                                                                                                                    class AsyncListenerErrorHandler
                                                                                                                    -
                                                                                                                    Expand source code @@ -146,6 +156,7 @@

                                                                                                                    Inherited members

                                                                                                                    """ raise NotImplementedError()
                                                                                                                    +

                                                                                                                    Subclasses

                                                                                                                    • AsyncCustomListenerErrorHandler
                                                                                                                    • @@ -157,6 +168,26 @@

                                                                                                                      Methods

                                                                                                                      async def handle(self,
                                                                                                                      error: Exception,
                                                                                                                      request: AsyncBoltRequest,
                                                                                                                      response: BoltResponse | None) ‑> None
                                                                                                                      +
                                                                                                                      + +Expand source code + +
                                                                                                                      @abstractmethod
                                                                                                                      +async def handle(
                                                                                                                      +    self,
                                                                                                                      +    error: Exception,
                                                                                                                      +    request: AsyncBoltRequest,
                                                                                                                      +    response: Optional[BoltResponse],
                                                                                                                      +) -> None:
                                                                                                                      +    """Handles an unhandled exception.
                                                                                                                      +
                                                                                                                      +    Args:
                                                                                                                      +        error: The raised exception.
                                                                                                                      +        request: The request.
                                                                                                                      +        response: The response.
                                                                                                                      +    """
                                                                                                                      +    raise NotImplementedError()
                                                                                                                      +

                                                                                                                      Handles an unhandled exception.

                                                                                                                      Args

                                                                                                                      @@ -203,7 +234,7 @@

                                                                                                                      -

                                                                                                                      Generated by pdoc 0.11.3.

                                                                                                                      +

                                                                                                                      Generated by pdoc 0.11.5.

                                                                                                                      diff --git a/docs/static/api-docs/slack_bolt/listener/async_listener_start_handler.html b/docs/static/api-docs/slack_bolt/listener/async_listener_start_handler.html index a2638ebc..23ada5e0 100644 --- a/docs/static/api-docs/slack_bolt/listener/async_listener_start_handler.html +++ b/docs/static/api-docs/slack_bolt/listener/async_listener_start_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.async_listener_start_handler API documentation - + @@ -40,7 +51,6 @@

                                                                                                                      Classes

                                                                                                                      (logger: logging.Logger, func: Callable[..., Awaitable[None]])
                                                                                                                      -
                                                                                                                      Expand source code @@ -65,6 +75,7 @@

                                                                                                                      Classes

                                                                                                                      ) await self.func(**kwargs)
                                                                                                                      +

                                                                                                                      Ancestors

                                                                                                                      • AsyncListenerStartHandler
                                                                                                                      • @@ -83,7 +94,6 @@

                                                                                                                        Inherited members

                                                                                                                        (logger: logging.Logger)
                                                                                                                        -
                                                                                                                        Expand source code @@ -99,6 +109,7 @@

                                                                                                                        Inherited members

                                                                                                                        ): pass
                                                                                                                        +

                                                                                                                        Ancestors

                                                                                                                        • AsyncListenerStartHandler
                                                                                                                        • @@ -116,7 +127,6 @@

                                                                                                                          Inherited members

                                                                                                                          class AsyncListenerStartHandler
                                                                                                                          -
                                                                                                                          Expand source code @@ -136,6 +146,7 @@

                                                                                                                          Inherited members

                                                                                                                          """ raise NotImplementedError()
                                                                                                                          +

                                                                                                                          Subclasses

                                                                                                                          • AsyncCustomListenerStartHandler
                                                                                                                          • @@ -147,6 +158,24 @@

                                                                                                                            Methods

                                                                                                                            async def handle(self,
                                                                                                                            request: AsyncBoltRequest,
                                                                                                                            response: BoltResponse | None) ‑> None
                                                                                                                            +
                                                                                                                            + +Expand source code + +
                                                                                                                            @abstractmethod
                                                                                                                            +async def handle(
                                                                                                                            +    self,
                                                                                                                            +    request: AsyncBoltRequest,
                                                                                                                            +    response: Optional[BoltResponse],
                                                                                                                            +) -> None:
                                                                                                                            +    """Do something extra before the listener execution
                                                                                                                            +
                                                                                                                            +    Args:
                                                                                                                            +        request: The request.
                                                                                                                            +        response: The response.
                                                                                                                            +    """
                                                                                                                            +    raise NotImplementedError()
                                                                                                                            +

                                                                                                                            Do something extra before the listener execution

                                                                                                                            Args

                                                                                                                            @@ -191,7 +220,7 @@

                                                                                                                            -

                                                                                                                            Generated by pdoc 0.11.3.

                                                                                                                            +

                                                                                                                            Generated by pdoc 0.11.5.

                                                                                                                            diff --git a/docs/static/api-docs/slack_bolt/listener/asyncio_runner.html b/docs/static/api-docs/slack_bolt/listener/asyncio_runner.html index 2a1e50c0..8262667f 100644 --- a/docs/static/api-docs/slack_bolt/listener/asyncio_runner.html +++ b/docs/static/api-docs/slack_bolt/listener/asyncio_runner.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.asyncio_runner API documentation - + @@ -40,7 +51,6 @@

                                                                                                                            Classes

                                                                                                                            (logger: logging.Logger,
                                                                                                                            process_before_response: bool,
                                                                                                                            listener_error_handler: AsyncListenerErrorHandler,
                                                                                                                            listener_start_handler: AsyncListenerStartHandler,
                                                                                                                            listener_completion_handler: AsyncListenerCompletionHandler,
                                                                                                                            lazy_listener_runner: AsyncLazyListenerRunner)
                                                                                                                            -
                                                                                                                            Expand source code @@ -210,31 +220,32 @@

                                                                                                                            Classes

                                                                                                                            millis = int((time.time() - starting_time) * 1000) self.logger.debug(debug_responding(response.status, response.body, millis))
                                                                                                                            +

                                                                                                                            Class variables

                                                                                                                            var lazy_listener_runnerAsyncLazyListenerRunner
                                                                                                                            -
                                                                                                                            +

                                                                                                                            The type of the None singleton.

                                                                                                                            var listener_completion_handlerAsyncListenerCompletionHandler
                                                                                                                            -
                                                                                                                            +

                                                                                                                            The type of the None singleton.

                                                                                                                            var listener_error_handlerAsyncListenerErrorHandler
                                                                                                                            -
                                                                                                                            +

                                                                                                                            The type of the None singleton.

                                                                                                                            var listener_start_handlerAsyncListenerStartHandler
                                                                                                                            -
                                                                                                                            +

                                                                                                                            The type of the None singleton.

                                                                                                                            var logger : logging.Logger
                                                                                                                            -
                                                                                                                            +

                                                                                                                            The type of the None singleton.

                                                                                                                            var process_before_response : bool
                                                                                                                            -
                                                                                                                            +

                                                                                                                            The type of the None singleton.

                                                                                                                            Methods

                                                                                                                            @@ -243,6 +254,129 @@

                                                                                                                            Methods

                                                                                                                            async def run(self,
                                                                                                                            request: AsyncBoltRequest,
                                                                                                                            response: BoltResponse,
                                                                                                                            listener_name: str,
                                                                                                                            listener: AsyncListener,
                                                                                                                            starting_time: float | None = None) ‑> BoltResponse | None
                                                                                                                            +
                                                                                                                            + +Expand source code + +
                                                                                                                            async def run(
                                                                                                                            +    self,
                                                                                                                            +    request: AsyncBoltRequest,
                                                                                                                            +    response: BoltResponse,
                                                                                                                            +    listener_name: str,
                                                                                                                            +    listener: AsyncListener,
                                                                                                                            +    starting_time: Optional[float] = None,
                                                                                                                            +) -> Optional[BoltResponse]:
                                                                                                                            +    ack = request.context.ack
                                                                                                                            +    starting_time = starting_time if starting_time is not None else time.time()
                                                                                                                            +    if self.process_before_response:
                                                                                                                            +        if not request.lazy_only:
                                                                                                                            +            try:
                                                                                                                            +                await self.listener_start_handler.handle(request=request, response=response)
                                                                                                                            +                returned_value = await listener.run_ack_function(request=request, response=response)
                                                                                                                            +                if isinstance(returned_value, BoltResponse):
                                                                                                                            +                    response = returned_value
                                                                                                                            +                if ack.response is None and listener.auto_acknowledgement:
                                                                                                                            +                    await ack()  # automatic ack() call if the call is not yet done
                                                                                                                            +            except Exception as e:
                                                                                                                            +                # The default response status code is 500 in this case.
                                                                                                                            +                # You can customize this by passing your own error handler.
                                                                                                                            +                if response is None:
                                                                                                                            +                    response = BoltResponse(status=500)
                                                                                                                            +                response.status = 500
                                                                                                                            +                await self.listener_error_handler.handle(
                                                                                                                            +                    error=e,
                                                                                                                            +                    request=request,
                                                                                                                            +                    response=response,
                                                                                                                            +                )
                                                                                                                            +                ack.response = response
                                                                                                                            +            finally:
                                                                                                                            +                await self.listener_completion_handler.handle(request=request, response=response)
                                                                                                                            +
                                                                                                                            +        for lazy_func in listener.lazy_functions:
                                                                                                                            +            if request.lazy_function_name:
                                                                                                                            +                func_name = get_name_for_callable(lazy_func)
                                                                                                                            +                if func_name == request.lazy_function_name:
                                                                                                                            +                    await self.lazy_listener_runner.run(function=lazy_func, request=request)
                                                                                                                            +                    # This HTTP response won't be sent to Slack API servers.
                                                                                                                            +                    return BoltResponse(status=200)
                                                                                                                            +                else:
                                                                                                                            +                    continue
                                                                                                                            +            else:
                                                                                                                            +                self._start_lazy_function(lazy_func, request)
                                                                                                                            +
                                                                                                                            +        if response is not None:
                                                                                                                            +            self._debug_log_completion(starting_time, response)
                                                                                                                            +            return response
                                                                                                                            +        elif ack.response is not None:
                                                                                                                            +            self._debug_log_completion(starting_time, ack.response)
                                                                                                                            +            return ack.response
                                                                                                                            +    else:
                                                                                                                            +        if listener.auto_acknowledgement:
                                                                                                                            +            # acknowledge immediately in case of Events API
                                                                                                                            +            await ack()
                                                                                                                            +
                                                                                                                            +        if not request.lazy_only:
                                                                                                                            +            # start the listener function asynchronously
                                                                                                                            +            # NOTE: intentionally
                                                                                                                            +            async def run_ack_function_asynchronously(
                                                                                                                            +                ack: AsyncAck,
                                                                                                                            +                request: AsyncBoltRequest,
                                                                                                                            +                response: BoltResponse,
                                                                                                                            +            ):
                                                                                                                            +                try:
                                                                                                                            +                    await self.listener_start_handler.handle(request=request, response=response)
                                                                                                                            +                    await listener.run_ack_function(request=request, response=response)
                                                                                                                            +                except Exception as e:
                                                                                                                            +                    # The default response status code is 500 in this case.
                                                                                                                            +                    # You can customize this by passing your own error handler.
                                                                                                                            +                    if response is None:
                                                                                                                            +                        response = BoltResponse(status=500)
                                                                                                                            +                    response.status = 500
                                                                                                                            +                    if ack.response is not None:  # already acknowledged
                                                                                                                            +                        response = None  # type: ignore[assignment]
                                                                                                                            +
                                                                                                                            +                    await self.listener_error_handler.handle(
                                                                                                                            +                        error=e,
                                                                                                                            +                        request=request,
                                                                                                                            +                        response=response,
                                                                                                                            +                    )
                                                                                                                            +                    ack.response = response
                                                                                                                            +                finally:
                                                                                                                            +                    await self.listener_completion_handler.handle(request=request, response=response)
                                                                                                                            +
                                                                                                                            +            _f: Future = asyncio.ensure_future(run_ack_function_asynchronously(ack, request, response))
                                                                                                                            +
                                                                                                                            +        for lazy_func in listener.lazy_functions:
                                                                                                                            +            if request.lazy_function_name:
                                                                                                                            +                func_name = get_name_for_callable(lazy_func)
                                                                                                                            +                if func_name == request.lazy_function_name:
                                                                                                                            +                    await self.lazy_listener_runner.run(function=lazy_func, request=request)
                                                                                                                            +                    # This HTTP response won't be sent to Slack API servers.
                                                                                                                            +                    return BoltResponse(status=200)
                                                                                                                            +                else:
                                                                                                                            +                    continue
                                                                                                                            +            else:
                                                                                                                            +                self._start_lazy_function(lazy_func, request)
                                                                                                                            +
                                                                                                                            +        # await for the completion of ack() in the async listener execution
                                                                                                                            +        while ack.response is None and time.time() - starting_time <= 3:
                                                                                                                            +            await asyncio.sleep(0.01)
                                                                                                                            +
                                                                                                                            +        if response is None and ack.response is None:
                                                                                                                            +            self.logger.warning(warning_did_not_call_ack(listener_name))
                                                                                                                            +            return None
                                                                                                                            +
                                                                                                                            +        if response is None and ack.response is not None:
                                                                                                                            +            response = ack.response
                                                                                                                            +            self._debug_log_completion(starting_time, response)
                                                                                                                            +            return response
                                                                                                                            +
                                                                                                                            +        if response is not None:
                                                                                                                            +            return response
                                                                                                                            +
                                                                                                                            +    # None for both means no ack() in the listener
                                                                                                                            +    return None
                                                                                                                            +

                                                                                                                            @@ -280,7 +414,7 @@

                                                                                                                            diff --git a/docs/static/api-docs/slack_bolt/listener/builtins.html b/docs/static/api-docs/slack_bolt/listener/builtins.html index 93a5f117..75f8ca62 100644 --- a/docs/static/api-docs/slack_bolt/listener/builtins.html +++ b/docs/static/api-docs/slack_bolt/listener/builtins.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.builtins API documentation - + @@ -40,7 +51,6 @@

                                                                                                                            Classes

                                                                                                                            (installation_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore)
                                                                                                                            -

                                                                                                                            Listener functions to handle token revocation / uninstallation events

                                                                                                                            Expand source code @@ -75,11 +85,12 @@

                                                                                                                            Classes

                                                                                                                            team_id=context.team_id, )
                                                                                                                            +

                                                                                                                            Listener functions to handle token revocation / uninstallation events

                                                                                                                            Class variables

                                                                                                                            var installation_store : slack_sdk.oauth.installation_store.installation_store.InstallationStore
                                                                                                                            -
                                                                                                                            +

                                                                                                                            The type of the None singleton.

                                                                                                                            Methods

                                                                                                                            @@ -88,12 +99,42 @@

                                                                                                                            Methods

                                                                                                                            def handle_app_uninstalled_events(self,
                                                                                                                            context: BoltContext) ‑> None
                                                                                                                            +
                                                                                                                            + +Expand source code + +
                                                                                                                            def handle_app_uninstalled_events(self, context: BoltContext) -> None:
                                                                                                                            +    self.installation_store.delete_all(
                                                                                                                            +        enterprise_id=context.enterprise_id,
                                                                                                                            +        team_id=context.team_id,
                                                                                                                            +    )
                                                                                                                            +
                                                                                                                            def handle_tokens_revoked_events(self,
                                                                                                                            event: dict,
                                                                                                                            context: BoltContext) ‑> None
                                                                                                                            +
                                                                                                                            + +Expand source code + +
                                                                                                                            def handle_tokens_revoked_events(self, event: dict, context: BoltContext) -> None:
                                                                                                                            +    user_ids = event.get("tokens", {}).get("oauth", [])
                                                                                                                            +    if len(user_ids) > 0:
                                                                                                                            +        for user_id in user_ids:
                                                                                                                            +            self.installation_store.delete_installation(
                                                                                                                            +                enterprise_id=context.enterprise_id,
                                                                                                                            +                team_id=context.team_id,
                                                                                                                            +                user_id=user_id,
                                                                                                                            +            )
                                                                                                                            +    bots = event.get("tokens", {}).get("bot", [])
                                                                                                                            +    if len(bots) > 0:
                                                                                                                            +        self.installation_store.delete_bot(
                                                                                                                            +            enterprise_id=context.enterprise_id,
                                                                                                                            +            team_id=context.team_id,
                                                                                                                            +        )
                                                                                                                            +

                                                                                                                      @@ -127,7 +168,7 @@

                                                                                                                      diff --git a/docs/static/api-docs/slack_bolt/listener/custom_listener.html b/docs/static/api-docs/slack_bolt/listener/custom_listener.html index 48fd83f4..1cd26137 100644 --- a/docs/static/api-docs/slack_bolt/listener/custom_listener.html +++ b/docs/static/api-docs/slack_bolt/listener/custom_listener.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.custom_listener API documentation - + @@ -40,7 +51,6 @@

                                                                                                                      Classes

                                                                                                                      (*,
                                                                                                                      app_name: str,
                                                                                                                      ack_function: Callable[..., BoltResponse | None],
                                                                                                                      lazy_functions: Sequence[Callable[..., None]],
                                                                                                                      matchers: Sequence[ListenerMatcher],
                                                                                                                      middleware: Sequence[Middleware],
                                                                                                                      auto_acknowledgement: bool = False,
                                                                                                                      base_logger: logging.Logger | None = None)
                                                                                                                      -
                                                                                                                      Expand source code @@ -91,49 +101,35 @@

                                                                                                                      Classes

                                                                                                                      ) )
                                                                                                                      +

                                                                                                                      Ancestors

                                                                                                                      Class variables

                                                                                                                      -
                                                                                                                      var ack_function : Callable[..., BoltResponse | None]
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      var app_name : str
                                                                                                                      -
                                                                                                                      +

                                                                                                                      The type of the None singleton.

                                                                                                                      var arg_names : MutableSequence[str]
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      var auto_acknowledgement : bool
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      var lazy_functions : Sequence[Callable[..., None]]
                                                                                                                      -
                                                                                                                      -
                                                                                                                      +

                                                                                                                      The type of the None singleton.

                                                                                                                      var logger : logging.Logger
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      var matchers : Sequence[ListenerMatcher]
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      var middleware : Sequence[Middleware]
                                                                                                                      -
                                                                                                                      -
                                                                                                                      +

                                                                                                                      The type of the None singleton.

                                                                                                                      Inherited members

                                                                                                                      @@ -174,7 +165,7 @@

                                                                                                                      -

                                                                                                                      Generated by pdoc 0.11.3.

                                                                                                                      +

                                                                                                                      Generated by pdoc 0.11.5.

                                                                                                                      diff --git a/docs/static/api-docs/slack_bolt/listener/index.html b/docs/static/api-docs/slack_bolt/listener/index.html index 937708fd..677147e2 100644 --- a/docs/static/api-docs/slack_bolt/listener/index.html +++ b/docs/static/api-docs/slack_bolt/listener/index.html @@ -3,20 +3,31 @@ - + slack_bolt.listener API documentation - + @@ -99,7 +110,6 @@

                                                                                                                      Classes

                                                                                                                      (*,
                                                                                                                      app_name: str,
                                                                                                                      ack_function: Callable[..., BoltResponse | None],
                                                                                                                      lazy_functions: Sequence[Callable[..., None]],
                                                                                                                      matchers: Sequence[ListenerMatcher],
                                                                                                                      middleware: Sequence[Middleware],
                                                                                                                      auto_acknowledgement: bool = False,
                                                                                                                      base_logger: logging.Logger | None = None)
                                                                                                                      -
                                                                                                                      Expand source code @@ -150,49 +160,35 @@

                                                                                                                      Classes

                                                                                                                      ) )
                                                                                                                      +

                                                                                                                      Ancestors

                                                                                                                      Class variables

                                                                                                                      -
                                                                                                                      var ack_function : Callable[..., BoltResponse | None]
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      var app_name : str
                                                                                                                      -
                                                                                                                      +

                                                                                                                      The type of the None singleton.

                                                                                                                      var arg_names : MutableSequence[str]
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      var auto_acknowledgement : bool
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      var lazy_functions : Sequence[Callable[..., None]]
                                                                                                                      -
                                                                                                                      -
                                                                                                                      +

                                                                                                                      The type of the None singleton.

                                                                                                                      var logger : logging.Logger
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      var matchers : Sequence[ListenerMatcher]
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      -
                                                                                                                      var middleware : Sequence[Middleware]
                                                                                                                      -
                                                                                                                      -
                                                                                                                      +

                                                                                                                      The type of the None singleton.

                                                                                                                      Inherited members

                                                                                                                      • Listener: @@ -203,7 +199,6 @@

                                                                                                                        Inherited members

                                                                                                                        class Listener
                                                                                                                        -
                                                                                                                        Expand source code @@ -268,6 +263,7 @@

                                                                                                                        Inherited members

                                                                                                                        """ raise NotImplementedError()
                                                                                                                        +

                                                                                                                        Subclasses

                                                                                                                        • CustomListener
                                                                                                                        • @@ -276,23 +272,23 @@

                                                                                                                          Class variables

                                                                                                                          var ack_function : Callable[..., BoltResponse]
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var auto_acknowledgement : bool
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var lazy_functions : Sequence[Callable[..., None]]
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var matchers : Sequence[ListenerMatcher]
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var middleware : Sequence[Middleware]
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          Methods

                                                                                                                          @@ -301,12 +297,46 @@

                                                                                                                          Methods

                                                                                                                          def matches(self,
                                                                                                                          *,
                                                                                                                          req: BoltRequest,
                                                                                                                          resp: BoltResponse) ‑> bool
                                                                                                                          +
                                                                                                                          + +Expand source code + +
                                                                                                                          def matches(
                                                                                                                          +    self,
                                                                                                                          +    *,
                                                                                                                          +    req: BoltRequest,
                                                                                                                          +    resp: BoltResponse,
                                                                                                                          +) -> bool:
                                                                                                                          +    is_matched: bool = False
                                                                                                                          +    for matcher in self.matchers:
                                                                                                                          +        is_matched = matcher.matches(req, resp)
                                                                                                                          +        if not is_matched:
                                                                                                                          +            return is_matched
                                                                                                                          +    return is_matched
                                                                                                                          +
                                                                                                                          def run_ack_function(self,
                                                                                                                          *,
                                                                                                                          request: BoltRequest,
                                                                                                                          response: BoltResponse) ‑> BoltResponse | None
                                                                                                                          +
                                                                                                                          + +Expand source code + +
                                                                                                                          @abstractmethod
                                                                                                                          +def run_ack_function(self, *, request: BoltRequest, response: BoltResponse) -> Optional[BoltResponse]:
                                                                                                                          +    """Runs all the registered middleware and then run the listener function.
                                                                                                                          +
                                                                                                                          +    Args:
                                                                                                                          +        request: The incoming request
                                                                                                                          +        response: The current response
                                                                                                                          +
                                                                                                                          +    Returns:
                                                                                                                          +        The processed response
                                                                                                                          +    """
                                                                                                                          +    raise NotImplementedError()
                                                                                                                          +

                                                                                                                          Runs all the registered middleware and then run the listener function.

                                                                                                                          Args

                                                                                                                          @@ -322,6 +352,37 @@

                                                                                                                          Returns

                                                                                                                          def run_middleware(self,
                                                                                                                          *,
                                                                                                                          req: BoltRequest,
                                                                                                                          resp: BoltResponse) ‑> Tuple[BoltResponse | None, bool]
                                                                                                                          +
                                                                                                                          + +Expand source code + +
                                                                                                                          def run_middleware(
                                                                                                                          +    self,
                                                                                                                          +    *,
                                                                                                                          +    req: BoltRequest,
                                                                                                                          +    resp: BoltResponse,
                                                                                                                          +) -> Tuple[Optional[BoltResponse], bool]:
                                                                                                                          +    """Runs a middleware.
                                                                                                                          +
                                                                                                                          +    Args:
                                                                                                                          +        req: The incoming request
                                                                                                                          +        resp: The current response
                                                                                                                          +
                                                                                                                          +    Returns:
                                                                                                                          +        A tuple of the processed response and a flag indicating termination
                                                                                                                          +    """
                                                                                                                          +    for m in self.middleware:
                                                                                                                          +        middleware_state = {"next_called": False}
                                                                                                                          +
                                                                                                                          +        def next_():
                                                                                                                          +            middleware_state["next_called"] = True
                                                                                                                          +
                                                                                                                          +        resp = m.process(req=req, resp=resp, next=next_)  # type: ignore[assignment]
                                                                                                                          +        if not middleware_state["next_called"]:
                                                                                                                          +            # next() was not called in this middleware
                                                                                                                          +            return (resp, True)
                                                                                                                          +    return (resp, False)
                                                                                                                          +

                                                                                                                          Runs a middleware.

                                                                                                                          Args

                                                                                                                          @@ -370,14 +431,9 @@

                                                                                                                          Returns

                                                                                                                        • CustomListener

                                                                                                                        • @@ -399,7 +455,7 @@

                                                                                                                          -

                                                                                                                          Generated by pdoc 0.11.3.

                                                                                                                          +

                                                                                                                          Generated by pdoc 0.11.5.

                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/listener/listener.html b/docs/static/api-docs/slack_bolt/listener/listener.html index 45f190ff..743fb2ce 100644 --- a/docs/static/api-docs/slack_bolt/listener/listener.html +++ b/docs/static/api-docs/slack_bolt/listener/listener.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.listener API documentation - + @@ -39,7 +50,6 @@

                                                                                                                          Classes

                                                                                                                          class Listener
                                                                                                                          -
                                                                                                                          Expand source code @@ -104,6 +114,7 @@

                                                                                                                          Classes

                                                                                                                          """ raise NotImplementedError()
                                                                                                                          +

                                                                                                                          Subclasses

                                                                                                                          • CustomListener
                                                                                                                          • @@ -112,23 +123,23 @@

                                                                                                                            Class variables

                                                                                                                            var ack_function : Callable[..., BoltResponse]
                                                                                                                            -
                                                                                                                            +

                                                                                                                            The type of the None singleton.

                                                                                                                            var auto_acknowledgement : bool
                                                                                                                            -
                                                                                                                            +

                                                                                                                            The type of the None singleton.

                                                                                                                            var lazy_functions : Sequence[Callable[..., None]]
                                                                                                                            -
                                                                                                                            +

                                                                                                                            The type of the None singleton.

                                                                                                                            var matchers : Sequence[ListenerMatcher]
                                                                                                                            -
                                                                                                                            +

                                                                                                                            The type of the None singleton.

                                                                                                                            var middleware : Sequence[Middleware]
                                                                                                                            -
                                                                                                                            +

                                                                                                                            The type of the None singleton.

                                                                                                                            Methods

                                                                                                                            @@ -137,12 +148,46 @@

                                                                                                                            Methods

                                                                                                                            def matches(self,
                                                                                                                            *,
                                                                                                                            req: BoltRequest,
                                                                                                                            resp: BoltResponse) ‑> bool
                                                                                                                            +
                                                                                                                            + +Expand source code + +
                                                                                                                            def matches(
                                                                                                                            +    self,
                                                                                                                            +    *,
                                                                                                                            +    req: BoltRequest,
                                                                                                                            +    resp: BoltResponse,
                                                                                                                            +) -> bool:
                                                                                                                            +    is_matched: bool = False
                                                                                                                            +    for matcher in self.matchers:
                                                                                                                            +        is_matched = matcher.matches(req, resp)
                                                                                                                            +        if not is_matched:
                                                                                                                            +            return is_matched
                                                                                                                            +    return is_matched
                                                                                                                            +
                                                                                                                            def run_ack_function(self,
                                                                                                                            *,
                                                                                                                            request: BoltRequest,
                                                                                                                            response: BoltResponse) ‑> BoltResponse | None
                                                                                                                            +
                                                                                                                            + +Expand source code + +
                                                                                                                            @abstractmethod
                                                                                                                            +def run_ack_function(self, *, request: BoltRequest, response: BoltResponse) -> Optional[BoltResponse]:
                                                                                                                            +    """Runs all the registered middleware and then run the listener function.
                                                                                                                            +
                                                                                                                            +    Args:
                                                                                                                            +        request: The incoming request
                                                                                                                            +        response: The current response
                                                                                                                            +
                                                                                                                            +    Returns:
                                                                                                                            +        The processed response
                                                                                                                            +    """
                                                                                                                            +    raise NotImplementedError()
                                                                                                                            +

                                                                                                                            Runs all the registered middleware and then run the listener function.

                                                                                                                            Args

                                                                                                                            @@ -158,6 +203,37 @@

                                                                                                                            Returns

                                                                                                                            def run_middleware(self,
                                                                                                                            *,
                                                                                                                            req: BoltRequest,
                                                                                                                            resp: BoltResponse) ‑> Tuple[BoltResponse | None, bool]
                                                                                                                            +
                                                                                                                            + +Expand source code + +
                                                                                                                            def run_middleware(
                                                                                                                            +    self,
                                                                                                                            +    *,
                                                                                                                            +    req: BoltRequest,
                                                                                                                            +    resp: BoltResponse,
                                                                                                                            +) -> Tuple[Optional[BoltResponse], bool]:
                                                                                                                            +    """Runs a middleware.
                                                                                                                            +
                                                                                                                            +    Args:
                                                                                                                            +        req: The incoming request
                                                                                                                            +        resp: The current response
                                                                                                                            +
                                                                                                                            +    Returns:
                                                                                                                            +        A tuple of the processed response and a flag indicating termination
                                                                                                                            +    """
                                                                                                                            +    for m in self.middleware:
                                                                                                                            +        middleware_state = {"next_called": False}
                                                                                                                            +
                                                                                                                            +        def next_():
                                                                                                                            +            middleware_state["next_called"] = True
                                                                                                                            +
                                                                                                                            +        resp = m.process(req=req, resp=resp, next=next_)  # type: ignore[assignment]
                                                                                                                            +        if not middleware_state["next_called"]:
                                                                                                                            +            # next() was not called in this middleware
                                                                                                                            +            return (resp, True)
                                                                                                                            +    return (resp, False)
                                                                                                                            +

                                                                                                                            Runs a middleware.

                                                                                                                            Args

                                                                                                                            @@ -205,7 +281,7 @@

                                                                                                                            -

                                                                                                                            Generated by pdoc 0.11.3.

                                                                                                                            +

                                                                                                                            Generated by pdoc 0.11.5.

                                                                                                                            diff --git a/docs/static/api-docs/slack_bolt/listener/listener_completion_handler.html b/docs/static/api-docs/slack_bolt/listener/listener_completion_handler.html index 7363ca43..35b2fe8c 100644 --- a/docs/static/api-docs/slack_bolt/listener/listener_completion_handler.html +++ b/docs/static/api-docs/slack_bolt/listener/listener_completion_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.listener_completion_handler API documentation - + @@ -40,7 +51,6 @@

                                                                                                                            Classes

                                                                                                                            (logger: logging.Logger, func: Callable[..., None])
                                                                                                                            -
                                                                                                                            Expand source code @@ -65,6 +75,7 @@

                                                                                                                            Classes

                                                                                                                            ) self.func(**kwargs)
                                                                                                                            +

                                                                                                                            Ancestors

                                                                                                                            • ListenerCompletionHandler
                                                                                                                            • @@ -83,7 +94,6 @@

                                                                                                                              Inherited members

                                                                                                                              (logger: logging.Logger)
                                                                                                                              -
                                                                                                                              Expand source code @@ -99,6 +109,7 @@

                                                                                                                              Inherited members

                                                                                                                              ): pass
                                                                                                                              +

                                                                                                                              Ancestors

                                                                                                                              • ListenerCompletionHandler
                                                                                                                              • @@ -116,7 +127,6 @@

                                                                                                                                Inherited members

                                                                                                                                class ListenerCompletionHandler
                                                                                                                                -
                                                                                                                                Expand source code @@ -136,6 +146,7 @@

                                                                                                                                Inherited members

                                                                                                                                """ raise NotImplementedError()
                                                                                                                                +

                                                                                                                                Subclasses

                                                                                                                                • DjangoListenerCompletionHandler
                                                                                                                                • @@ -148,6 +159,24 @@

                                                                                                                                  Methods

                                                                                                                                  def handle(self,
                                                                                                                                  request: BoltRequest,
                                                                                                                                  response: BoltResponse | None) ‑> None
                                                                                                                                  +
                                                                                                                                  + +Expand source code + +
                                                                                                                                  @abstractmethod
                                                                                                                                  +def handle(
                                                                                                                                  +    self,
                                                                                                                                  +    request: BoltRequest,
                                                                                                                                  +    response: Optional[BoltResponse],
                                                                                                                                  +) -> None:
                                                                                                                                  +    """Do something extra after the listener execution
                                                                                                                                  +
                                                                                                                                  +    Args:
                                                                                                                                  +        request: The request.
                                                                                                                                  +        response: The response.
                                                                                                                                  +    """
                                                                                                                                  +    raise NotImplementedError()
                                                                                                                                  +

                                                                                                                                  Do something extra after the listener execution

                                                                                                                                  Args

                                                                                                                                  @@ -192,7 +221,7 @@

                                                                                                                                  -

                                                                                                                                  Generated by pdoc 0.11.3.

                                                                                                                                  +

                                                                                                                                  Generated by pdoc 0.11.5.

                                                                                                                                  diff --git a/docs/static/api-docs/slack_bolt/listener/listener_error_handler.html b/docs/static/api-docs/slack_bolt/listener/listener_error_handler.html index 73b360ba..fc49894d 100644 --- a/docs/static/api-docs/slack_bolt/listener/listener_error_handler.html +++ b/docs/static/api-docs/slack_bolt/listener/listener_error_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.listener_error_handler API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                  Classes

                                                                                                                                  (logger: logging.Logger,
                                                                                                                                  func: Callable[..., BoltResponse | None])
                                                                                                                                  -
                                                                                                                                  Expand source code @@ -71,6 +81,7 @@

                                                                                                                                  Classes

                                                                                                                                  response.headers = returned_response.headers # type: ignore[union-attr] response.body = returned_response.body # type: ignore[union-attr]
                                                                                                                                  +

                                                                                                                                  Ancestors

                                                                                                                                  • ListenerErrorHandler
                                                                                                                                  • @@ -89,7 +100,6 @@

                                                                                                                                    Inherited members

                                                                                                                                    (logger: logging.Logger)
                                                                                                                                    -
                                                                                                                                    Expand source code @@ -107,6 +117,7 @@

                                                                                                                                    Inherited members

                                                                                                                                    message = f"Failed to run listener function (error: {error})" self.logger.exception(message)
                                                                                                                                    +

                                                                                                                                    Ancestors

                                                                                                                                    • ListenerErrorHandler
                                                                                                                                    • @@ -124,7 +135,6 @@

                                                                                                                                      Inherited members

                                                                                                                                      class ListenerErrorHandler
                                                                                                                                      -
                                                                                                                                      Expand source code @@ -146,6 +156,7 @@

                                                                                                                                      Inherited members

                                                                                                                                      """ raise NotImplementedError()
                                                                                                                                      +

                                                                                                                                      Subclasses

                                                                                                                                      • CustomListenerErrorHandler
                                                                                                                                      • @@ -157,6 +168,26 @@

                                                                                                                                        Methods

                                                                                                                                        def handle(self,
                                                                                                                                        error: Exception,
                                                                                                                                        request: BoltRequest,
                                                                                                                                        response: BoltResponse | None) ‑> None
                                                                                                                                        +
                                                                                                                                        + +Expand source code + +
                                                                                                                                        @abstractmethod
                                                                                                                                        +def handle(
                                                                                                                                        +    self,
                                                                                                                                        +    error: Exception,
                                                                                                                                        +    request: BoltRequest,
                                                                                                                                        +    response: Optional[BoltResponse],
                                                                                                                                        +) -> None:
                                                                                                                                        +    """Handles an unhandled exception.
                                                                                                                                        +
                                                                                                                                        +    Args:
                                                                                                                                        +        error: The raised exception.
                                                                                                                                        +        request: The request.
                                                                                                                                        +        response: The response.
                                                                                                                                        +    """
                                                                                                                                        +    raise NotImplementedError()
                                                                                                                                        +

                                                                                                                                        Handles an unhandled exception.

                                                                                                                                        Args

                                                                                                                                        @@ -203,7 +234,7 @@

                                                                                                                                        -

                                                                                                                                        Generated by pdoc 0.11.3.

                                                                                                                                        +

                                                                                                                                        Generated by pdoc 0.11.5.

                                                                                                                                        diff --git a/docs/static/api-docs/slack_bolt/listener/listener_start_handler.html b/docs/static/api-docs/slack_bolt/listener/listener_start_handler.html index f5eccc47..63cb98b9 100644 --- a/docs/static/api-docs/slack_bolt/listener/listener_start_handler.html +++ b/docs/static/api-docs/slack_bolt/listener/listener_start_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.listener_start_handler API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                        Classes

                                                                                                                                        (logger: logging.Logger, func: Callable[..., None])
                                                                                                                                        -
                                                                                                                                        Expand source code @@ -65,6 +75,7 @@

                                                                                                                                        Classes

                                                                                                                                        ) self.func(**kwargs)
                                                                                                                                        +

                                                                                                                                        Ancestors

                                                                                                                                        • ListenerStartHandler
                                                                                                                                        • @@ -83,7 +94,6 @@

                                                                                                                                          Inherited members

                                                                                                                                          (logger: logging.Logger)
                                                                                                                                          -
                                                                                                                                          Expand source code @@ -99,6 +109,7 @@

                                                                                                                                          Inherited members

                                                                                                                                          ): pass
                                                                                                                                          +

                                                                                                                                          Ancestors

                                                                                                                                          • ListenerStartHandler
                                                                                                                                          • @@ -116,7 +127,6 @@

                                                                                                                                            Inherited members

                                                                                                                                            class ListenerStartHandler
                                                                                                                                            -
                                                                                                                                            Expand source code @@ -140,6 +150,7 @@

                                                                                                                                            Inherited members

                                                                                                                                            """ raise NotImplementedError()
                                                                                                                                            +

                                                                                                                                            Subclasses

                                                                                                                                            • DjangoListenerStartHandler
                                                                                                                                            • @@ -152,6 +163,28 @@

                                                                                                                                              Methods

                                                                                                                                              def handle(self,
                                                                                                                                              request: BoltRequest,
                                                                                                                                              response: BoltResponse | None) ‑> None
                                                                                                                                              +
                                                                                                                                              + +Expand source code + +
                                                                                                                                              @abstractmethod
                                                                                                                                              +def handle(
                                                                                                                                              +    self,
                                                                                                                                              +    request: BoltRequest,
                                                                                                                                              +    response: Optional[BoltResponse],
                                                                                                                                              +) -> None:
                                                                                                                                              +    """Do something extra before the listener execution.
                                                                                                                                              +
                                                                                                                                              +    This handler is useful if a developer needs to maintain/clean up
                                                                                                                                              +    thread-local resources such as Django ORM database connections
                                                                                                                                              +    before a listener execution starts.
                                                                                                                                              +
                                                                                                                                              +    Args:
                                                                                                                                              +        request: The request.
                                                                                                                                              +        response: The response.
                                                                                                                                              +    """
                                                                                                                                              +    raise NotImplementedError()
                                                                                                                                              +

                                                                                                                                              Do something extra before the listener execution.

                                                                                                                                              This handler is useful if a developer needs to maintain/clean up thread-local resources such as Django ORM database connections @@ -199,7 +232,7 @@

                                                                                                                                              -

                                                                                                                                              Generated by pdoc 0.11.3.

                                                                                                                                              +

                                                                                                                                              Generated by pdoc 0.11.5.

                                                                                                                                              diff --git a/docs/static/api-docs/slack_bolt/listener/thread_runner.html b/docs/static/api-docs/slack_bolt/listener/thread_runner.html index 1dc97eaa..b6fafae9 100644 --- a/docs/static/api-docs/slack_bolt/listener/thread_runner.html +++ b/docs/static/api-docs/slack_bolt/listener/thread_runner.html @@ -3,19 +3,30 @@ - + slack_bolt.listener.thread_runner API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                              Classes

                                                                                                                                              (logger: logging.Logger,
                                                                                                                                              process_before_response: bool,
                                                                                                                                              listener_error_handler: ListenerErrorHandler,
                                                                                                                                              listener_start_handler: ListenerStartHandler,
                                                                                                                                              listener_completion_handler: ListenerCompletionHandler,
                                                                                                                                              listener_executor: concurrent.futures._base.Executor,
                                                                                                                                              lazy_listener_runner: LazyListenerRunner)
                                                                                                                                              -
                                                                                                                                              Expand source code @@ -228,35 +238,36 @@

                                                                                                                                              Classes

                                                                                                                                              millis = int((time.time() - starting_time) * 1000) self.logger.debug(debug_responding(response.status, response.body, millis))
                                                                                                                                              +

                                                                                                                                              Class variables

                                                                                                                                              var lazy_listener_runnerLazyListenerRunner
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              var listener_completion_handlerListenerCompletionHandler
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              var listener_error_handlerListenerErrorHandler
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              var listener_executor : concurrent.futures._base.Executor
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              var listener_start_handlerListenerStartHandler
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              var logger : logging.Logger
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              var process_before_response : bool
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              Methods

                                                                                                                                              @@ -265,6 +276,143 @@

                                                                                                                                              Methods

                                                                                                                                              def run(self,
                                                                                                                                              request: BoltRequest,
                                                                                                                                              response: BoltResponse,
                                                                                                                                              listener_name: str,
                                                                                                                                              listener: Listener,
                                                                                                                                              starting_time: float | None = None) ‑> BoltResponse | None
                                                                                                                                              +
                                                                                                                                              + +Expand source code + +
                                                                                                                                              def run(
                                                                                                                                              +    self,
                                                                                                                                              +    request: BoltRequest,
                                                                                                                                              +    response: BoltResponse,
                                                                                                                                              +    listener_name: str,
                                                                                                                                              +    listener: Listener,
                                                                                                                                              +    starting_time: Optional[float] = None,
                                                                                                                                              +) -> Optional[BoltResponse]:
                                                                                                                                              +    ack = request.context.ack
                                                                                                                                              +    starting_time = starting_time if starting_time is not None else time.time()
                                                                                                                                              +    if self.process_before_response:
                                                                                                                                              +        if not request.lazy_only:
                                                                                                                                              +            try:
                                                                                                                                              +                self.listener_start_handler.handle(
                                                                                                                                              +                    request=request,
                                                                                                                                              +                    response=response,
                                                                                                                                              +                )
                                                                                                                                              +                returned_value = listener.run_ack_function(request=request, response=response)
                                                                                                                                              +                if isinstance(returned_value, BoltResponse):
                                                                                                                                              +                    response = returned_value
                                                                                                                                              +                if ack.response is None and listener.auto_acknowledgement:
                                                                                                                                              +                    ack()  # automatic ack() call if the call is not yet done
                                                                                                                                              +            except Exception as e:
                                                                                                                                              +                # The default response status code is 500 in this case.
                                                                                                                                              +                # You can customize this by passing your own error handler.
                                                                                                                                              +                if response is None:
                                                                                                                                              +                    response = BoltResponse(status=500)
                                                                                                                                              +                response.status = 500
                                                                                                                                              +                self.listener_error_handler.handle(
                                                                                                                                              +                    error=e,
                                                                                                                                              +                    request=request,
                                                                                                                                              +                    response=response,
                                                                                                                                              +                )
                                                                                                                                              +                ack.response = response
                                                                                                                                              +            finally:
                                                                                                                                              +                self.listener_completion_handler.handle(
                                                                                                                                              +                    request=request,
                                                                                                                                              +                    response=response,
                                                                                                                                              +                )
                                                                                                                                              +
                                                                                                                                              +        for lazy_func in listener.lazy_functions:
                                                                                                                                              +            if request.lazy_function_name:
                                                                                                                                              +                func_name = get_name_for_callable(lazy_func)
                                                                                                                                              +                if func_name == request.lazy_function_name:
                                                                                                                                              +                    self.lazy_listener_runner.run(function=lazy_func, request=request)
                                                                                                                                              +                    # This HTTP response won't be sent to Slack API servers.
                                                                                                                                              +                    return BoltResponse(status=200)
                                                                                                                                              +                else:
                                                                                                                                              +                    continue
                                                                                                                                              +            else:
                                                                                                                                              +                self._start_lazy_function(lazy_func, request)
                                                                                                                                              +
                                                                                                                                              +        if response is not None:
                                                                                                                                              +            self._debug_log_completion(starting_time, response)
                                                                                                                                              +            return response
                                                                                                                                              +        elif ack.response is not None:
                                                                                                                                              +            self._debug_log_completion(starting_time, ack.response)
                                                                                                                                              +            return ack.response
                                                                                                                                              +    else:
                                                                                                                                              +        if listener.auto_acknowledgement:
                                                                                                                                              +            # acknowledge immediately in case of Events API
                                                                                                                                              +            ack()
                                                                                                                                              +
                                                                                                                                              +        if not request.lazy_only:
                                                                                                                                              +            # start the listener function asynchronously
                                                                                                                                              +            def run_ack_function_asynchronously():
                                                                                                                                              +                nonlocal ack, request, response
                                                                                                                                              +                try:
                                                                                                                                              +                    self.listener_start_handler.handle(
                                                                                                                                              +                        request=request,
                                                                                                                                              +                        response=response,
                                                                                                                                              +                    )
                                                                                                                                              +                    listener.run_ack_function(request=request, response=response)
                                                                                                                                              +                except Exception as e:
                                                                                                                                              +                    # The default response status code is 500 in this case.
                                                                                                                                              +                    # You can customize this by passing your own error handler.
                                                                                                                                              +                    if listener.auto_acknowledgement:
                                                                                                                                              +                        self.listener_error_handler.handle(
                                                                                                                                              +                            error=e,
                                                                                                                                              +                            request=request,
                                                                                                                                              +                            response=response,
                                                                                                                                              +                        )
                                                                                                                                              +                    else:
                                                                                                                                              +                        if response is None:
                                                                                                                                              +                            response = BoltResponse(status=500)
                                                                                                                                              +                        response.status = 500
                                                                                                                                              +                        if ack.response is not None:  # already acknowledged
                                                                                                                                              +                            response = None
                                                                                                                                              +                        self.listener_error_handler.handle(
                                                                                                                                              +                            error=e,
                                                                                                                                              +                            request=request,
                                                                                                                                              +                            response=response,
                                                                                                                                              +                        )
                                                                                                                                              +                        ack.response = response
                                                                                                                                              +                finally:
                                                                                                                                              +                    self.listener_completion_handler.handle(
                                                                                                                                              +                        request=request,
                                                                                                                                              +                        response=response,
                                                                                                                                              +                    )
                                                                                                                                              +
                                                                                                                                              +            self.listener_executor.submit(run_ack_function_asynchronously)
                                                                                                                                              +
                                                                                                                                              +        for lazy_func in listener.lazy_functions:
                                                                                                                                              +            if request.lazy_function_name:
                                                                                                                                              +                func_name = get_name_for_callable(lazy_func)
                                                                                                                                              +                if func_name == request.lazy_function_name:
                                                                                                                                              +                    self.lazy_listener_runner.run(function=lazy_func, request=request)
                                                                                                                                              +                    # This HTTP response won't be sent to Slack API servers.
                                                                                                                                              +                    return BoltResponse(status=200)
                                                                                                                                              +                else:
                                                                                                                                              +                    continue
                                                                                                                                              +            else:
                                                                                                                                              +                self._start_lazy_function(lazy_func, request)
                                                                                                                                              +
                                                                                                                                              +        # await for the completion of ack() in the async listener execution
                                                                                                                                              +        while ack.response is None and time.time() - starting_time <= 3:
                                                                                                                                              +            time.sleep(0.01)
                                                                                                                                              +
                                                                                                                                              +        if response is None and ack.response is None:
                                                                                                                                              +            self.logger.warning(warning_did_not_call_ack(listener_name))
                                                                                                                                              +            return None
                                                                                                                                              +
                                                                                                                                              +        if response is None and ack.response is not None:
                                                                                                                                              +            response = ack.response
                                                                                                                                              +            self._debug_log_completion(starting_time, response)
                                                                                                                                              +            return response
                                                                                                                                              +
                                                                                                                                              +        if response is not None:
                                                                                                                                              +            return response
                                                                                                                                              +
                                                                                                                                              +    # None for both means no ack() in the listener
                                                                                                                                              +    return None
                                                                                                                                              +

                                                                                                                                        @@ -303,7 +451,7 @@

                                                                                                                                        diff --git a/docs/static/api-docs/slack_bolt/listener_matcher/async_builtins.html b/docs/static/api-docs/slack_bolt/listener_matcher/async_builtins.html index ecc236cf..b99d07c8 100644 --- a/docs/static/api-docs/slack_bolt/listener_matcher/async_builtins.html +++ b/docs/static/api-docs/slack_bolt/listener_matcher/async_builtins.html @@ -3,19 +3,30 @@ - + slack_bolt.listener_matcher.async_builtins API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                        Classes

                                                                                                                                        (*,
                                                                                                                                        func: Callable[..., bool | Awaitable[bool]],
                                                                                                                                        base_logger: logging.Logger | None = None)
                                                                                                                                        -
                                                                                                                                        Expand source code @@ -57,6 +67,7 @@

                                                                                                                                        Classes

                                                                                                                                        ) )
                                                                                                                                        +

                                                                                                                                        Ancestors

                                                                                                                                        • BuiltinListenerMatcher
                                                                                                                                        • @@ -101,7 +112,7 @@

                                                                                                                                          -

                                                                                                                                          Generated by pdoc 0.11.3.

                                                                                                                                          +

                                                                                                                                          Generated by pdoc 0.11.5.

                                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/listener_matcher/async_listener_matcher.html b/docs/static/api-docs/slack_bolt/listener_matcher/async_listener_matcher.html index 04fcc5c4..bc867630 100644 --- a/docs/static/api-docs/slack_bolt/listener_matcher/async_listener_matcher.html +++ b/docs/static/api-docs/slack_bolt/listener_matcher/async_listener_matcher.html @@ -3,19 +3,30 @@ - + slack_bolt.listener_matcher.async_listener_matcher API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                          Classes

                                                                                                                                          (*,
                                                                                                                                          app_name: str,
                                                                                                                                          func: Callable[..., Awaitable[bool]],
                                                                                                                                          base_logger: logging.Logger | None = None)
                                                                                                                                          -
                                                                                                                                          Expand source code @@ -68,6 +78,7 @@

                                                                                                                                          Classes

                                                                                                                                          ) )
                                                                                                                                          +

                                                                                                                                          Ancestors

                                                                                                                                          • AsyncListenerMatcher
                                                                                                                                          • @@ -76,19 +87,19 @@

                                                                                                                                            Class variables

                                                                                                                                            var app_name : str
                                                                                                                                            -
                                                                                                                                            +

                                                                                                                                            The type of the None singleton.

                                                                                                                                            var arg_names : Sequence[str]
                                                                                                                                            -
                                                                                                                                            +

                                                                                                                                            The type of the None singleton.

                                                                                                                                            var func : Callable[..., Awaitable[bool]]
                                                                                                                                            -
                                                                                                                                            +

                                                                                                                                            The type of the None singleton.

                                                                                                                                            var logger : logging.Logger
                                                                                                                                            -
                                                                                                                                            +

                                                                                                                                            The type of the None singleton.

                                                                                                                                            Methods

                                                                                                                                            @@ -97,6 +108,21 @@

                                                                                                                                            Methods

                                                                                                                                            async def async_matches(self,
                                                                                                                                            req: AsyncBoltRequest,
                                                                                                                                            resp: BoltResponse) ‑> bool
                                                                                                                                            +
                                                                                                                                            + +Expand source code + +
                                                                                                                                            async def async_matches(self, req: AsyncBoltRequest, resp: BoltResponse) -> bool:
                                                                                                                                            +    return await self.func(
                                                                                                                                            +        **build_async_required_kwargs(
                                                                                                                                            +            logger=self.logger,
                                                                                                                                            +            required_arg_names=self.arg_names,  # type: ignore[arg-type]
                                                                                                                                            +            request=req,
                                                                                                                                            +            response=resp,
                                                                                                                                            +            this_func=self.func,
                                                                                                                                            +        )
                                                                                                                                            +    )
                                                                                                                                            +

                                                                                                                                            Matches against the request and returns True if matched.

                                                                                                                                            Args

                                                                                                                                            @@ -115,7 +141,6 @@

                                                                                                                                            Returns

                                                                                                                                            (*,
                                                                                                                                            app_name: str,
                                                                                                                                            func: Callable[..., Awaitable[bool]],
                                                                                                                                            base_logger: logging.Logger | None = None)
                                                                                                                                            -
                                                                                                                                            Expand source code @@ -143,6 +168,7 @@

                                                                                                                                            Returns

                                                                                                                                            ) )
                                                                                                                                            +

                                                                                                                                            Ancestors

                                                                                                                                            • AsyncListenerMatcher
                                                                                                                                            • @@ -151,19 +177,19 @@

                                                                                                                                              Class variables

                                                                                                                                              var app_name : str
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              var arg_names : Sequence[str]
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              var func : Callable[..., Awaitable[bool]]
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              var logger : logging.Logger
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              Inherited members

                                                                                                                                              @@ -179,7 +205,6 @@

                                                                                                                                              Inherited members

                                                                                                                                              class AsyncListenerMatcher
                                                                                                                                              -
                                                                                                                                              Expand source code @@ -198,6 +223,7 @@

                                                                                                                                              Inherited members

                                                                                                                                              """ raise NotImplementedError()
                                                                                                                                              +

                                                                                                                                              Subclasses

                                                                                                                                              • AsyncBuiltinListenerMatcher
                                                                                                                                              • @@ -209,6 +235,23 @@

                                                                                                                                                Methods

                                                                                                                                                async def async_matches(self,
                                                                                                                                                req: AsyncBoltRequest,
                                                                                                                                                resp: BoltResponse) ‑> bool
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                @abstractmethod
                                                                                                                                                +async def async_matches(self, req: AsyncBoltRequest, resp: BoltResponse) -> bool:
                                                                                                                                                +    """Matches against the request and returns True if matched.
                                                                                                                                                +
                                                                                                                                                +    Args:
                                                                                                                                                +        req: The request
                                                                                                                                                +        resp: The response
                                                                                                                                                +
                                                                                                                                                +    Returns:
                                                                                                                                                +        True if matched
                                                                                                                                                +    """
                                                                                                                                                +    raise NotImplementedError()
                                                                                                                                                +

                                                                                                                                                Matches against the request and returns True if matched.

                                                                                                                                                Args

                                                                                                                                                @@ -268,7 +311,7 @@

                                                                                                                                                -

                                                                                                                                                Generated by pdoc 0.11.3.

                                                                                                                                                +

                                                                                                                                                Generated by pdoc 0.11.5.

                                                                                                                                                diff --git a/docs/static/api-docs/slack_bolt/listener_matcher/builtins.html b/docs/static/api-docs/slack_bolt/listener_matcher/builtins.html index eb1b2a48..1f9e3e67 100644 --- a/docs/static/api-docs/slack_bolt/listener_matcher/builtins.html +++ b/docs/static/api-docs/slack_bolt/listener_matcher/builtins.html @@ -3,19 +3,30 @@ - + slack_bolt.listener_matcher.builtins API documentation - + @@ -34,135 +45,547 @@

                                                                                                                                                Module slack_bolt.listener_matcher.builtins

                                                                                                                                                Functions

                                                                                                                                                -def action(constraints: str | re.Pattern | Dict[str, str | re.Pattern],
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def action(constraints: str | re.Pattern | Dict[str, str | re.Pattern],
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def action(
                                                                                                                                                +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    if isinstance(constraints, (str, Pattern)):
                                                                                                                                                +
                                                                                                                                                +        def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +            return (
                                                                                                                                                +                _block_action(constraints, body)
                                                                                                                                                +                or _attachment_action(constraints, body)
                                                                                                                                                +                or _dialog_submission(constraints, body)
                                                                                                                                                +                or _dialog_cancellation(constraints, body)
                                                                                                                                                +                or _workflow_step_edit(constraints, body)
                                                                                                                                                +            )
                                                                                                                                                +
                                                                                                                                                +        return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                +    elif "type" in constraints:
                                                                                                                                                +        action_type = constraints["type"]
                                                                                                                                                +        if action_type == "block_actions":
                                                                                                                                                +            return block_action(constraints, asyncio)
                                                                                                                                                +        if action_type == "interactive_message":
                                                                                                                                                +            return attachment_action(constraints["callback_id"], asyncio)
                                                                                                                                                +        if action_type == "dialog_submission":
                                                                                                                                                +            return dialog_submission(constraints["callback_id"], asyncio)
                                                                                                                                                +        if action_type == "dialog_cancellation":
                                                                                                                                                +            return dialog_cancellation(constraints["callback_id"], asyncio)
                                                                                                                                                +        # https://api.slack.com/workflows/steps
                                                                                                                                                +        if action_type == "workflow_step_edit":
                                                                                                                                                +            return workflow_step_edit(constraints["callback_id"], asyncio)
                                                                                                                                                +
                                                                                                                                                +        raise BoltError(f"type: {action_type} is unsupported")
                                                                                                                                                +    elif "action_id" in constraints or "block_id" in constraints:
                                                                                                                                                +        # The default value is "block_actions"
                                                                                                                                                +        return block_action(constraints, asyncio)
                                                                                                                                                +
                                                                                                                                                +    raise BoltError(f"action ({constraints}: {type(constraints)}) must be any of str, Pattern, and dict")
                                                                                                                                                +
                                                                                                                                                -def attachment_action(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def attachment_action(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def attachment_action(
                                                                                                                                                +    callback_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return _attachment_action(callback_id, body)
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def block_action(constraints: str | re.Pattern | Dict[str, str | re.Pattern],
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def block_action(constraints: str | re.Pattern | Dict[str, str | re.Pattern],
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def block_action(
                                                                                                                                                +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return _block_action(constraints, body)
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def block_suggestion(action_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def block_suggestion(action_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def block_suggestion(
                                                                                                                                                +    action_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return _block_suggestion(action_id, body)
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def build_listener_matcher(func: Callable[..., bool],
                                                                                                                                                asyncio: bool,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def build_listener_matcher(func: Callable[..., bool],
                                                                                                                                                asyncio: bool,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def build_listener_matcher(
                                                                                                                                                +    func: Callable[..., bool],
                                                                                                                                                +    asyncio: bool,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    if asyncio:
                                                                                                                                                +        from .async_builtins import AsyncBuiltinListenerMatcher
                                                                                                                                                +
                                                                                                                                                +        async def async_fun(body: Dict[str, Any]) -> bool:
                                                                                                                                                +            return func(body)
                                                                                                                                                +
                                                                                                                                                +        return AsyncBuiltinListenerMatcher(func=async_fun, base_logger=base_logger)
                                                                                                                                                +    else:
                                                                                                                                                +        return BuiltinListenerMatcher(func=func, base_logger=base_logger)
                                                                                                                                                +
                                                                                                                                                -def command(command: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def command(command: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def command(
                                                                                                                                                +    command: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return is_slash_command(body) and _matches(command, body["command"])
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def dialog_cancellation(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def dialog_cancellation(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def dialog_cancellation(
                                                                                                                                                +    callback_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return _dialog_cancellation(callback_id, body)
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def dialog_submission(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def dialog_submission(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def dialog_submission(
                                                                                                                                                +    callback_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return _dialog_submission(callback_id, body)
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def dialog_suggestion(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def dialog_suggestion(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def dialog_suggestion(
                                                                                                                                                +    callback_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return _dialog_suggestion(callback_id, body)
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def event(constraints: str | re.Pattern | Dict[str, str | Sequence[str | re.Pattern | None] | None],
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def event(constraints: str | re.Pattern | Dict[str, str | Sequence[str | re.Pattern | None] | None],
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def event(
                                                                                                                                                +    constraints: Union[
                                                                                                                                                +        str,
                                                                                                                                                +        Pattern,
                                                                                                                                                +        Dict[str, Optional[Union[str, Sequence[Optional[Union[str, Pattern]]]]]],
                                                                                                                                                +    ],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    if isinstance(constraints, (str, Pattern)):
                                                                                                                                                +        event_type: Union[str, Pattern] = constraints
                                                                                                                                                +        _verify_message_event_type(event_type)
                                                                                                                                                +
                                                                                                                                                +        def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +            return is_event(body) and _matches(event_type, body["event"]["type"])
                                                                                                                                                +
                                                                                                                                                +        return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                +    elif "type" in constraints:
                                                                                                                                                +        _verify_message_event_type(constraints["type"])  # type: ignore[arg-type]
                                                                                                                                                +
                                                                                                                                                +        def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +            if is_event(body):
                                                                                                                                                +                return _check_event_subtype(
                                                                                                                                                +                    event_payload=body["event"],
                                                                                                                                                +                    constraints=constraints,
                                                                                                                                                +                )
                                                                                                                                                +            return False
                                                                                                                                                +
                                                                                                                                                +        return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                +    raise BoltError(f"event ({constraints}: {type(constraints)}) must be any of str, Pattern, and dict")
                                                                                                                                                +
                                                                                                                                                -def function_executed(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def function_executed(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def function_executed(
                                                                                                                                                +    callback_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return is_function(body) and _matches(callback_id, body.get("event", {}).get("function", {}).get("callback_id", ""))
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def global_shortcut(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def global_shortcut(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def global_shortcut(
                                                                                                                                                +    callback_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return is_global_shortcut(body) and _matches(callback_id, body["callback_id"])
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def message_event(constraints: Dict[str, str | Sequence[str | re.Pattern | None] | None],
                                                                                                                                                keyword: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def message_event(constraints: Dict[str, str | Sequence[str | re.Pattern | None] | None],
                                                                                                                                                keyword: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def message_event(
                                                                                                                                                +    constraints: Dict[str, Optional[Union[str, Sequence[Optional[Union[str, Pattern]]]]]],
                                                                                                                                                +    keyword: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    if "type" in constraints and keyword is not None:
                                                                                                                                                +        _verify_message_event_type(constraints["type"])  # type: ignore[arg-type]
                                                                                                                                                +
                                                                                                                                                +        def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +            if is_event(body):
                                                                                                                                                +                is_valid_subtype = _check_event_subtype(
                                                                                                                                                +                    event_payload=body["event"],
                                                                                                                                                +                    constraints=constraints,
                                                                                                                                                +                )
                                                                                                                                                +                if is_valid_subtype is True:
                                                                                                                                                +                    # Check keyword matching
                                                                                                                                                +                    text = body.get("event", {}).get("text", "")
                                                                                                                                                +                    match_result = re.findall(keyword, text)
                                                                                                                                                +                    if match_result is not None and match_result != []:
                                                                                                                                                +                        return True
                                                                                                                                                +            return False
                                                                                                                                                +
                                                                                                                                                +        return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                +    raise BoltError(f"event ({constraints}: {type(constraints)}) must be dict")
                                                                                                                                                +
                                                                                                                                                -def message_shortcut(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def message_shortcut(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def message_shortcut(
                                                                                                                                                +    callback_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return is_message_shortcut(body) and _matches(callback_id, body["callback_id"])
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def options(constraints: str | re.Pattern | Dict[str, str | re.Pattern],
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def options(constraints: str | re.Pattern | Dict[str, str | re.Pattern],
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def options(
                                                                                                                                                +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    if isinstance(constraints, (str, Pattern)):
                                                                                                                                                +
                                                                                                                                                +        def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +            return _block_suggestion(constraints, body) or _dialog_suggestion(constraints, body)
                                                                                                                                                +
                                                                                                                                                +        return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                +    if "action_id" in constraints:
                                                                                                                                                +        return block_suggestion(constraints["action_id"], asyncio)
                                                                                                                                                +    if "callback_id" in constraints:
                                                                                                                                                +        return dialog_suggestion(constraints["callback_id"], asyncio)
                                                                                                                                                +    else:
                                                                                                                                                +        raise BoltError(f"options ({constraints}: {type(constraints)}) must be any of str, Pattern, and dict")
                                                                                                                                                +
                                                                                                                                                -def shortcut(constraints: str | re.Pattern | Dict[str, str | re.Pattern],
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def shortcut(constraints: str | re.Pattern | Dict[str, str | re.Pattern],
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def shortcut(
                                                                                                                                                +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    if isinstance(constraints, (str, Pattern)):
                                                                                                                                                +        callback_id: Union[str, Pattern] = constraints
                                                                                                                                                +
                                                                                                                                                +        def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +            return is_shortcut(body) and _matches(callback_id, body["callback_id"])
                                                                                                                                                +
                                                                                                                                                +        return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                +    elif "type" in constraints and "callback_id" in constraints:
                                                                                                                                                +        if constraints["type"] == "shortcut":
                                                                                                                                                +            return global_shortcut(constraints["callback_id"], asyncio)
                                                                                                                                                +        if constraints["type"] == "message_action":
                                                                                                                                                +            return message_shortcut(constraints["callback_id"], asyncio)
                                                                                                                                                +
                                                                                                                                                +    raise BoltError(f"shortcut ({constraints}: {type(constraints)}) must be any of str, Pattern, and dict")
                                                                                                                                                +
                                                                                                                                                -def view(constraints: str | re.Pattern | Dict[str, str | re.Pattern],
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def view(constraints: str | re.Pattern | Dict[str, str | re.Pattern],
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def view(
                                                                                                                                                +    constraints: Union[str, Pattern, Dict[str, Union[str, Pattern]]],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    if isinstance(constraints, (str, Pattern)):
                                                                                                                                                +        return view_submission(constraints, asyncio)
                                                                                                                                                +    elif "type" in constraints:
                                                                                                                                                +        if constraints["type"] == "view_submission":
                                                                                                                                                +            return view_submission(constraints["callback_id"], asyncio)
                                                                                                                                                +        if constraints["type"] == "view_closed":
                                                                                                                                                +            return view_closed(constraints["callback_id"], asyncio)
                                                                                                                                                +
                                                                                                                                                +    raise BoltError(f"view ({constraints}: {type(constraints)}) must be any of str, Pattern, and dict")
                                                                                                                                                +
                                                                                                                                                -def view_closed(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def view_closed(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def view_closed(
                                                                                                                                                +    callback_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return is_view_closed(body) and _matches(callback_id, body["view"]["callback_id"])
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def view_submission(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def view_submission(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def view_submission(
                                                                                                                                                +    callback_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return is_view_submission(body) and _matches(callback_id, body["view"]["callback_id"])
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def workflow_step_edit(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def workflow_step_edit(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def workflow_step_edit(
                                                                                                                                                +    callback_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return _workflow_step_edit(callback_id, body)
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def workflow_step_execute(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def workflow_step_execute(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def workflow_step_execute(
                                                                                                                                                +    callback_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return (
                                                                                                                                                +            is_event(body)
                                                                                                                                                +            and _matches("workflow_step_execute", body["event"]["type"])
                                                                                                                                                +            and "workflow_step" in body["event"]
                                                                                                                                                +            and _matches(callback_id, body["event"]["callback_id"])
                                                                                                                                                +        )
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                -def workflow_step_save(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                +def workflow_step_save(callback_id: str | re.Pattern,
                                                                                                                                                asyncio: bool = False,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> ListenerMatcher | AsyncListenerMatcher
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def workflow_step_save(
                                                                                                                                                +    callback_id: Union[str, Pattern],
                                                                                                                                                +    asyncio: bool = False,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Union[ListenerMatcher, "AsyncListenerMatcher"]:  # type: ignore[name-defined]
                                                                                                                                                +    def func(body: Dict[str, Any]) -> bool:
                                                                                                                                                +        return is_workflow_step_save(body) and _matches(callback_id, body["view"]["callback_id"])
                                                                                                                                                +
                                                                                                                                                +    return build_listener_matcher(func, asyncio, base_logger)
                                                                                                                                                +
                                                                                                                                                @@ -175,7 +598,6 @@

                                                                                                                                                Classes

                                                                                                                                                (*,
                                                                                                                                                func: Callable[..., bool | Awaitable[bool]],
                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                -
                                                                                                                                                Expand source code @@ -202,6 +624,7 @@

                                                                                                                                                Classes

                                                                                                                                                ) )
                                                                                                                                                +

                                                                                                                                                Ancestors

                                                                                                                                                • ListenerMatcher
                                                                                                                                                • @@ -269,7 +692,7 @@

                                                                                                                                                  diff --git a/docs/static/api-docs/slack_bolt/listener_matcher/custom_listener_matcher.html b/docs/static/api-docs/slack_bolt/listener_matcher/custom_listener_matcher.html index 238665d8..8009e84a 100644 --- a/docs/static/api-docs/slack_bolt/listener_matcher/custom_listener_matcher.html +++ b/docs/static/api-docs/slack_bolt/listener_matcher/custom_listener_matcher.html @@ -3,19 +3,30 @@ - + slack_bolt.listener_matcher.custom_listener_matcher API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                                  Classes

                                                                                                                                                  (*,
                                                                                                                                                  app_name: str,
                                                                                                                                                  func: Callable[..., bool],
                                                                                                                                                  base_logger: logging.Logger | None = None)
                                                                                                                                                  -
                                                                                                                                                  Expand source code @@ -68,6 +78,7 @@

                                                                                                                                                  Classes

                                                                                                                                                  ) )
                                                                                                                                                  +

                                                                                                                                                  Ancestors

                                                                                                                                                  • ListenerMatcher
                                                                                                                                                  • @@ -76,19 +87,19 @@

                                                                                                                                                    Class variables

                                                                                                                                                    var app_name : str
                                                                                                                                                    -
                                                                                                                                                    +

                                                                                                                                                    The type of the None singleton.

                                                                                                                                                    var arg_names : MutableSequence[str]
                                                                                                                                                    -
                                                                                                                                                    +

                                                                                                                                                    The type of the None singleton.

                                                                                                                                                    var func : Callable[..., bool]
                                                                                                                                                    -
                                                                                                                                                    +

                                                                                                                                                    The type of the None singleton.

                                                                                                                                                    var logger : logging.Logger
                                                                                                                                                    -
                                                                                                                                                    +

                                                                                                                                                    The type of the None singleton.

                                                                                                                                                    Inherited members

                                                                                                                                                    @@ -130,7 +141,7 @@

                                                                                                                                                    -

                                                                                                                                                    Generated by pdoc 0.11.3.

                                                                                                                                                    +

                                                                                                                                                    Generated by pdoc 0.11.5.

                                                                                                                                                    diff --git a/docs/static/api-docs/slack_bolt/listener_matcher/index.html b/docs/static/api-docs/slack_bolt/listener_matcher/index.html index e9aef088..622a5e9d 100644 --- a/docs/static/api-docs/slack_bolt/listener_matcher/index.html +++ b/docs/static/api-docs/slack_bolt/listener_matcher/index.html @@ -3,20 +3,31 @@ - + slack_bolt.listener_matcher API documentation - + @@ -67,7 +78,6 @@

                                                                                                                                                    Classes

                                                                                                                                                    (*,
                                                                                                                                                    app_name: str,
                                                                                                                                                    func: Callable[..., bool],
                                                                                                                                                    base_logger: logging.Logger | None = None)
                                                                                                                                                    -
                                                                                                                                                    Expand source code @@ -95,6 +105,7 @@

                                                                                                                                                    Classes

                                                                                                                                                    ) )
                                                                                                                                                    +

                                                                                                                                                    Ancestors

                                                                                                                                                    • ListenerMatcher
                                                                                                                                                    • @@ -103,19 +114,19 @@

                                                                                                                                                      Class variables

                                                                                                                                                      var app_name : str
                                                                                                                                                      -
                                                                                                                                                      +

                                                                                                                                                      The type of the None singleton.

                                                                                                                                                      var arg_names : MutableSequence[str]
                                                                                                                                                      -
                                                                                                                                                      +

                                                                                                                                                      The type of the None singleton.

                                                                                                                                                      var func : Callable[..., bool]
                                                                                                                                                      -
                                                                                                                                                      +

                                                                                                                                                      The type of the None singleton.

                                                                                                                                                      var logger : logging.Logger
                                                                                                                                                      -
                                                                                                                                                      +

                                                                                                                                                      The type of the None singleton.

                                                                                                                                                      Inherited members

                                                                                                                                                      @@ -131,7 +142,6 @@

                                                                                                                                                      Inherited members

                                                                                                                                                      class ListenerMatcher
                                                                                                                                                      -
                                                                                                                                                      Expand source code @@ -150,6 +160,7 @@

                                                                                                                                                      Inherited members

                                                                                                                                                      """ raise NotImplementedError()
                                                                                                                                                      +

                                                                                                                                                      Subclasses

                                                                                                                                                      • BuiltinListenerMatcher
                                                                                                                                                      • @@ -161,6 +172,23 @@

                                                                                                                                                        Methods

                                                                                                                                                        def matches(self,
                                                                                                                                                        req: BoltRequest,
                                                                                                                                                        resp: BoltResponse) ‑> bool
                                                                                                                                                        +
                                                                                                                                                        + +Expand source code + +
                                                                                                                                                        @abstractmethod
                                                                                                                                                        +def matches(self, req: BoltRequest, resp: BoltResponse) -> bool:
                                                                                                                                                        +    """Matches against the request and returns True if matched.
                                                                                                                                                        +
                                                                                                                                                        +    Args:
                                                                                                                                                        +        req: The request
                                                                                                                                                        +        resp: The response
                                                                                                                                                        +
                                                                                                                                                        +    Returns:
                                                                                                                                                        +        True if matched.
                                                                                                                                                        +    """
                                                                                                                                                        +    raise NotImplementedError()
                                                                                                                                                        +

                                                                                                                                                        Matches against the request and returns True if matched.

                                                                                                                                                        Args

                                                                                                                                                        @@ -219,7 +247,7 @@

                                                                                                                                                        -

                                                                                                                                                        Generated by pdoc 0.11.3.

                                                                                                                                                        +

                                                                                                                                                        Generated by pdoc 0.11.5.

                                                                                                                                                        diff --git a/docs/static/api-docs/slack_bolt/listener_matcher/listener_matcher.html b/docs/static/api-docs/slack_bolt/listener_matcher/listener_matcher.html index 8beab61c..a2081608 100644 --- a/docs/static/api-docs/slack_bolt/listener_matcher/listener_matcher.html +++ b/docs/static/api-docs/slack_bolt/listener_matcher/listener_matcher.html @@ -3,19 +3,30 @@ - + slack_bolt.listener_matcher.listener_matcher API documentation - + @@ -39,7 +50,6 @@

                                                                                                                                                        Classes

                                                                                                                                                        class ListenerMatcher
                                                                                                                                                        -
                                                                                                                                                        Expand source code @@ -58,6 +68,7 @@

                                                                                                                                                        Classes

                                                                                                                                                        """ raise NotImplementedError()
                                                                                                                                                        +

                                                                                                                                                        Subclasses

                                                                                                                                                        • BuiltinListenerMatcher
                                                                                                                                                        • @@ -69,6 +80,23 @@

                                                                                                                                                          Methods

                                                                                                                                                          def matches(self,
                                                                                                                                                          req: BoltRequest,
                                                                                                                                                          resp: BoltResponse) ‑> bool
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          @abstractmethod
                                                                                                                                                          +def matches(self, req: BoltRequest, resp: BoltResponse) -> bool:
                                                                                                                                                          +    """Matches against the request and returns True if matched.
                                                                                                                                                          +
                                                                                                                                                          +    Args:
                                                                                                                                                          +        req: The request
                                                                                                                                                          +        resp: The response
                                                                                                                                                          +
                                                                                                                                                          +    Returns:
                                                                                                                                                          +        True if matched.
                                                                                                                                                          +    """
                                                                                                                                                          +    raise NotImplementedError()
                                                                                                                                                          +

                                                                                                                                                          Matches against the request and returns True if matched.

                                                                                                                                                          Args

                                                                                                                                                          @@ -109,7 +137,7 @@

                                                                                                                                                          -

                                                                                                                                                          Generated by pdoc 0.11.3.

                                                                                                                                                          +

                                                                                                                                                          Generated by pdoc 0.11.5.

                                                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/logger/index.html b/docs/static/api-docs/slack_bolt/logger/index.html index 825b0721..c9defacd 100644 --- a/docs/static/api-docs/slack_bolt/logger/index.html +++ b/docs/static/api-docs/slack_bolt/logger/index.html @@ -3,19 +3,30 @@ - + slack_bolt.logger API documentation - + @@ -45,12 +56,39 @@

                                                                                                                                                          Functions

                                                                                                                                                          def get_bolt_app_logger(app_name: str, cls: object = None, base_logger: logging.Logger | None = None) ‑> logging.Logger
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def get_bolt_app_logger(app_name: str, cls: object = None, base_logger: Optional[Logger] = None) -> Logger:
                                                                                                                                                          +    logger: Logger = (
                                                                                                                                                          +        logging.getLogger(f"{app_name}:{cls.__name__}") if cls and hasattr(cls, "__name__") else logging.getLogger(app_name)
                                                                                                                                                          +    )
                                                                                                                                                          +
                                                                                                                                                          +    if base_logger is not None:
                                                                                                                                                          +        _configure_from_base_logger(logger, base_logger)
                                                                                                                                                          +    else:
                                                                                                                                                          +        _configure_from_root(logger)
                                                                                                                                                          +    return logger
                                                                                                                                                          +
                                                                                                                                                          def get_bolt_logger(cls: Any, base_logger: logging.Logger | None = None) ‑> logging.Logger
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def get_bolt_logger(cls: Any, base_logger: Optional[Logger] = None) -> Logger:
                                                                                                                                                          +    logger = logging.getLogger(f"slack_bolt.{cls.__name__}")
                                                                                                                                                          +    if base_logger is not None:
                                                                                                                                                          +        _configure_from_base_logger(logger, base_logger)
                                                                                                                                                          +    else:
                                                                                                                                                          +        _configure_from_root(logger)
                                                                                                                                                          +    return logger
                                                                                                                                                          +

                                                                                                                                                          @@ -83,7 +121,7 @@

                                                                                                                                                          Functions

                                                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/logger/messages.html b/docs/static/api-docs/slack_bolt/logger/messages.html index 37451045..23ef874d 100644 --- a/docs/static/api-docs/slack_bolt/logger/messages.html +++ b/docs/static/api-docs/slack_bolt/logger/messages.html @@ -3,19 +3,30 @@ - + slack_bolt.logger.messages API documentation - + @@ -37,162 +48,511 @@

                                                                                                                                                          Functions

                                                                                                                                                          def debug_applying_middleware(middleware_name: str) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def debug_applying_middleware(middleware_name: str) -> str:
                                                                                                                                                          +    return f"Applying {middleware_name}"
                                                                                                                                                          +
                                                                                                                                                          def debug_checking_listener(listener_name: str) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def debug_checking_listener(listener_name: str) -> str:
                                                                                                                                                          +    return f"Checking listener: {listener_name} ..."
                                                                                                                                                          +
                                                                                                                                                          def debug_responding(status: int, body: str, millis: int) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def debug_responding(status: int, body: str, millis: int) -> str:
                                                                                                                                                          +    return f'Responding with status: {status} body: "{body}" ({millis} millis)'
                                                                                                                                                          +
                                                                                                                                                          def debug_return_listener_middleware_response(listener_name: str, status: int, body: str, starting_time: float) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def debug_return_listener_middleware_response(listener_name: str, status: int, body: str, starting_time: float) -> str:
                                                                                                                                                          +    millis = int((time.time() - starting_time) * 1000)
                                                                                                                                                          +    return (
                                                                                                                                                          +        "Responding with listener middleware's response - "
                                                                                                                                                          +        f"listener: {listener_name}, status: {status}, body: {body} ({millis} millis)"
                                                                                                                                                          +    )
                                                                                                                                                          +
                                                                                                                                                          def debug_running_lazy_listener(func_name: str) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def debug_running_lazy_listener(func_name: str) -> str:
                                                                                                                                                          +    return f"Running lazy listener: {func_name} ..."
                                                                                                                                                          +
                                                                                                                                                          def debug_running_listener(listener_name: str) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def debug_running_listener(listener_name: str) -> str:
                                                                                                                                                          +    return f"Running listener: {listener_name} ..."
                                                                                                                                                          +
                                                                                                                                                          def error_auth_test_failure(error_response: slack_sdk.web.slack_response.SlackResponse) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def error_auth_test_failure(error_response: SlackResponse) -> str:
                                                                                                                                                          +    return f"`token` is invalid (auth.test result: {error_response})"
                                                                                                                                                          +
                                                                                                                                                          def error_authorize_conflicts() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def error_authorize_conflicts() -> str:
                                                                                                                                                          +    return "`authorize` in the top-level arguments is not allowed when you pass either `oauth_settings` or `oauth_flow`"
                                                                                                                                                          +
                                                                                                                                                          def error_client_invalid_type() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def error_client_invalid_type() -> str:
                                                                                                                                                          +    return "`client` must be a slack_sdk.web.WebClient"
                                                                                                                                                          +
                                                                                                                                                          def error_client_invalid_type_async() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def error_client_invalid_type_async() -> str:
                                                                                                                                                          +    return "`client` must be a slack_sdk.web.async_client.AsyncWebClient"
                                                                                                                                                          +
                                                                                                                                                          def error_installation_store_required_for_builtin_listeners() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def error_installation_store_required_for_builtin_listeners() -> str:
                                                                                                                                                          +    return (
                                                                                                                                                          +        "To use the event listeners for token revocation handling, "
                                                                                                                                                          +        "setting a valid `installation_store` to `App`/`AsyncApp` is required."
                                                                                                                                                          +    )
                                                                                                                                                          +
                                                                                                                                                          def error_listener_function_must_be_coro_func(func_name: str) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def error_listener_function_must_be_coro_func(func_name: str) -> str:
                                                                                                                                                          +    return f"The listener function ({func_name}) is not a coroutine function."
                                                                                                                                                          +
                                                                                                                                                          def error_message_event_type(event_type: str) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def error_message_event_type(event_type: str) -> str:
                                                                                                                                                          +    return (
                                                                                                                                                          +        f'Although the document mentions "{event_type}", '
                                                                                                                                                          +        'it is not a valid event type. Use "message" instead. '
                                                                                                                                                          +        "If you want to filter message events, you can use `event.channel_type` for it."
                                                                                                                                                          +    )
                                                                                                                                                          +
                                                                                                                                                          def error_oauth_flow_invalid_type_async() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def error_oauth_flow_invalid_type_async() -> str:
                                                                                                                                                          +    return "`oauth_flow` must be a slack_bolt.oauth.async_oauth_flow.AsyncOAuthFlow"
                                                                                                                                                          +
                                                                                                                                                          def error_oauth_flow_or_authorize_required() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def error_oauth_flow_or_authorize_required() -> str:
                                                                                                                                                          +    return "`oauth_flow` or `authorize` must be configured to make a Bolt app"
                                                                                                                                                          +
                                                                                                                                                          def error_oauth_settings_invalid_type_async() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def error_oauth_settings_invalid_type_async() -> str:
                                                                                                                                                          +    return "`oauth_settings` must be a slack_bolt.oauth.async_oauth_settings.AsyncOAuthSettings"
                                                                                                                                                          +
                                                                                                                                                          def error_token_required() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def error_token_required() -> str:
                                                                                                                                                          +    return "Either an env variable `SLACK_BOT_TOKEN` " "or `token` argument in the constructor is required."
                                                                                                                                                          +
                                                                                                                                                          def error_unexpected_listener_middleware(middleware_type) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def error_unexpected_listener_middleware(middleware_type) -> str:
                                                                                                                                                          +    return f"Unexpected value for a listener middleware: {middleware_type}"
                                                                                                                                                          +
                                                                                                                                                          def info_default_oauth_settings_loaded() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def info_default_oauth_settings_loaded() -> str:
                                                                                                                                                          +    return (
                                                                                                                                                          +        "As you've set SLACK_CLIENT_ID and SLACK_CLIENT_SECRET env variables, "
                                                                                                                                                          +        "Bolt has enabled the file-based InstallationStore/OAuthStateStore for you. "
                                                                                                                                                          +        "Note that these file-based stores are for local development. "
                                                                                                                                                          +        "If you'd like to use a different data store, set the oauth_settings argument in the App constructor. "
                                                                                                                                                          +        "Please refer to https://slack.dev/bolt-python/concepts#authenticating-oauth for more details."
                                                                                                                                                          +    )
                                                                                                                                                          +
                                                                                                                                                          def warning_bot_only_conflicts() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def warning_bot_only_conflicts() -> str:
                                                                                                                                                          +    return (
                                                                                                                                                          +        "installation_store_bot_only exists in both App and OAuthFlow.settings. "
                                                                                                                                                          +        "The one passed in App constructor is used."
                                                                                                                                                          +    )
                                                                                                                                                          +
                                                                                                                                                          def warning_client_prioritized_and_token_skipped() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def warning_client_prioritized_and_token_skipped() -> str:
                                                                                                                                                          +    return "As you gave `client` as well, `token` will be unused."
                                                                                                                                                          +
                                                                                                                                                          def warning_did_not_call_ack(listener_name: str) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def warning_did_not_call_ack(listener_name: str) -> str:
                                                                                                                                                          +    return f"{listener_name} didn't call ack()"
                                                                                                                                                          +
                                                                                                                                                          def warning_installation_store_conflicts() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def warning_installation_store_conflicts() -> str:
                                                                                                                                                          +    return "As you gave both `installation_store` and `oauth_settings`/`auth_flow`, the top level one is unused."
                                                                                                                                                          +
                                                                                                                                                          def warning_skip_uncommon_arg_name(arg_name: str) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def warning_skip_uncommon_arg_name(arg_name: str) -> str:
                                                                                                                                                          +    return (
                                                                                                                                                          +        f"Bolt skips injecting a value to the first keyword argument ({arg_name}). "
                                                                                                                                                          +        "If it is self/cls of a method, we recommend using the common names."
                                                                                                                                                          +    )
                                                                                                                                                          +
                                                                                                                                                          def warning_token_skipped() ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def warning_token_skipped() -> str:
                                                                                                                                                          +    return (
                                                                                                                                                          +        "As `installation_store` or `authorize` has been used, " "`token` (or SLACK_BOT_TOKEN env variable) will be ignored."
                                                                                                                                                          +    )
                                                                                                                                                          +
                                                                                                                                                          -def warning_unhandled_by_global_middleware(name: str,
                                                                                                                                                          req: BoltRequest | ForwardRef('AsyncBoltRequest'))
                                                                                                                                                          +def warning_unhandled_by_global_middleware(name: str,
                                                                                                                                                          req: BoltRequest | ForwardRef('AsyncBoltRequest')) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def warning_unhandled_by_global_middleware(
                                                                                                                                                          +    name: str, req: Union[BoltRequest, "AsyncBoltRequest"]  # type: ignore[name-defined]
                                                                                                                                                          +) -> str:
                                                                                                                                                          +    return (
                                                                                                                                                          +        f"A global middleware ({name}) skipped calling either `next()` or `next_()` "
                                                                                                                                                          +        f"without providing a response for the request ({req.body})"
                                                                                                                                                          +    )
                                                                                                                                                          +
                                                                                                                                                          -def warning_unhandled_request(req: BoltRequest | ForwardRef('AsyncBoltRequest')) +def warning_unhandled_request(req: BoltRequest | ForwardRef('AsyncBoltRequest')) ‑> str
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          def warning_unhandled_request(
                                                                                                                                                          +    req: Union[BoltRequest, "AsyncBoltRequest"],  # type: ignore[name-defined]
                                                                                                                                                          +) -> str:
                                                                                                                                                          +    filtered_body = _build_filtered_body(req.body)
                                                                                                                                                          +    default_message = f"Unhandled request ({filtered_body})"
                                                                                                                                                          +    is_async = type(req) != BoltRequest
                                                                                                                                                          +    if is_workflow_step_edit(req.body) or is_workflow_step_save(req.body) or is_workflow_step_execute(req.body):
                                                                                                                                                          +        # @app.step
                                                                                                                                                          +        callback_id = (
                                                                                                                                                          +            filtered_body.get("callback_id") or filtered_body.get("view", {}).get("callback_id") or "your-callback-id"
                                                                                                                                                          +        )
                                                                                                                                                          +        return _build_unhandled_request_suggestion(
                                                                                                                                                          +            default_message,
                                                                                                                                                          +            f"""
                                                                                                                                                          +from slack_bolt.workflows.step{'.async_step' if is_async else ''} import {'Async' if is_async else ''}WorkflowStep
                                                                                                                                                          +ws = {'Async' if is_async else ''}WorkflowStep(
                                                                                                                                                          +    callback_id="{callback_id}",
                                                                                                                                                          +    edit=edit,
                                                                                                                                                          +    save=save,
                                                                                                                                                          +    execute=execute,
                                                                                                                                                          +)
                                                                                                                                                          +# Pass Step to set up listeners
                                                                                                                                                          +app.step(ws)
                                                                                                                                                          +""",
                                                                                                                                                          +        )
                                                                                                                                                          +    if is_action(req.body):
                                                                                                                                                          +        # @app.action
                                                                                                                                                          +        action_id_or_callback_id = req.body.get("callback_id")
                                                                                                                                                          +        if req.body.get("type") == "block_actions":
                                                                                                                                                          +            action_id_or_callback_id = req.body["actions"][0].get("action_id")
                                                                                                                                                          +        return _build_unhandled_request_suggestion(
                                                                                                                                                          +            default_message,
                                                                                                                                                          +            f"""
                                                                                                                                                          +@app.action("{action_id_or_callback_id}")
                                                                                                                                                          +{'async ' if is_async else ''}def handle_some_action(ack, body, logger):
                                                                                                                                                          +    {'await ' if is_async else ''}ack()
                                                                                                                                                          +    logger.info(body)
                                                                                                                                                          +""",
                                                                                                                                                          +        )
                                                                                                                                                          +    if is_options(req.body):
                                                                                                                                                          +        # @app.options
                                                                                                                                                          +        constraints = '"action-id"'
                                                                                                                                                          +        if req.body.get("action_id") is not None:
                                                                                                                                                          +            constraints = '"' + req.body["action_id"] + '"'
                                                                                                                                                          +        elif req.body.get("type") == "dialog_suggestion":
                                                                                                                                                          +            constraints = f"""{{"type": "dialog_suggestion", "callback_id": "{req.body.get('callback_id')}"}}"""
                                                                                                                                                          +        return _build_unhandled_request_suggestion(
                                                                                                                                                          +            default_message,
                                                                                                                                                          +            f"""
                                                                                                                                                          +@app.options({constraints})
                                                                                                                                                          +{'async ' if is_async else ''}def handle_some_options(ack):
                                                                                                                                                          +    {'await ' if is_async else ''}ack(options=[ ... ])
                                                                                                                                                          +""",
                                                                                                                                                          +        )
                                                                                                                                                          +    if is_shortcut(req.body):
                                                                                                                                                          +        # @app.shortcut
                                                                                                                                                          +        id = req.body.get("action_id") or req.body.get("callback_id")
                                                                                                                                                          +        return _build_unhandled_request_suggestion(
                                                                                                                                                          +            default_message,
                                                                                                                                                          +            f"""
                                                                                                                                                          +@app.shortcut("{id}")
                                                                                                                                                          +{'async ' if is_async else ''}def handle_shortcuts(ack, body, logger):
                                                                                                                                                          +    {'await ' if is_async else ''}ack()
                                                                                                                                                          +    logger.info(body)
                                                                                                                                                          +""",
                                                                                                                                                          +        )
                                                                                                                                                          +    if is_view_submission(req.body):
                                                                                                                                                          +        # @app.view
                                                                                                                                                          +        return _build_unhandled_request_suggestion(
                                                                                                                                                          +            default_message,
                                                                                                                                                          +            f"""
                                                                                                                                                          +@app.view("{req.body.get('view', {}).get('callback_id', 'modal-view-id')}")
                                                                                                                                                          +{'async ' if is_async else ''}def handle_view_submission_events(ack, body, logger):
                                                                                                                                                          +    {'await ' if is_async else ''}ack()
                                                                                                                                                          +    logger.info(body)
                                                                                                                                                          +""",
                                                                                                                                                          +        )
                                                                                                                                                          +    if is_view_closed(req.body):
                                                                                                                                                          +        # @app.view
                                                                                                                                                          +        return _build_unhandled_request_suggestion(
                                                                                                                                                          +            default_message,
                                                                                                                                                          +            f"""
                                                                                                                                                          +@app.view_closed("{req.body.get('view', {}).get('callback_id', 'modal-view-id')}")
                                                                                                                                                          +{'async ' if is_async else ''}def handle_view_closed_events(ack, body, logger):
                                                                                                                                                          +    {'await ' if is_async else ''}ack()
                                                                                                                                                          +    logger.info(body)
                                                                                                                                                          +""",
                                                                                                                                                          +        )
                                                                                                                                                          +    if is_event(req.body):
                                                                                                                                                          +        # @app.event
                                                                                                                                                          +        event = req.body.get("event", {})
                                                                                                                                                          +        event_type = event.get("type")
                                                                                                                                                          +        if is_function(req.body):
                                                                                                                                                          +            # @app.function
                                                                                                                                                          +            callback_id = event.get("function", {}).get("callback_id", "function_id")
                                                                                                                                                          +            return _build_unhandled_request_suggestion(
                                                                                                                                                          +                default_message,
                                                                                                                                                          +                f"""
                                                                                                                                                          +@app.function("{callback_id}")
                                                                                                                                                          +{'async ' if is_async else ''}def handle_some_function(ack, body, complete, fail, logger):
                                                                                                                                                          +    {'await ' if is_async else ''}ack()
                                                                                                                                                          +    logger.info(body)
                                                                                                                                                          +    try:
                                                                                                                                                          +        # TODO: do something here
                                                                                                                                                          +        outputs = {{}}
                                                                                                                                                          +        {'await ' if is_async else ''}complete(outputs=outputs)
                                                                                                                                                          +    except Exception as e:
                                                                                                                                                          +        error = f"Failed to handle a function request (error: {{e}})"
                                                                                                                                                          +        {'await ' if is_async else ''}fail(error=error)
                                                                                                                                                          +""",
                                                                                                                                                          +            )
                                                                                                                                                          +        return _build_unhandled_request_suggestion(
                                                                                                                                                          +            default_message,
                                                                                                                                                          +            f"""
                                                                                                                                                          +@app.event("{event_type}")
                                                                                                                                                          +{'async ' if is_async else ''}def handle_{event_type}_events(body, logger):
                                                                                                                                                          +    logger.info(body)
                                                                                                                                                          +""",
                                                                                                                                                          +        )
                                                                                                                                                          +    if is_slash_command(req.body):
                                                                                                                                                          +        # @app.command
                                                                                                                                                          +        command = req.body.get("command", "/your-command")
                                                                                                                                                          +        return _build_unhandled_request_suggestion(
                                                                                                                                                          +            default_message,
                                                                                                                                                          +            f"""
                                                                                                                                                          +@app.command("{command}")
                                                                                                                                                          +{'async ' if is_async else ''}def handle_some_command(ack, body, logger):
                                                                                                                                                          +    {'await ' if is_async else ''}ack()
                                                                                                                                                          +    logger.info(body)
                                                                                                                                                          +""",
                                                                                                                                                          +        )
                                                                                                                                                          +    return default_message
                                                                                                                                                          +

                                                                                                                                                        @@ -245,7 +605,7 @@

                                                                                                                                                        Functions

                                                                                                                                                        diff --git a/docs/static/api-docs/slack_bolt/middleware/assistant/assistant.html b/docs/static/api-docs/slack_bolt/middleware/assistant/assistant.html index da6aab00..76e5dff7 100644 --- a/docs/static/api-docs/slack_bolt/middleware/assistant/assistant.html +++ b/docs/static/api-docs/slack_bolt/middleware/assistant/assistant.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.assistant.assistant API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                                        Classes

                                                                                                                                                        (*,
                                                                                                                                                        app_name: str = 'assistant',
                                                                                                                                                        thread_context_store: AssistantThreadContextStore | None = None,
                                                                                                                                                        logger: logging.Logger | None = None)
                                                                                                                                                        -

                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                        Expand source code @@ -309,6 +319,7 @@

                                                                                                                                                        Classes

                                                                                                                                                        else: raise BoltError(f"Invalid listener: {type(listener_or_functions)} detected")
                                                                                                                                                        +

                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                        Ancestors

                                                                                                                                                        • Middleware
                                                                                                                                                        • @@ -317,11 +328,11 @@

                                                                                                                                                          Class variables

                                                                                                                                                          var base_logger : logging.Logger | None
                                                                                                                                                          -
                                                                                                                                                          +

                                                                                                                                                          The type of the None singleton.

                                                                                                                                                          var thread_context_storeAssistantThreadContextStore | None
                                                                                                                                                          -
                                                                                                                                                          +

                                                                                                                                                          The type of the None singleton.

                                                                                                                                                          Static methods

                                                                                                                                                          @@ -330,6 +341,14 @@

                                                                                                                                                          Static methods

                                                                                                                                                          def default_thread_context_changed(save_thread_context: SaveThreadContext,
                                                                                                                                                          payload: dict)
                                                                                                                                                          +
                                                                                                                                                          + +Expand source code + +
                                                                                                                                                          @staticmethod
                                                                                                                                                          +def default_thread_context_changed(save_thread_context: SaveThreadContext, payload: dict):
                                                                                                                                                          +    save_thread_context(payload["assistant_thread"]["context"])
                                                                                                                                                          +

                                                                                                                                                @@ -339,30 +358,248 @@

                                                                                                                                                Methods

                                                                                                                                                def bot_message(self,
                                                                                                                                                *args,
                                                                                                                                                matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                                                                                middleware: Callable | Middleware | None = None,
                                                                                                                                                lazy: List[Callable[..., None]] | None = None)
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def bot_message(
                                                                                                                                                +    self,
                                                                                                                                                +    *args,
                                                                                                                                                +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                                                                                +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                                                                                +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                                                                +):
                                                                                                                                                +    if self._bot_message_listeners is None:
                                                                                                                                                +        self._bot_message_listeners = []
                                                                                                                                                +    all_matchers = self._merge_matchers(is_bot_message_event_in_assistant_thread, matchers)
                                                                                                                                                +    if is_used_without_argument(args):
                                                                                                                                                +        func = args[0]
                                                                                                                                                +        self._bot_message_listeners.append(
                                                                                                                                                +            self.build_listener(
                                                                                                                                                +                listener_or_functions=func,
                                                                                                                                                +                matchers=all_matchers,
                                                                                                                                                +                middleware=middleware,  # type:ignore[arg-type]
                                                                                                                                                +            )
                                                                                                                                                +        )
                                                                                                                                                +        return func
                                                                                                                                                +
                                                                                                                                                +    def _inner(func):
                                                                                                                                                +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                                                                +        self._bot_message_listeners.append(
                                                                                                                                                +            self.build_listener(
                                                                                                                                                +                listener_or_functions=functions,
                                                                                                                                                +                matchers=all_matchers,
                                                                                                                                                +                middleware=middleware,
                                                                                                                                                +            )
                                                                                                                                                +        )
                                                                                                                                                +
                                                                                                                                                +        @wraps(func)
                                                                                                                                                +        def _wrapper(*args, **kwargs):
                                                                                                                                                +            return func(*args, **kwargs)
                                                                                                                                                +
                                                                                                                                                +        return _wrapper
                                                                                                                                                +
                                                                                                                                                +    return _inner
                                                                                                                                                +
                                                                                                                                                def build_listener(self,
                                                                                                                                                listener_or_functions: Listener | Callable | List[Callable],
                                                                                                                                                matchers: List[ListenerMatcher | Callable[..., bool]] | None = None,
                                                                                                                                                middleware: List[Middleware] | None = None,
                                                                                                                                                base_logger: logging.Logger | None = None) ‑> Listener
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def build_listener(
                                                                                                                                                +    self,
                                                                                                                                                +    listener_or_functions: Union[Listener, Callable, List[Callable]],
                                                                                                                                                +    matchers: Optional[List[Union[ListenerMatcher, Callable[..., bool]]]] = None,
                                                                                                                                                +    middleware: Optional[List[Middleware]] = None,
                                                                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                                                                +) -> Listener:
                                                                                                                                                +    if isinstance(listener_or_functions, Callable):  # type:ignore[arg-type]
                                                                                                                                                +        listener_or_functions = [listener_or_functions]  # type:ignore[list-item]
                                                                                                                                                +
                                                                                                                                                +    if isinstance(listener_or_functions, Listener):
                                                                                                                                                +        return listener_or_functions
                                                                                                                                                +    elif isinstance(listener_or_functions, list):
                                                                                                                                                +        middleware = middleware if middleware else []
                                                                                                                                                +        functions = listener_or_functions
                                                                                                                                                +        ack_function = functions.pop(0)
                                                                                                                                                +
                                                                                                                                                +        matchers = matchers if matchers else []
                                                                                                                                                +        listener_matchers: List[ListenerMatcher] = []
                                                                                                                                                +        for matcher in matchers:
                                                                                                                                                +            if isinstance(matcher, ListenerMatcher):
                                                                                                                                                +                listener_matchers.append(matcher)
                                                                                                                                                +            elif isinstance(matcher, Callable):  # type:ignore[arg-type]
                                                                                                                                                +                listener_matchers.append(
                                                                                                                                                +                    build_listener_matcher(
                                                                                                                                                +                        func=matcher,
                                                                                                                                                +                        asyncio=False,
                                                                                                                                                +                        base_logger=base_logger,
                                                                                                                                                +                    )
                                                                                                                                                +                )
                                                                                                                                                +        return CustomListener(
                                                                                                                                                +            app_name=self.app_name,
                                                                                                                                                +            matchers=listener_matchers,
                                                                                                                                                +            middleware=middleware,
                                                                                                                                                +            ack_function=ack_function,
                                                                                                                                                +            lazy_functions=functions,
                                                                                                                                                +            auto_acknowledgement=True,
                                                                                                                                                +            base_logger=base_logger or self.base_logger,
                                                                                                                                                +        )
                                                                                                                                                +    else:
                                                                                                                                                +        raise BoltError(f"Invalid listener: {type(listener_or_functions)} detected")
                                                                                                                                                +
                                                                                                                                                def thread_context_changed(self,
                                                                                                                                                *args,
                                                                                                                                                matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                                                                                middleware: Callable | Middleware | None = None,
                                                                                                                                                lazy: List[Callable[..., None]] | None = None)
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def thread_context_changed(
                                                                                                                                                +    self,
                                                                                                                                                +    *args,
                                                                                                                                                +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                                                                                +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                                                                                +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                                                                +):
                                                                                                                                                +    if self._thread_context_changed_listeners is None:
                                                                                                                                                +        self._thread_context_changed_listeners = []
                                                                                                                                                +    all_matchers = self._merge_matchers(is_assistant_thread_context_changed_event, matchers)
                                                                                                                                                +    if is_used_without_argument(args):
                                                                                                                                                +        func = args[0]
                                                                                                                                                +        self._thread_context_changed_listeners.append(
                                                                                                                                                +            self.build_listener(
                                                                                                                                                +                listener_or_functions=func,
                                                                                                                                                +                matchers=all_matchers,
                                                                                                                                                +                middleware=middleware,  # type:ignore[arg-type]
                                                                                                                                                +            )
                                                                                                                                                +        )
                                                                                                                                                +        return func
                                                                                                                                                +
                                                                                                                                                +    def _inner(func):
                                                                                                                                                +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                                                                +        self._thread_context_changed_listeners.append(
                                                                                                                                                +            self.build_listener(
                                                                                                                                                +                listener_or_functions=functions,
                                                                                                                                                +                matchers=all_matchers,
                                                                                                                                                +                middleware=middleware,
                                                                                                                                                +            )
                                                                                                                                                +        )
                                                                                                                                                +
                                                                                                                                                +        @wraps(func)
                                                                                                                                                +        def _wrapper(*args, **kwargs):
                                                                                                                                                +            return func(*args, **kwargs)
                                                                                                                                                +
                                                                                                                                                +        return _wrapper
                                                                                                                                                +
                                                                                                                                                +    return _inner
                                                                                                                                                +
                                                                                                                                                def thread_started(self,
                                                                                                                                                *args,
                                                                                                                                                matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                                                                                middleware: Callable | Middleware | None = None,
                                                                                                                                                lazy: List[Callable[..., None]] | None = None)
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def thread_started(
                                                                                                                                                +    self,
                                                                                                                                                +    *args,
                                                                                                                                                +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                                                                                +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                                                                                +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                                                                +):
                                                                                                                                                +    if self._thread_started_listeners is None:
                                                                                                                                                +        self._thread_started_listeners = []
                                                                                                                                                +    all_matchers = self._merge_matchers(is_assistant_thread_started_event, matchers)
                                                                                                                                                +    if is_used_without_argument(args):
                                                                                                                                                +        func = args[0]
                                                                                                                                                +        self._thread_started_listeners.append(
                                                                                                                                                +            self.build_listener(
                                                                                                                                                +                listener_or_functions=func,
                                                                                                                                                +                matchers=all_matchers,
                                                                                                                                                +                middleware=middleware,  # type:ignore[arg-type]
                                                                                                                                                +            )
                                                                                                                                                +        )
                                                                                                                                                +        return func
                                                                                                                                                +
                                                                                                                                                +    def _inner(func):
                                                                                                                                                +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                                                                +        self._thread_started_listeners.append(
                                                                                                                                                +            self.build_listener(
                                                                                                                                                +                listener_or_functions=functions,
                                                                                                                                                +                matchers=all_matchers,
                                                                                                                                                +                middleware=middleware,
                                                                                                                                                +            )
                                                                                                                                                +        )
                                                                                                                                                +
                                                                                                                                                +        @wraps(func)
                                                                                                                                                +        def _wrapper(*args, **kwargs):
                                                                                                                                                +            return func(*args, **kwargs)
                                                                                                                                                +
                                                                                                                                                +        return _wrapper
                                                                                                                                                +
                                                                                                                                                +    return _inner
                                                                                                                                                +
                                                                                                                                                def user_message(self,
                                                                                                                                                *args,
                                                                                                                                                matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                                                                                middleware: Callable | Middleware | None = None,
                                                                                                                                                lazy: List[Callable[..., None]] | None = None)
                                                                                                                                                +
                                                                                                                                                + +Expand source code + +
                                                                                                                                                def user_message(
                                                                                                                                                +    self,
                                                                                                                                                +    *args,
                                                                                                                                                +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                                                                                +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                                                                                +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                                                                +):
                                                                                                                                                +    if self._user_message_listeners is None:
                                                                                                                                                +        self._user_message_listeners = []
                                                                                                                                                +    all_matchers = self._merge_matchers(is_user_message_event_in_assistant_thread, matchers)
                                                                                                                                                +    if is_used_without_argument(args):
                                                                                                                                                +        func = args[0]
                                                                                                                                                +        self._user_message_listeners.append(
                                                                                                                                                +            self.build_listener(
                                                                                                                                                +                listener_or_functions=func,
                                                                                                                                                +                matchers=all_matchers,
                                                                                                                                                +                middleware=middleware,  # type:ignore[arg-type]
                                                                                                                                                +            )
                                                                                                                                                +        )
                                                                                                                                                +        return func
                                                                                                                                                +
                                                                                                                                                +    def _inner(func):
                                                                                                                                                +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                                                                +        self._user_message_listeners.append(
                                                                                                                                                +            self.build_listener(
                                                                                                                                                +                listener_or_functions=functions,
                                                                                                                                                +                matchers=all_matchers,
                                                                                                                                                +                middleware=middleware,
                                                                                                                                                +            )
                                                                                                                                                +        )
                                                                                                                                                +
                                                                                                                                                +        @wraps(func)
                                                                                                                                                +        def _wrapper(*args, **kwargs):
                                                                                                                                                +            return func(*args, **kwargs)
                                                                                                                                                +
                                                                                                                                                +        return _wrapper
                                                                                                                                                +
                                                                                                                                                +    return _inner
                                                                                                                                                +
                                                                                                                                            @@ -410,7 +647,7 @@

                                                                                                                                            -

                                                                                                                                            Generated by pdoc 0.11.3.

                                                                                                                                            +

                                                                                                                                            Generated by pdoc 0.11.5.

                                                                                                                                            diff --git a/docs/static/api-docs/slack_bolt/middleware/assistant/async_assistant.html b/docs/static/api-docs/slack_bolt/middleware/assistant/async_assistant.html index 170f45d0..260d493a 100644 --- a/docs/static/api-docs/slack_bolt/middleware/assistant/async_assistant.html +++ b/docs/static/api-docs/slack_bolt/middleware/assistant/async_assistant.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.assistant.async_assistant API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                            Classes

                                                                                                                                            (*,
                                                                                                                                            app_name: str = 'assistant',
                                                                                                                                            thread_context_store: AsyncAssistantThreadContextStore | None = None,
                                                                                                                                            logger: logging.Logger | None = None)
                                                                                                                                            -

                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                            Expand source code @@ -340,6 +350,7 @@

                                                                                                                                            Classes

                                                                                                                                            else: raise BoltError(f"Invalid listener: {type(listener_or_functions)} detected")
                                                                                                                                            +

                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                            Ancestors

                                                                                                                                            • AsyncMiddleware
                                                                                                                                            • @@ -348,11 +359,11 @@

                                                                                                                                              Class variables

                                                                                                                                              var base_logger : logging.Logger | None
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              var thread_context_storeAsyncAssistantThreadContextStore | None
                                                                                                                                              -
                                                                                                                                              +

                                                                                                                                              The type of the None singleton.

                                                                                                                                              Static methods

                                                                                                                                              @@ -361,6 +372,15 @@

                                                                                                                                              Static methods

                                                                                                                                              async def default_thread_context_changed(save_thread_context: AsyncSaveThreadContext,
                                                                                                                                              payload: dict)
                                                                                                                                              +
                                                                                                                                              + +Expand source code + +
                                                                                                                                              @staticmethod
                                                                                                                                              +async def default_thread_context_changed(save_thread_context: AsyncSaveThreadContext, payload: dict):
                                                                                                                                              +    new_context: dict = payload["assistant_thread"]["context"]
                                                                                                                                              +    await save_thread_context(new_context)
                                                                                                                                              +

                                                                                                                                  @@ -370,30 +390,276 @@

                                                                                                                                  Methods

                                                                                                                                  def bot_message(self,
                                                                                                                                  *args,
                                                                                                                                  matchers: Callable[..., bool] | AsyncListenerMatcher | None = None,
                                                                                                                                  middleware: Callable | AsyncMiddleware | None = None,
                                                                                                                                  lazy: List[Callable[..., None]] | None = None)
                                                                                                                                  +
                                                                                                                                  + +Expand source code + +
                                                                                                                                  def bot_message(
                                                                                                                                  +    self,
                                                                                                                                  +    *args,
                                                                                                                                  +    matchers: Optional[Union[Callable[..., bool], AsyncListenerMatcher]] = None,
                                                                                                                                  +    middleware: Optional[Union[Callable, AsyncMiddleware]] = None,
                                                                                                                                  +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                                                  +):
                                                                                                                                  +    if self._bot_message_listeners is None:
                                                                                                                                  +        self._bot_message_listeners = []
                                                                                                                                  +    all_matchers = self._merge_matchers(
                                                                                                                                  +        build_listener_matcher(
                                                                                                                                  +            func=is_bot_message_event_in_assistant_thread,
                                                                                                                                  +            asyncio=True,
                                                                                                                                  +            base_logger=self.base_logger,
                                                                                                                                  +        ),  # type:ignore[arg-type]
                                                                                                                                  +        matchers,
                                                                                                                                  +    )
                                                                                                                                  +    if is_used_without_argument(args):
                                                                                                                                  +        func = args[0]
                                                                                                                                  +        self._bot_message_listeners.append(
                                                                                                                                  +            self.build_listener(
                                                                                                                                  +                listener_or_functions=func,
                                                                                                                                  +                matchers=all_matchers,
                                                                                                                                  +                middleware=middleware,  # type:ignore[arg-type]
                                                                                                                                  +            )
                                                                                                                                  +        )
                                                                                                                                  +        return func
                                                                                                                                  +
                                                                                                                                  +    def _inner(func):
                                                                                                                                  +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                                                  +        self._bot_message_listeners.append(
                                                                                                                                  +            self.build_listener(
                                                                                                                                  +                listener_or_functions=functions,
                                                                                                                                  +                matchers=all_matchers,
                                                                                                                                  +                middleware=middleware,
                                                                                                                                  +            )
                                                                                                                                  +        )
                                                                                                                                  +
                                                                                                                                  +        @wraps(func)
                                                                                                                                  +        def _wrapper(*args, **kwargs):
                                                                                                                                  +            return func(*args, **kwargs)
                                                                                                                                  +
                                                                                                                                  +        return _wrapper
                                                                                                                                  +
                                                                                                                                  +    return _inner
                                                                                                                                  +
                                                                                                                                  def build_listener(self,
                                                                                                                                  listener_or_functions: AsyncListener | Callable | List[Callable],
                                                                                                                                  matchers: List[AsyncListenerMatcher | Callable[..., Awaitable[bool]]] | None = None,
                                                                                                                                  middleware: List[AsyncMiddleware] | None = None,
                                                                                                                                  base_logger: logging.Logger | None = None) ‑> AsyncListener
                                                                                                                                  +
                                                                                                                                  + +Expand source code + +
                                                                                                                                  def build_listener(
                                                                                                                                  +    self,
                                                                                                                                  +    listener_or_functions: Union[AsyncListener, Callable, List[Callable]],
                                                                                                                                  +    matchers: Optional[List[Union[AsyncListenerMatcher, Callable[..., Awaitable[bool]]]]] = None,
                                                                                                                                  +    middleware: Optional[List[AsyncMiddleware]] = None,
                                                                                                                                  +    base_logger: Optional[Logger] = None,
                                                                                                                                  +) -> AsyncListener:
                                                                                                                                  +    if isinstance(listener_or_functions, Callable):  # type:ignore[arg-type]
                                                                                                                                  +        listener_or_functions = [listener_or_functions]  # type:ignore[list-item]
                                                                                                                                  +
                                                                                                                                  +    if isinstance(listener_or_functions, AsyncListener):
                                                                                                                                  +        return listener_or_functions
                                                                                                                                  +    elif isinstance(listener_or_functions, list):
                                                                                                                                  +        middleware = middleware if middleware else []
                                                                                                                                  +        functions = listener_or_functions
                                                                                                                                  +        ack_function = functions.pop(0)
                                                                                                                                  +
                                                                                                                                  +        matchers = matchers if matchers else []
                                                                                                                                  +        listener_matchers: List[AsyncListenerMatcher] = []
                                                                                                                                  +        for matcher in matchers:
                                                                                                                                  +            if isinstance(matcher, AsyncListenerMatcher):
                                                                                                                                  +                listener_matchers.append(matcher)
                                                                                                                                  +            else:
                                                                                                                                  +                listener_matchers.append(
                                                                                                                                  +                    build_listener_matcher(
                                                                                                                                  +                        func=matcher,  # type:ignore[arg-type]
                                                                                                                                  +                        asyncio=True,
                                                                                                                                  +                        base_logger=base_logger,
                                                                                                                                  +                    )
                                                                                                                                  +                )
                                                                                                                                  +        return AsyncCustomListener(
                                                                                                                                  +            app_name=self.app_name,
                                                                                                                                  +            matchers=listener_matchers,
                                                                                                                                  +            middleware=middleware,
                                                                                                                                  +            ack_function=ack_function,
                                                                                                                                  +            lazy_functions=functions,
                                                                                                                                  +            auto_acknowledgement=True,
                                                                                                                                  +            base_logger=base_logger or self.base_logger,
                                                                                                                                  +        )
                                                                                                                                  +    else:
                                                                                                                                  +        raise BoltError(f"Invalid listener: {type(listener_or_functions)} detected")
                                                                                                                                  +
                                                                                                                                  def thread_context_changed(self,
                                                                                                                                  *args,
                                                                                                                                  matchers: Callable[..., bool] | AsyncListenerMatcher | None = None,
                                                                                                                                  middleware: Callable | AsyncMiddleware | None = None,
                                                                                                                                  lazy: List[Callable[..., None]] | None = None)
                                                                                                                                  +
                                                                                                                                  + +Expand source code + +
                                                                                                                                  def thread_context_changed(
                                                                                                                                  +    self,
                                                                                                                                  +    *args,
                                                                                                                                  +    matchers: Optional[Union[Callable[..., bool], AsyncListenerMatcher]] = None,
                                                                                                                                  +    middleware: Optional[Union[Callable, AsyncMiddleware]] = None,
                                                                                                                                  +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                                                  +):
                                                                                                                                  +    if self._thread_context_changed_listeners is None:
                                                                                                                                  +        self._thread_context_changed_listeners = []
                                                                                                                                  +    all_matchers = self._merge_matchers(
                                                                                                                                  +        build_listener_matcher(
                                                                                                                                  +            func=is_assistant_thread_context_changed_event,
                                                                                                                                  +            asyncio=True,
                                                                                                                                  +            base_logger=self.base_logger,
                                                                                                                                  +        ),  # type:ignore[arg-type]
                                                                                                                                  +        matchers,
                                                                                                                                  +    )
                                                                                                                                  +    if is_used_without_argument(args):
                                                                                                                                  +        func = args[0]
                                                                                                                                  +        self._thread_context_changed_listeners.append(
                                                                                                                                  +            self.build_listener(
                                                                                                                                  +                listener_or_functions=func,
                                                                                                                                  +                matchers=all_matchers,
                                                                                                                                  +                middleware=middleware,  # type:ignore[arg-type]
                                                                                                                                  +            )
                                                                                                                                  +        )
                                                                                                                                  +        return func
                                                                                                                                  +
                                                                                                                                  +    def _inner(func):
                                                                                                                                  +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                                                  +        self._thread_context_changed_listeners.append(
                                                                                                                                  +            self.build_listener(
                                                                                                                                  +                listener_or_functions=functions,
                                                                                                                                  +                matchers=all_matchers,
                                                                                                                                  +                middleware=middleware,
                                                                                                                                  +            )
                                                                                                                                  +        )
                                                                                                                                  +
                                                                                                                                  +        @wraps(func)
                                                                                                                                  +        def _wrapper(*args, **kwargs):
                                                                                                                                  +            return func(*args, **kwargs)
                                                                                                                                  +
                                                                                                                                  +        return _wrapper
                                                                                                                                  +
                                                                                                                                  +    return _inner
                                                                                                                                  +
                                                                                                                                  def thread_started(self,
                                                                                                                                  *args,
                                                                                                                                  matchers: Callable[..., bool] | AsyncListenerMatcher | None = None,
                                                                                                                                  middleware: Callable | AsyncMiddleware | None = None,
                                                                                                                                  lazy: List[Callable[..., None]] | None = None)
                                                                                                                                  +
                                                                                                                                  + +Expand source code + +
                                                                                                                                  def thread_started(
                                                                                                                                  +    self,
                                                                                                                                  +    *args,
                                                                                                                                  +    matchers: Optional[Union[Callable[..., bool], AsyncListenerMatcher]] = None,
                                                                                                                                  +    middleware: Optional[Union[Callable, AsyncMiddleware]] = None,
                                                                                                                                  +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                                                  +):
                                                                                                                                  +    if self._thread_started_listeners is None:
                                                                                                                                  +        self._thread_started_listeners = []
                                                                                                                                  +    all_matchers = self._merge_matchers(
                                                                                                                                  +        build_listener_matcher(
                                                                                                                                  +            func=is_assistant_thread_started_event,
                                                                                                                                  +            asyncio=True,
                                                                                                                                  +            base_logger=self.base_logger,
                                                                                                                                  +        ),  # type:ignore[arg-type]
                                                                                                                                  +        matchers,
                                                                                                                                  +    )
                                                                                                                                  +    if is_used_without_argument(args):
                                                                                                                                  +        func = args[0]
                                                                                                                                  +        self._thread_started_listeners.append(
                                                                                                                                  +            self.build_listener(
                                                                                                                                  +                listener_or_functions=func,
                                                                                                                                  +                matchers=all_matchers,
                                                                                                                                  +                middleware=middleware,  # type:ignore[arg-type]
                                                                                                                                  +            )
                                                                                                                                  +        )
                                                                                                                                  +        return func
                                                                                                                                  +
                                                                                                                                  +    def _inner(func):
                                                                                                                                  +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                                                  +        self._thread_started_listeners.append(
                                                                                                                                  +            self.build_listener(
                                                                                                                                  +                listener_or_functions=functions,
                                                                                                                                  +                matchers=all_matchers,
                                                                                                                                  +                middleware=middleware,
                                                                                                                                  +            )
                                                                                                                                  +        )
                                                                                                                                  +
                                                                                                                                  +        @wraps(func)
                                                                                                                                  +        def _wrapper(*args, **kwargs):
                                                                                                                                  +            return func(*args, **kwargs)
                                                                                                                                  +
                                                                                                                                  +        return _wrapper
                                                                                                                                  +
                                                                                                                                  +    return _inner
                                                                                                                                  +
                                                                                                                                  def user_message(self,
                                                                                                                                  *args,
                                                                                                                                  matchers: Callable[..., bool] | AsyncListenerMatcher | None = None,
                                                                                                                                  middleware: Callable | AsyncMiddleware | None = None,
                                                                                                                                  lazy: List[Callable[..., None]] | None = None)
                                                                                                                                  +
                                                                                                                                  + +Expand source code + +
                                                                                                                                  def user_message(
                                                                                                                                  +    self,
                                                                                                                                  +    *args,
                                                                                                                                  +    matchers: Optional[Union[Callable[..., bool], AsyncListenerMatcher]] = None,
                                                                                                                                  +    middleware: Optional[Union[Callable, AsyncMiddleware]] = None,
                                                                                                                                  +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                                                  +):
                                                                                                                                  +    if self._user_message_listeners is None:
                                                                                                                                  +        self._user_message_listeners = []
                                                                                                                                  +    all_matchers = self._merge_matchers(
                                                                                                                                  +        build_listener_matcher(
                                                                                                                                  +            func=is_user_message_event_in_assistant_thread,
                                                                                                                                  +            asyncio=True,
                                                                                                                                  +            base_logger=self.base_logger,
                                                                                                                                  +        ),  # type:ignore[arg-type]
                                                                                                                                  +        matchers,
                                                                                                                                  +    )
                                                                                                                                  +    if is_used_without_argument(args):
                                                                                                                                  +        func = args[0]
                                                                                                                                  +        self._user_message_listeners.append(
                                                                                                                                  +            self.build_listener(
                                                                                                                                  +                listener_or_functions=func,
                                                                                                                                  +                matchers=all_matchers,
                                                                                                                                  +                middleware=middleware,  # type:ignore[arg-type]
                                                                                                                                  +            )
                                                                                                                                  +        )
                                                                                                                                  +        return func
                                                                                                                                  +
                                                                                                                                  +    def _inner(func):
                                                                                                                                  +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                                                  +        self._user_message_listeners.append(
                                                                                                                                  +            self.build_listener(
                                                                                                                                  +                listener_or_functions=functions,
                                                                                                                                  +                matchers=all_matchers,
                                                                                                                                  +                middleware=middleware,
                                                                                                                                  +            )
                                                                                                                                  +        )
                                                                                                                                  +
                                                                                                                                  +        @wraps(func)
                                                                                                                                  +        def _wrapper(*args, **kwargs):
                                                                                                                                  +            return func(*args, **kwargs)
                                                                                                                                  +
                                                                                                                                  +        return _wrapper
                                                                                                                                  +
                                                                                                                                  +    return _inner
                                                                                                                                  +

                                                                                                                            @@ -441,7 +707,7 @@

                                                                                                                            -

                                                                                                                            Generated by pdoc 0.11.3.

                                                                                                                            +

                                                                                                                            Generated by pdoc 0.11.5.

                                                                                                                            diff --git a/docs/static/api-docs/slack_bolt/middleware/assistant/index.html b/docs/static/api-docs/slack_bolt/middleware/assistant/index.html index 8fb14d28..857240ad 100644 --- a/docs/static/api-docs/slack_bolt/middleware/assistant/index.html +++ b/docs/static/api-docs/slack_bolt/middleware/assistant/index.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.assistant API documentation - + @@ -51,7 +62,6 @@

                                                                                                                            Classes

                                                                                                                            (*,
                                                                                                                            app_name: str = 'assistant',
                                                                                                                            thread_context_store: AssistantThreadContextStore | None = None,
                                                                                                                            logger: logging.Logger | None = None)
                                                                                                                            -

                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                            Expand source code @@ -320,6 +330,7 @@

                                                                                                                            Classes

                                                                                                                            else: raise BoltError(f"Invalid listener: {type(listener_or_functions)} detected")
                                                                                                                            +

                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                            Ancestors

                                                                                                                            • Middleware
                                                                                                                            • @@ -328,11 +339,11 @@

                                                                                                                              Class variables

                                                                                                                              var base_logger : logging.Logger | None
                                                                                                                              -
                                                                                                                              +

                                                                                                                              The type of the None singleton.

                                                                                                                              var thread_context_storeAssistantThreadContextStore | None
                                                                                                                              -
                                                                                                                              +

                                                                                                                              The type of the None singleton.

                                                                                                                              Static methods

                                                                                                                              @@ -341,6 +352,14 @@

                                                                                                                              Static methods

                                                                                                                              def default_thread_context_changed(save_thread_context: SaveThreadContext,
                                                                                                                              payload: dict)
                                                                                                                              +
                                                                                                                              + +Expand source code + +
                                                                                                                              @staticmethod
                                                                                                                              +def default_thread_context_changed(save_thread_context: SaveThreadContext, payload: dict):
                                                                                                                              +    save_thread_context(payload["assistant_thread"]["context"])
                                                                                                                              +

                                                                                                                            @@ -350,30 +369,248 @@

                                                                                                                            Methods

                                                                                                                            def bot_message(self,
                                                                                                                            *args,
                                                                                                                            matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                                                            middleware: Callable | Middleware | None = None,
                                                                                                                            lazy: List[Callable[..., None]] | None = None)
                                                                                                                            +
                                                                                                                            + +Expand source code + +
                                                                                                                            def bot_message(
                                                                                                                            +    self,
                                                                                                                            +    *args,
                                                                                                                            +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                                                            +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                                                            +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                                            +):
                                                                                                                            +    if self._bot_message_listeners is None:
                                                                                                                            +        self._bot_message_listeners = []
                                                                                                                            +    all_matchers = self._merge_matchers(is_bot_message_event_in_assistant_thread, matchers)
                                                                                                                            +    if is_used_without_argument(args):
                                                                                                                            +        func = args[0]
                                                                                                                            +        self._bot_message_listeners.append(
                                                                                                                            +            self.build_listener(
                                                                                                                            +                listener_or_functions=func,
                                                                                                                            +                matchers=all_matchers,
                                                                                                                            +                middleware=middleware,  # type:ignore[arg-type]
                                                                                                                            +            )
                                                                                                                            +        )
                                                                                                                            +        return func
                                                                                                                            +
                                                                                                                            +    def _inner(func):
                                                                                                                            +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                                            +        self._bot_message_listeners.append(
                                                                                                                            +            self.build_listener(
                                                                                                                            +                listener_or_functions=functions,
                                                                                                                            +                matchers=all_matchers,
                                                                                                                            +                middleware=middleware,
                                                                                                                            +            )
                                                                                                                            +        )
                                                                                                                            +
                                                                                                                            +        @wraps(func)
                                                                                                                            +        def _wrapper(*args, **kwargs):
                                                                                                                            +            return func(*args, **kwargs)
                                                                                                                            +
                                                                                                                            +        return _wrapper
                                                                                                                            +
                                                                                                                            +    return _inner
                                                                                                                            +
                                                                                                                            def build_listener(self,
                                                                                                                            listener_or_functions: Listener | Callable | List[Callable],
                                                                                                                            matchers: List[ListenerMatcher | Callable[..., bool]] | None = None,
                                                                                                                            middleware: List[Middleware] | None = None,
                                                                                                                            base_logger: logging.Logger | None = None) ‑> Listener
                                                                                                                            +
                                                                                                                            + +Expand source code + +
                                                                                                                            def build_listener(
                                                                                                                            +    self,
                                                                                                                            +    listener_or_functions: Union[Listener, Callable, List[Callable]],
                                                                                                                            +    matchers: Optional[List[Union[ListenerMatcher, Callable[..., bool]]]] = None,
                                                                                                                            +    middleware: Optional[List[Middleware]] = None,
                                                                                                                            +    base_logger: Optional[Logger] = None,
                                                                                                                            +) -> Listener:
                                                                                                                            +    if isinstance(listener_or_functions, Callable):  # type:ignore[arg-type]
                                                                                                                            +        listener_or_functions = [listener_or_functions]  # type:ignore[list-item]
                                                                                                                            +
                                                                                                                            +    if isinstance(listener_or_functions, Listener):
                                                                                                                            +        return listener_or_functions
                                                                                                                            +    elif isinstance(listener_or_functions, list):
                                                                                                                            +        middleware = middleware if middleware else []
                                                                                                                            +        functions = listener_or_functions
                                                                                                                            +        ack_function = functions.pop(0)
                                                                                                                            +
                                                                                                                            +        matchers = matchers if matchers else []
                                                                                                                            +        listener_matchers: List[ListenerMatcher] = []
                                                                                                                            +        for matcher in matchers:
                                                                                                                            +            if isinstance(matcher, ListenerMatcher):
                                                                                                                            +                listener_matchers.append(matcher)
                                                                                                                            +            elif isinstance(matcher, Callable):  # type:ignore[arg-type]
                                                                                                                            +                listener_matchers.append(
                                                                                                                            +                    build_listener_matcher(
                                                                                                                            +                        func=matcher,
                                                                                                                            +                        asyncio=False,
                                                                                                                            +                        base_logger=base_logger,
                                                                                                                            +                    )
                                                                                                                            +                )
                                                                                                                            +        return CustomListener(
                                                                                                                            +            app_name=self.app_name,
                                                                                                                            +            matchers=listener_matchers,
                                                                                                                            +            middleware=middleware,
                                                                                                                            +            ack_function=ack_function,
                                                                                                                            +            lazy_functions=functions,
                                                                                                                            +            auto_acknowledgement=True,
                                                                                                                            +            base_logger=base_logger or self.base_logger,
                                                                                                                            +        )
                                                                                                                            +    else:
                                                                                                                            +        raise BoltError(f"Invalid listener: {type(listener_or_functions)} detected")
                                                                                                                            +
                                                                                                                            def thread_context_changed(self,
                                                                                                                            *args,
                                                                                                                            matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                                                            middleware: Callable | Middleware | None = None,
                                                                                                                            lazy: List[Callable[..., None]] | None = None)
                                                                                                                            +
                                                                                                                            + +Expand source code + +
                                                                                                                            def thread_context_changed(
                                                                                                                            +    self,
                                                                                                                            +    *args,
                                                                                                                            +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                                                            +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                                                            +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                                            +):
                                                                                                                            +    if self._thread_context_changed_listeners is None:
                                                                                                                            +        self._thread_context_changed_listeners = []
                                                                                                                            +    all_matchers = self._merge_matchers(is_assistant_thread_context_changed_event, matchers)
                                                                                                                            +    if is_used_without_argument(args):
                                                                                                                            +        func = args[0]
                                                                                                                            +        self._thread_context_changed_listeners.append(
                                                                                                                            +            self.build_listener(
                                                                                                                            +                listener_or_functions=func,
                                                                                                                            +                matchers=all_matchers,
                                                                                                                            +                middleware=middleware,  # type:ignore[arg-type]
                                                                                                                            +            )
                                                                                                                            +        )
                                                                                                                            +        return func
                                                                                                                            +
                                                                                                                            +    def _inner(func):
                                                                                                                            +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                                            +        self._thread_context_changed_listeners.append(
                                                                                                                            +            self.build_listener(
                                                                                                                            +                listener_or_functions=functions,
                                                                                                                            +                matchers=all_matchers,
                                                                                                                            +                middleware=middleware,
                                                                                                                            +            )
                                                                                                                            +        )
                                                                                                                            +
                                                                                                                            +        @wraps(func)
                                                                                                                            +        def _wrapper(*args, **kwargs):
                                                                                                                            +            return func(*args, **kwargs)
                                                                                                                            +
                                                                                                                            +        return _wrapper
                                                                                                                            +
                                                                                                                            +    return _inner
                                                                                                                            +
                                                                                                                            def thread_started(self,
                                                                                                                            *args,
                                                                                                                            matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                                                            middleware: Callable | Middleware | None = None,
                                                                                                                            lazy: List[Callable[..., None]] | None = None)
                                                                                                                            +
                                                                                                                            + +Expand source code + +
                                                                                                                            def thread_started(
                                                                                                                            +    self,
                                                                                                                            +    *args,
                                                                                                                            +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                                                            +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                                                            +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                                            +):
                                                                                                                            +    if self._thread_started_listeners is None:
                                                                                                                            +        self._thread_started_listeners = []
                                                                                                                            +    all_matchers = self._merge_matchers(is_assistant_thread_started_event, matchers)
                                                                                                                            +    if is_used_without_argument(args):
                                                                                                                            +        func = args[0]
                                                                                                                            +        self._thread_started_listeners.append(
                                                                                                                            +            self.build_listener(
                                                                                                                            +                listener_or_functions=func,
                                                                                                                            +                matchers=all_matchers,
                                                                                                                            +                middleware=middleware,  # type:ignore[arg-type]
                                                                                                                            +            )
                                                                                                                            +        )
                                                                                                                            +        return func
                                                                                                                            +
                                                                                                                            +    def _inner(func):
                                                                                                                            +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                                            +        self._thread_started_listeners.append(
                                                                                                                            +            self.build_listener(
                                                                                                                            +                listener_or_functions=functions,
                                                                                                                            +                matchers=all_matchers,
                                                                                                                            +                middleware=middleware,
                                                                                                                            +            )
                                                                                                                            +        )
                                                                                                                            +
                                                                                                                            +        @wraps(func)
                                                                                                                            +        def _wrapper(*args, **kwargs):
                                                                                                                            +            return func(*args, **kwargs)
                                                                                                                            +
                                                                                                                            +        return _wrapper
                                                                                                                            +
                                                                                                                            +    return _inner
                                                                                                                            +
                                                                                                                            def user_message(self,
                                                                                                                            *args,
                                                                                                                            matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                                                            middleware: Callable | Middleware | None = None,
                                                                                                                            lazy: List[Callable[..., None]] | None = None)
                                                                                                                            +
                                                                                                                            + +Expand source code + +
                                                                                                                            def user_message(
                                                                                                                            +    self,
                                                                                                                            +    *args,
                                                                                                                            +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                                                            +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                                                            +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                                            +):
                                                                                                                            +    if self._user_message_listeners is None:
                                                                                                                            +        self._user_message_listeners = []
                                                                                                                            +    all_matchers = self._merge_matchers(is_user_message_event_in_assistant_thread, matchers)
                                                                                                                            +    if is_used_without_argument(args):
                                                                                                                            +        func = args[0]
                                                                                                                            +        self._user_message_listeners.append(
                                                                                                                            +            self.build_listener(
                                                                                                                            +                listener_or_functions=func,
                                                                                                                            +                matchers=all_matchers,
                                                                                                                            +                middleware=middleware,  # type:ignore[arg-type]
                                                                                                                            +            )
                                                                                                                            +        )
                                                                                                                            +        return func
                                                                                                                            +
                                                                                                                            +    def _inner(func):
                                                                                                                            +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                                            +        self._user_message_listeners.append(
                                                                                                                            +            self.build_listener(
                                                                                                                            +                listener_or_functions=functions,
                                                                                                                            +                matchers=all_matchers,
                                                                                                                            +                middleware=middleware,
                                                                                                                            +            )
                                                                                                                            +        )
                                                                                                                            +
                                                                                                                            +        @wraps(func)
                                                                                                                            +        def _wrapper(*args, **kwargs):
                                                                                                                            +            return func(*args, **kwargs)
                                                                                                                            +
                                                                                                                            +        return _wrapper
                                                                                                                            +
                                                                                                                            +    return _inner
                                                                                                                            +

                                                                                                                        • @@ -427,7 +664,7 @@

                                                                                                                          -

                                                                                                                          Generated by pdoc 0.11.3.

                                                                                                                          +

                                                                                                                          Generated by pdoc 0.11.5.

                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/middleware/async_builtins.html b/docs/static/api-docs/slack_bolt/middleware/async_builtins.html index f895481b..d25d27a9 100644 --- a/docs/static/api-docs/slack_bolt/middleware/async_builtins.html +++ b/docs/static/api-docs/slack_bolt/middleware/async_builtins.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.async_builtins API documentation - + @@ -39,7 +50,6 @@

                                                                                                                          Classes

                                                                                                                          class AsyncAttachingFunctionToken
                                                                                                                          -

                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                          Expand source code @@ -58,6 +68,7 @@

                                                                                                                          Classes

                                                                                                                          return await next()
                                                                                                                          +

                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                          Ancestors

                                                                                                                          • AsyncMiddleware
                                                                                                                          • @@ -77,8 +88,6 @@

                                                                                                                            Inherited members

                                                                                                                            (base_logger: logging.Logger | None = None,
                                                                                                                            ignoring_self_assistant_message_events_enabled: bool = True)
                                                                                                                            -

                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                            -

                                                                                                                            Ignores the events generated by this bot user itself.

                                                                                                                            Expand source code @@ -105,6 +114,8 @@

                                                                                                                            Inherited members

                                                                                                                            else: return await next()
                                                                                                                            +

                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                            +

                                                                                                                            Ignores the events generated by this bot user itself.

                                                                                                                            Ancestors

                                                                                                                            • IgnoringSelfEvents
                                                                                                                            • @@ -115,6 +126,7 @@

                                                                                                                              Inherited members

                                                                                                                              • IgnoringSelfEvents: @@ -131,8 +143,6 @@

                                                                                                                                Inherited members

                                                                                                                                (keyword: str | Pattern)
                                                                                                                                -

                                                                                                                                A middleware can process request data before other middleware and listener functions.

                                                                                                                                -

                                                                                                                                Captures matched keywords and saves the values in context.

                                                                                                                                Expand source code @@ -166,6 +176,8 @@

                                                                                                                                Inherited members

                                                                                                                                # As the text doesn't match, skip running the listener return resp
                                                                                                                                +

                                                                                                                                A middleware can process request data before other middleware and listener functions.

                                                                                                                                +

                                                                                                                                Captures matched keywords and saves the values in context.

                                                                                                                                Ancestors

                                                                                                                                • AsyncMiddleware
                                                                                                                                • @@ -185,19 +197,6 @@

                                                                                                                                  Inherited members

                                                                                                                                  (signing_secret: str, base_logger: logging.Logger | None = None)
                                                                                                                                  -

                                                                                                                                  Verifies an incoming request by checking the validity of -x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                  -

                                                                                                                                  Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                  -

                                                                                                                                  Verifies an incoming request by checking the validity of -x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                  -

                                                                                                                                  Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                  -

                                                                                                                                  Args

                                                                                                                                  -
                                                                                                                                  -
                                                                                                                                  signing_secret
                                                                                                                                  -
                                                                                                                                  The signing secret
                                                                                                                                  -
                                                                                                                                  base_logger
                                                                                                                                  -
                                                                                                                                  The base logger
                                                                                                                                  -
                                                                                                                                  Expand source code @@ -231,6 +230,19 @@

                                                                                                                                  Args

                                                                                                                                  self._debug_log_error(signature, timestamp, body) return self._build_error_response()
                                                                                                                                  +

                                                                                                                                  Verifies an incoming request by checking the validity of +x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                  +

                                                                                                                                  Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                  +

                                                                                                                                  Verifies an incoming request by checking the validity of +x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                  +

                                                                                                                                  Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                  +

                                                                                                                                  Args

                                                                                                                                  +
                                                                                                                                  +
                                                                                                                                  signing_secret
                                                                                                                                  +
                                                                                                                                  The signing secret
                                                                                                                                  +
                                                                                                                                  base_logger
                                                                                                                                  +
                                                                                                                                  The base logger
                                                                                                                                  +

                                                                                                                                  Ancestors

                                                                                                                                  • RequestVerification
                                                                                                                                  • @@ -257,17 +269,6 @@

                                                                                                                                    Inherited members

                                                                                                                                    (verification_token: str | None = None,
                                                                                                                                    base_logger: logging.Logger | None = None)
                                                                                                                                    -

                                                                                                                                    A middleware can process request data before other middleware and listener functions.

                                                                                                                                    -

                                                                                                                                    Handles ssl_check requests. -Refer to https://api.slack.com/interactivity/slash-commands for details.

                                                                                                                                    -

                                                                                                                                    Args

                                                                                                                                    -
                                                                                                                                    -
                                                                                                                                    verification_token
                                                                                                                                    -
                                                                                                                                    The verification token to check -(optional as it's already deprecated - https://api.slack.com/authentication/verifying-requests-from-slack#verification_token_deprecation)
                                                                                                                                    -
                                                                                                                                    base_logger
                                                                                                                                    -
                                                                                                                                    The base logger
                                                                                                                                    -
                                                                                                                                    Expand source code @@ -290,6 +291,17 @@

                                                                                                                                    Args

                                                                                                                                    else: return await next()
                                                                                                                                    +

                                                                                                                                    A middleware can process request data before other middleware and listener functions.

                                                                                                                                    +

                                                                                                                                    Handles ssl_check requests. +Refer to https://api.slack.com/interactivity/slash-commands for details.

                                                                                                                                    +

                                                                                                                                    Args

                                                                                                                                    +
                                                                                                                                    +
                                                                                                                                    verification_token
                                                                                                                                    +
                                                                                                                                    The verification token to check +(optional as it's already deprecated - https://api.slack.com/authentication/verifying-requests-from-slack#verification_token_deprecation)
                                                                                                                                    +
                                                                                                                                    base_logger
                                                                                                                                    +
                                                                                                                                    The base logger
                                                                                                                                    +

                                                                                                                                    Ancestors

                                                                                                                                    • SslCheck
                                                                                                                                    • @@ -300,8 +312,10 @@

                                                                                                                                      Inherited members

                                                                                                                                      • SslCheck:
                                                                                                                                      • AsyncMiddleware: @@ -316,14 +330,6 @@

                                                                                                                                        Inherited members

                                                                                                                                        (base_logger: logging.Logger | None = None)
                                                                                                                                        -

                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                        -

                                                                                                                                        Handles url_verification requests.

                                                                                                                                        -

                                                                                                                                        Refer to https://api.slack.com/events/url_verification for details.

                                                                                                                                        -

                                                                                                                                        Args

                                                                                                                                        -
                                                                                                                                        -
                                                                                                                                        base_logger
                                                                                                                                        -
                                                                                                                                        The base logger
                                                                                                                                        -
                                                                                                                                        Expand source code @@ -344,6 +350,14 @@

                                                                                                                                        Args

                                                                                                                                        else: return await next()
                                                                                                                                        +

                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                        +

                                                                                                                                        Handles url_verification requests.

                                                                                                                                        +

                                                                                                                                        Refer to https://api.slack.com/events/url_verification for details.

                                                                                                                                        +

                                                                                                                                        Args

                                                                                                                                        +
                                                                                                                                        +
                                                                                                                                        base_logger
                                                                                                                                        +
                                                                                                                                        The base logger
                                                                                                                                        +

                                                                                                                                        Ancestors

                                                                                                                                        • UrlVerification
                                                                                                                                        • @@ -404,7 +418,7 @@

                                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/middleware/async_custom_middleware.html b/docs/static/api-docs/slack_bolt/middleware/async_custom_middleware.html index e44955e0..6ef00baa 100644 --- a/docs/static/api-docs/slack_bolt/middleware/async_custom_middleware.html +++ b/docs/static/api-docs/slack_bolt/middleware/async_custom_middleware.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.async_custom_middleware API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                          Classes

                                                                                                                                          (*,
                                                                                                                                          app_name: str,
                                                                                                                                          func: Callable[..., Awaitable[Any]],
                                                                                                                                          base_logger: logging.Logger | None = None)
                                                                                                                                          -

                                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                                          Expand source code @@ -92,6 +102,7 @@

                                                                                                                                          Classes

                                                                                                                                          def name(self) -> str: return f"AsyncCustomMiddleware(func={get_name_for_callable(self.func)})"
                                                                                                                                          +

                                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                                          Ancestors

                                                                                                                                          • AsyncMiddleware
                                                                                                                                          • @@ -100,19 +111,19 @@

                                                                                                                                            Class variables

                                                                                                                                            var app_name : str
                                                                                                                                            -
                                                                                                                                            +

                                                                                                                                            The type of the None singleton.

                                                                                                                                            var arg_names : MutableSequence[str]
                                                                                                                                            -
                                                                                                                                            +

                                                                                                                                            The type of the None singleton.

                                                                                                                                            var func : Callable[..., Awaitable[Any]]
                                                                                                                                            -
                                                                                                                                            +

                                                                                                                                            The type of the None singleton.

                                                                                                                                            var logger : logging.Logger
                                                                                                                                            -
                                                                                                                                            +

                                                                                                                                            The type of the None singleton.

                                                                                                                                            Inherited members

                                                                                                                                            @@ -155,7 +166,7 @@

                                                                                                                                            -

                                                                                                                                            Generated by pdoc 0.11.3.

                                                                                                                                            +

                                                                                                                                            Generated by pdoc 0.11.5.

                                                                                                                                            diff --git a/docs/static/api-docs/slack_bolt/middleware/async_middleware.html b/docs/static/api-docs/slack_bolt/middleware/async_middleware.html index 90972540..e0e38cf9 100644 --- a/docs/static/api-docs/slack_bolt/middleware/async_middleware.html +++ b/docs/static/api-docs/slack_bolt/middleware/async_middleware.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.async_middleware API documentation - + @@ -39,7 +50,6 @@

                                                                                                                                            Classes

                                                                                                                                            class AsyncMiddleware
                                                                                                                                            -

                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                            Expand source code @@ -89,6 +99,7 @@

                                                                                                                                            Classes

                                                                                                                                            """The name of this middleware""" return f"{self.__module__}.{self.__class__.__name__}"
                                                                                                                                            +

                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                            Subclasses

                                                                                                                                            • AsyncAssistant
                                                                                                                                            • @@ -106,7 +117,6 @@

                                                                                                                                              Instance variables

                                                                                                                                              prop name : str
                                                                                                                                              -

                                                                                                                                              The name of this middleware

                                                                                                                                              Expand source code @@ -116,6 +126,7 @@

                                                                                                                                              Instance variables

                                                                                                                                              """The name of this middleware""" return f"{self.__module__}.{self.__class__.__name__}"
                                                                                                                                              +

                                                                                                                                              The name of this middleware

                                                                                                                                              Methods

                                                                                                                                              @@ -124,6 +135,47 @@

                                                                                                                                              Methods

                                                                                                                                              async def async_process(self,
                                                                                                                                              *,
                                                                                                                                              req: AsyncBoltRequest,
                                                                                                                                              resp: BoltResponse,
                                                                                                                                              next: Callable[[], Awaitable[BoltResponse]]) ‑> BoltResponse | None
                                                                                                                                              +
                                                                                                                                              + +Expand source code + +
                                                                                                                                              @abstractmethod
                                                                                                                                              +async def async_process(
                                                                                                                                              +    self,
                                                                                                                                              +    *,
                                                                                                                                              +    req: AsyncBoltRequest,
                                                                                                                                              +    resp: BoltResponse,
                                                                                                                                              +    # As this method is not supposed to be invoked by bolt-python users,
                                                                                                                                              +    # the naming conflict with the built-in one affects
                                                                                                                                              +    # only the internals of this method
                                                                                                                                              +    next: Callable[[], Awaitable[BoltResponse]],
                                                                                                                                              +) -> Optional[BoltResponse]:
                                                                                                                                              +    """Processes a request data before other middleware and listeners.
                                                                                                                                              +    A middleware calls `next()` function if the chain should continue.
                                                                                                                                              +
                                                                                                                                              +        @app.middleware
                                                                                                                                              +        async def simple_middleware(req, resp, next):
                                                                                                                                              +            # do something here
                                                                                                                                              +            await next()
                                                                                                                                              +
                                                                                                                                              +    This `async_process(req, resp, next)` method is supposed to be invoked only inside bolt-python.
                                                                                                                                              +    If you want to avoid the name `next()` in your middleware functions, you can use `next_()` method instead.
                                                                                                                                              +
                                                                                                                                              +        @app.middleware
                                                                                                                                              +        async def simple_middleware(req, resp, next_):
                                                                                                                                              +            # do something here
                                                                                                                                              +            await next_()
                                                                                                                                              +
                                                                                                                                              +    Args:
                                                                                                                                              +        req: The incoming request
                                                                                                                                              +        resp: The response
                                                                                                                                              +        next: The function to tell the chain that it can continue
                                                                                                                                              +
                                                                                                                                              +    Returns:
                                                                                                                                              +        Processed response (optional)
                                                                                                                                              +    """
                                                                                                                                              +    raise NotImplementedError()
                                                                                                                                              +

                                                                                                                                              Processes a request data before other middleware and listeners. A middleware calls next() function if the chain should continue.

                                                                                                                                              @app.middleware
                                                                                                                                              @@ -180,7 +232,7 @@ 

                                                                                                                                              diff --git a/docs/static/api-docs/slack_bolt/middleware/async_middleware_error_handler.html b/docs/static/api-docs/slack_bolt/middleware/async_middleware_error_handler.html index f87f7e5e..617e490c 100644 --- a/docs/static/api-docs/slack_bolt/middleware/async_middleware_error_handler.html +++ b/docs/static/api-docs/slack_bolt/middleware/async_middleware_error_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.async_middleware_error_handler API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                              Classes

                                                                                                                                              (logger: logging.Logger,
                                                                                                                                              func: Callable[..., Awaitable[BoltResponse | None]])
                                                                                                                                              -
                                                                                                                                              Expand source code @@ -71,6 +81,7 @@

                                                                                                                                              Classes

                                                                                                                                              response.headers = returned_response.headers # type: ignore[union-attr] response.body = returned_response.body # type: ignore[union-attr]

                                                                                                                                              +

                                                                                                                                              Ancestors

                                                                                                                                              • AsyncMiddlewareErrorHandler
                                                                                                                                              • @@ -89,7 +100,6 @@

                                                                                                                                                Inherited members

                                                                                                                                                (logger: logging.Logger)
                                                                                                                                                -
                                                                                                                                                Expand source code @@ -107,6 +117,7 @@

                                                                                                                                                Inherited members

                                                                                                                                                message = f"Failed to run a middleware function (error: {error})" self.logger.exception(message)
                                                                                                                                                +

                                                                                                                                                Ancestors

                                                                                                                                                • AsyncMiddlewareErrorHandler
                                                                                                                                                • @@ -124,7 +135,6 @@

                                                                                                                                                  Inherited members

                                                                                                                                                  class AsyncMiddlewareErrorHandler
                                                                                                                                                  -
                                                                                                                                                  Expand source code @@ -146,6 +156,7 @@

                                                                                                                                                  Inherited members

                                                                                                                                                  """ raise NotImplementedError()
                                                                                                                                                  +

                                                                                                                                                  Subclasses

                                                                                                                                                  • AsyncCustomMiddlewareErrorHandler
                                                                                                                                                  • @@ -157,6 +168,26 @@

                                                                                                                                                    Methods

                                                                                                                                                    async def handle(self,
                                                                                                                                                    error: Exception,
                                                                                                                                                    request: AsyncBoltRequest,
                                                                                                                                                    response: BoltResponse | None) ‑> None
                                                                                                                                                    +
                                                                                                                                                    + +Expand source code + +
                                                                                                                                                    @abstractmethod
                                                                                                                                                    +async def handle(
                                                                                                                                                    +    self,
                                                                                                                                                    +    error: Exception,
                                                                                                                                                    +    request: AsyncBoltRequest,
                                                                                                                                                    +    response: Optional[BoltResponse],
                                                                                                                                                    +) -> None:
                                                                                                                                                    +    """Handles an unhandled exception.
                                                                                                                                                    +
                                                                                                                                                    +    Args:
                                                                                                                                                    +        error: The raised exception.
                                                                                                                                                    +        request: The request.
                                                                                                                                                    +        response: The response.
                                                                                                                                                    +    """
                                                                                                                                                    +    raise NotImplementedError()
                                                                                                                                                    +

                                                                                                                                                    Handles an unhandled exception.

                                                                                                                                                    Args

                                                                                                                                                    @@ -203,7 +234,7 @@

                                                                                                                                                    -

                                                                                                                                                    Generated by pdoc 0.11.3.

                                                                                                                                                    +

                                                                                                                                                    Generated by pdoc 0.11.5.

                                                                                                                                                    diff --git a/docs/static/api-docs/slack_bolt/middleware/attaching_function_token/async_attaching_function_token.html b/docs/static/api-docs/slack_bolt/middleware/attaching_function_token/async_attaching_function_token.html index 41e3e829..ab8b609a 100644 --- a/docs/static/api-docs/slack_bolt/middleware/attaching_function_token/async_attaching_function_token.html +++ b/docs/static/api-docs/slack_bolt/middleware/attaching_function_token/async_attaching_function_token.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.attaching_function_token.async_attaching_function_token API documentation - + @@ -39,7 +50,6 @@

                                                                                                                                                    Classes

                                                                                                                                                    class AsyncAttachingFunctionToken
                                                                                                                                                    -

                                                                                                                                                    A middleware can process request data before other middleware and listener functions.

                                                                                                                                                    Expand source code @@ -58,6 +68,7 @@

                                                                                                                                                    Classes

                                                                                                                                                    return await next()
                                                                                                                                                    +

                                                                                                                                                    A middleware can process request data before other middleware and listener functions.

                                                                                                                                                    Ancestors

                                                                                                                                                    • AsyncMiddleware
                                                                                                                                                    • @@ -96,7 +107,7 @@

                                                                                                                                                      -

                                                                                                                                                      Generated by pdoc 0.11.3.

                                                                                                                                                      +

                                                                                                                                                      Generated by pdoc 0.11.5.

                                                                                                                                                      diff --git a/docs/static/api-docs/slack_bolt/middleware/attaching_function_token/attaching_function_token.html b/docs/static/api-docs/slack_bolt/middleware/attaching_function_token/attaching_function_token.html index 7c46065e..f005e8ac 100644 --- a/docs/static/api-docs/slack_bolt/middleware/attaching_function_token/attaching_function_token.html +++ b/docs/static/api-docs/slack_bolt/middleware/attaching_function_token/attaching_function_token.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.attaching_function_token.attaching_function_token API documentation - + @@ -39,7 +50,6 @@

                                                                                                                                                      Classes

                                                                                                                                                      class AttachingFunctionToken
                                                                                                                                                      -

                                                                                                                                                      A middleware can process request data before other middleware and listener functions.

                                                                                                                                                      Expand source code @@ -58,6 +68,7 @@

                                                                                                                                                      Classes

                                                                                                                                                      return next()
                                                                                                                                                      +

                                                                                                                                                      A middleware can process request data before other middleware and listener functions.

                                                                                                                                                      Ancestors

                                                                                                                                                      • Middleware
                                                                                                                                                      • @@ -96,7 +107,7 @@

                                                                                                                                                        -

                                                                                                                                                        Generated by pdoc 0.11.3.

                                                                                                                                                        +

                                                                                                                                                        Generated by pdoc 0.11.5.

                                                                                                                                                        diff --git a/docs/static/api-docs/slack_bolt/middleware/attaching_function_token/index.html b/docs/static/api-docs/slack_bolt/middleware/attaching_function_token/index.html index a6d94297..107ae09d 100644 --- a/docs/static/api-docs/slack_bolt/middleware/attaching_function_token/index.html +++ b/docs/static/api-docs/slack_bolt/middleware/attaching_function_token/index.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.attaching_function_token API documentation - + @@ -50,7 +61,6 @@

                                                                                                                                                        Classes

                                                                                                                                                        class AttachingFunctionToken
                                                                                                                                                        -

                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                        Expand source code @@ -69,6 +79,7 @@

                                                                                                                                                        Classes

                                                                                                                                                        return next()
                                                                                                                                                        +

                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                        Ancestors

                                                                                                                                                        • Middleware
                                                                                                                                                        • @@ -113,7 +124,7 @@

                                                                                                                                                          -

                                                                                                                                                          Generated by pdoc 0.11.3.

                                                                                                                                                          +

                                                                                                                                                          Generated by pdoc 0.11.5.

                                                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/middleware/authorization/async_authorization.html b/docs/static/api-docs/slack_bolt/middleware/authorization/async_authorization.html index 7a959c98..aef0b3cd 100644 --- a/docs/static/api-docs/slack_bolt/middleware/authorization/async_authorization.html +++ b/docs/static/api-docs/slack_bolt/middleware/authorization/async_authorization.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.authorization.async_authorization API documentation - + @@ -39,7 +50,6 @@

                                                                                                                                                          Classes

                                                                                                                                                          class AsyncAuthorization
                                                                                                                                                          -

                                                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                                                          Expand source code @@ -47,6 +57,7 @@

                                                                                                                                                          Classes

                                                                                                                                                          class AsyncAuthorization(AsyncMiddleware, ABC):
                                                                                                                                                               pass
                                                                                                                                                          +

                                                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                                                          Ancestors

                                                                                                                                                          • AsyncMiddleware
                                                                                                                                                          • @@ -91,7 +102,7 @@

                                                                                                                                                            -

                                                                                                                                                            Generated by pdoc 0.11.3.

                                                                                                                                                            +

                                                                                                                                                            Generated by pdoc 0.11.5.

                                                                                                                                                            diff --git a/docs/static/api-docs/slack_bolt/middleware/authorization/async_internals.html b/docs/static/api-docs/slack_bolt/middleware/authorization/async_internals.html index fb72b039..483e8c81 100644 --- a/docs/static/api-docs/slack_bolt/middleware/authorization/async_internals.html +++ b/docs/static/api-docs/slack_bolt/middleware/authorization/async_internals.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.authorization.async_internals API documentation - + @@ -49,7 +60,7 @@

                                                                                                                                                            Module slack_bolt.middleware.authorization.async_interna diff --git a/docs/static/api-docs/slack_bolt/middleware/authorization/async_multi_teams_authorization.html b/docs/static/api-docs/slack_bolt/middleware/authorization/async_multi_teams_authorization.html index 57dd8042..b9bfa138 100644 --- a/docs/static/api-docs/slack_bolt/middleware/authorization/async_multi_teams_authorization.html +++ b/docs/static/api-docs/slack_bolt/middleware/authorization/async_multi_teams_authorization.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.authorization.async_multi_teams_authorization API documentation - + @@ -40,19 +51,6 @@

                                                                                                                                                            Classes

                                                                                                                                                            (authorize: AsyncAuthorize,
                                                                                                                                                            base_logger: logging.Logger | None = None,
                                                                                                                                                            user_token_resolution: str = 'authed_user',
                                                                                                                                                            user_facing_authorize_error_message: str | None = None)
                                                                                                                                                            -

                                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                                            -

                                                                                                                                                            Multi-workspace authorization.

                                                                                                                                                            -

                                                                                                                                                            Args

                                                                                                                                                            -
                                                                                                                                                            -
                                                                                                                                                            authorize
                                                                                                                                                            -
                                                                                                                                                            The function to authorize incoming requests from Slack.
                                                                                                                                                            -
                                                                                                                                                            base_logger
                                                                                                                                                            -
                                                                                                                                                            The base logger
                                                                                                                                                            -
                                                                                                                                                            user_token_resolution
                                                                                                                                                            -
                                                                                                                                                            "authed_user" or "actor"
                                                                                                                                                            -
                                                                                                                                                            user_facing_authorize_error_message
                                                                                                                                                            -
                                                                                                                                                            The user-facing error message when installation is not found
                                                                                                                                                            -
                                                                                                                                                            Expand source code @@ -150,6 +148,19 @@

                                                                                                                                                            Args

                                                                                                                                                            self.logger.error(f"Failed to authorize with the given token ({e})") return _build_user_facing_error_response(self.user_facing_authorize_error_message)
                                                                                                                                                            +

                                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                                            +

                                                                                                                                                            Multi-workspace authorization.

                                                                                                                                                            +

                                                                                                                                                            Args

                                                                                                                                                            +
                                                                                                                                                            +
                                                                                                                                                            authorize
                                                                                                                                                            +
                                                                                                                                                            The function to authorize incoming requests from Slack.
                                                                                                                                                            +
                                                                                                                                                            base_logger
                                                                                                                                                            +
                                                                                                                                                            The base logger
                                                                                                                                                            +
                                                                                                                                                            user_token_resolution
                                                                                                                                                            +
                                                                                                                                                            "authed_user" or "actor"
                                                                                                                                                            +
                                                                                                                                                            user_facing_authorize_error_message
                                                                                                                                                            +
                                                                                                                                                            The user-facing error message when installation is not found
                                                                                                                                                            +

                                                                                                                                                            Ancestors

                                                                                                                                                            • AsyncAuthorization
                                                                                                                                                            • @@ -160,11 +171,11 @@

                                                                                                                                                              Class variables

                                                                                                                                                              var authorizeAsyncAuthorize
                                                                                                                                                              -
                                                                                                                                                              +

                                                                                                                                                              The type of the None singleton.

                                                                                                                                                              var user_token_resolution : str
                                                                                                                                                              -
                                                                                                                                                              +

                                                                                                                                                              The type of the None singleton.

                                                                                                                                                              Inherited members

                                                                                                                                                              @@ -205,7 +216,7 @@

                                                                                                                                                              -

                                                                                                                                                              Generated by pdoc 0.11.3.

                                                                                                                                                              +

                                                                                                                                                              Generated by pdoc 0.11.5.

                                                                                                                                                              diff --git a/docs/static/api-docs/slack_bolt/middleware/authorization/async_single_team_authorization.html b/docs/static/api-docs/slack_bolt/middleware/authorization/async_single_team_authorization.html index 886574b0..2b3c4036 100644 --- a/docs/static/api-docs/slack_bolt/middleware/authorization/async_single_team_authorization.html +++ b/docs/static/api-docs/slack_bolt/middleware/authorization/async_single_team_authorization.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.authorization.async_single_team_authorization API documentation - + @@ -40,8 +51,6 @@

                                                                                                                                                              Classes

                                                                                                                                                              (base_logger: logging.Logger | None = None,
                                                                                                                                                              user_facing_authorize_error_message: str | None = None)
                                                                                                                                                              -

                                                                                                                                                              A middleware can process request data before other middleware and listener functions.

                                                                                                                                                              -

                                                                                                                                                              Single-workspace authorization.

                                                                                                                                                              Expand source code @@ -106,6 +115,8 @@

                                                                                                                                                              Classes

                                                                                                                                                              self.logger.error(f"Failed to authorize with the given token ({e})") return _build_user_facing_error_response(self.user_facing_authorize_error_message)
                                                                                                                                                              +

                                                                                                                                                              A middleware can process request data before other middleware and listener functions.

                                                                                                                                                              +

                                                                                                                                                              Single-workspace authorization.

                                                                                                                                                              Ancestors

                                                                                                                                                              • AsyncAuthorization
                                                                                                                                                              • @@ -146,7 +157,7 @@

                                                                                                                                                                -

                                                                                                                                                                Generated by pdoc 0.11.3.

                                                                                                                                                                +

                                                                                                                                                                Generated by pdoc 0.11.5.

                                                                                                                                                                diff --git a/docs/static/api-docs/slack_bolt/middleware/authorization/authorization.html b/docs/static/api-docs/slack_bolt/middleware/authorization/authorization.html index 2a686434..6922ca35 100644 --- a/docs/static/api-docs/slack_bolt/middleware/authorization/authorization.html +++ b/docs/static/api-docs/slack_bolt/middleware/authorization/authorization.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.authorization.authorization API documentation - + @@ -39,7 +50,6 @@

                                                                                                                                                                Classes

                                                                                                                                                                class Authorization
                                                                                                                                                                -

                                                                                                                                                                A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                Expand source code @@ -47,6 +57,7 @@

                                                                                                                                                                Classes

                                                                                                                                                                class Authorization(Middleware):
                                                                                                                                                                     pass
                                                                                                                                                                +

                                                                                                                                                                A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                Ancestors

                                                                                                                                                                • Middleware
                                                                                                                                                                • @@ -90,7 +101,7 @@

                                                                                                                                                                  -

                                                                                                                                                                  Generated by pdoc 0.11.3.

                                                                                                                                                                  +

                                                                                                                                                                  Generated by pdoc 0.11.5.

                                                                                                                                                                  diff --git a/docs/static/api-docs/slack_bolt/middleware/authorization/index.html b/docs/static/api-docs/slack_bolt/middleware/authorization/index.html index 7aab586c..f97cc17b 100644 --- a/docs/static/api-docs/slack_bolt/middleware/authorization/index.html +++ b/docs/static/api-docs/slack_bolt/middleware/authorization/index.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.authorization API documentation - + @@ -74,7 +85,6 @@

                                                                                                                                                                  Classes

                                                                                                                                                                  class Authorization
                                                                                                                                                                  -

                                                                                                                                                                  A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                  Expand source code @@ -82,6 +92,7 @@

                                                                                                                                                                  Classes

                                                                                                                                                                  class Authorization(Middleware):
                                                                                                                                                                       pass
                                                                                                                                                                  +

                                                                                                                                                                  A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                  Ancestors

                                                                                                                                                                  • Middleware
                                                                                                                                                                  • @@ -106,19 +117,6 @@

                                                                                                                                                                    Inherited members

                                                                                                                                                                    (*,
                                                                                                                                                                    authorize: Authorize,
                                                                                                                                                                    base_logger: logging.Logger | None = None,
                                                                                                                                                                    user_token_resolution: str = 'authed_user',
                                                                                                                                                                    user_facing_authorize_error_message: str | None = None)
                                                                                                                                                                    -

                                                                                                                                                                    A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                    -

                                                                                                                                                                    Multi-workspace authorization.

                                                                                                                                                                    -

                                                                                                                                                                    Args

                                                                                                                                                                    -
                                                                                                                                                                    -
                                                                                                                                                                    authorize
                                                                                                                                                                    -
                                                                                                                                                                    The function to authorize incoming requests from Slack.
                                                                                                                                                                    -
                                                                                                                                                                    base_logger
                                                                                                                                                                    -
                                                                                                                                                                    The base logger
                                                                                                                                                                    -
                                                                                                                                                                    user_token_resolution
                                                                                                                                                                    -
                                                                                                                                                                    "authed_user" or "actor"
                                                                                                                                                                    -
                                                                                                                                                                    user_facing_authorize_error_message
                                                                                                                                                                    -
                                                                                                                                                                    The user-facing error message when installation is not found
                                                                                                                                                                    -
                                                                                                                                                                    Expand source code @@ -214,6 +212,19 @@

                                                                                                                                                                    Args

                                                                                                                                                                    self.logger.error(f"Failed to authorize with the given token ({e})") return _build_user_facing_error_response(self.user_facing_authorize_error_message)
                                                                                                                                                                    +

                                                                                                                                                                    A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                    +

                                                                                                                                                                    Multi-workspace authorization.

                                                                                                                                                                    +

                                                                                                                                                                    Args

                                                                                                                                                                    +
                                                                                                                                                                    +
                                                                                                                                                                    authorize
                                                                                                                                                                    +
                                                                                                                                                                    The function to authorize incoming requests from Slack.
                                                                                                                                                                    +
                                                                                                                                                                    base_logger
                                                                                                                                                                    +
                                                                                                                                                                    The base logger
                                                                                                                                                                    +
                                                                                                                                                                    user_token_resolution
                                                                                                                                                                    +
                                                                                                                                                                    "authed_user" or "actor"
                                                                                                                                                                    +
                                                                                                                                                                    user_facing_authorize_error_message
                                                                                                                                                                    +
                                                                                                                                                                    The user-facing error message when installation is not found
                                                                                                                                                                    +

                                                                                                                                                                    Ancestors

                                                                                                                                                                    • Authorization
                                                                                                                                                                    • @@ -223,11 +234,11 @@

                                                                                                                                                                      Class variables

                                                                                                                                                                      var authorizeAuthorize
                                                                                                                                                                      -
                                                                                                                                                                      +

                                                                                                                                                                      The type of the None singleton.

                                                                                                                                                                      var user_token_resolution : str
                                                                                                                                                                      -
                                                                                                                                                                      +

                                                                                                                                                                      The type of the None singleton.

                                                                                                                                                                      Inherited members

                                                                                                                                                                      @@ -245,15 +256,6 @@

                                                                                                                                                                      Inherited members

                                                                                                                                                                      (*,
                                                                                                                                                                      auth_test_result: slack_sdk.web.slack_response.SlackResponse | None = None,
                                                                                                                                                                      base_logger: logging.Logger | None = None,
                                                                                                                                                                      user_facing_authorize_error_message: str | None = None)
                                                                                                                                                                      -

                                                                                                                                                                      A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                      -

                                                                                                                                                                      Single-workspace authorization.

                                                                                                                                                                      -

                                                                                                                                                                      Args

                                                                                                                                                                      -
                                                                                                                                                                      -
                                                                                                                                                                      auth_test_result
                                                                                                                                                                      -
                                                                                                                                                                      The initial auth.test API call result.
                                                                                                                                                                      -
                                                                                                                                                                      base_logger
                                                                                                                                                                      -
                                                                                                                                                                      The base logger
                                                                                                                                                                      -
                                                                                                                                                                      Expand source code @@ -326,6 +328,15 @@

                                                                                                                                                                      Args

                                                                                                                                                                      self.logger.error(f"Failed to authorize with the given token ({e})") return _build_user_facing_error_response(self.user_facing_authorize_error_message)
                                                                                                                                                                      +

                                                                                                                                                                      A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                      +

                                                                                                                                                                      Single-workspace authorization.

                                                                                                                                                                      +

                                                                                                                                                                      Args

                                                                                                                                                                      +
                                                                                                                                                                      +
                                                                                                                                                                      auth_test_result
                                                                                                                                                                      +
                                                                                                                                                                      The initial auth.test API call result.
                                                                                                                                                                      +
                                                                                                                                                                      base_logger
                                                                                                                                                                      +
                                                                                                                                                                      The base logger
                                                                                                                                                                      +

                                                                                                                                                                      Ancestors

                                                                                                                                                                      • Authorization
                                                                                                                                                                      • @@ -387,7 +398,7 @@

                                                                                                                                                                        diff --git a/docs/static/api-docs/slack_bolt/middleware/authorization/internals.html b/docs/static/api-docs/slack_bolt/middleware/authorization/internals.html index 8cda931f..62db9d31 100644 --- a/docs/static/api-docs/slack_bolt/middleware/authorization/internals.html +++ b/docs/static/api-docs/slack_bolt/middleware/authorization/internals.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.authorization.internals API documentation - + @@ -49,7 +60,7 @@

                                                                                                                                                                        Module slack_bolt.middleware.authorization.internals diff --git a/docs/static/api-docs/slack_bolt/middleware/authorization/multi_teams_authorization.html b/docs/static/api-docs/slack_bolt/middleware/authorization/multi_teams_authorization.html index e16c2c3b..1414820c 100644 --- a/docs/static/api-docs/slack_bolt/middleware/authorization/multi_teams_authorization.html +++ b/docs/static/api-docs/slack_bolt/middleware/authorization/multi_teams_authorization.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.authorization.multi_teams_authorization API documentation - + @@ -40,19 +51,6 @@

                                                                                                                                                                        Classes

                                                                                                                                                                        (*,
                                                                                                                                                                        authorize: Authorize,
                                                                                                                                                                        base_logger: logging.Logger | None = None,
                                                                                                                                                                        user_token_resolution: str = 'authed_user',
                                                                                                                                                                        user_facing_authorize_error_message: str | None = None)
                                                                                                                                                                        -

                                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                        -

                                                                                                                                                                        Multi-workspace authorization.

                                                                                                                                                                        -

                                                                                                                                                                        Args

                                                                                                                                                                        -
                                                                                                                                                                        -
                                                                                                                                                                        authorize
                                                                                                                                                                        -
                                                                                                                                                                        The function to authorize incoming requests from Slack.
                                                                                                                                                                        -
                                                                                                                                                                        base_logger
                                                                                                                                                                        -
                                                                                                                                                                        The base logger
                                                                                                                                                                        -
                                                                                                                                                                        user_token_resolution
                                                                                                                                                                        -
                                                                                                                                                                        "authed_user" or "actor"
                                                                                                                                                                        -
                                                                                                                                                                        user_facing_authorize_error_message
                                                                                                                                                                        -
                                                                                                                                                                        The user-facing error message when installation is not found
                                                                                                                                                                        -
                                                                                                                                                                        Expand source code @@ -148,6 +146,19 @@

                                                                                                                                                                        Args

                                                                                                                                                                        self.logger.error(f"Failed to authorize with the given token ({e})") return _build_user_facing_error_response(self.user_facing_authorize_error_message)
                                                                                                                                                                        +

                                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                        +

                                                                                                                                                                        Multi-workspace authorization.

                                                                                                                                                                        +

                                                                                                                                                                        Args

                                                                                                                                                                        +
                                                                                                                                                                        +
                                                                                                                                                                        authorize
                                                                                                                                                                        +
                                                                                                                                                                        The function to authorize incoming requests from Slack.
                                                                                                                                                                        +
                                                                                                                                                                        base_logger
                                                                                                                                                                        +
                                                                                                                                                                        The base logger
                                                                                                                                                                        +
                                                                                                                                                                        user_token_resolution
                                                                                                                                                                        +
                                                                                                                                                                        "authed_user" or "actor"
                                                                                                                                                                        +
                                                                                                                                                                        user_facing_authorize_error_message
                                                                                                                                                                        +
                                                                                                                                                                        The user-facing error message when installation is not found
                                                                                                                                                                        +

                                                                                                                                                                        Ancestors

                                                                                                                                                                        • Authorization
                                                                                                                                                                        • @@ -157,11 +168,11 @@

                                                                                                                                                                          Class variables

                                                                                                                                                                          var authorizeAuthorize
                                                                                                                                                                          -
                                                                                                                                                                          +

                                                                                                                                                                          The type of the None singleton.

                                                                                                                                                                          var user_token_resolution : str
                                                                                                                                                                          -
                                                                                                                                                                          +

                                                                                                                                                                          The type of the None singleton.

                                                                                                                                                                          Inherited members

                                                                                                                                                                          @@ -202,7 +213,7 @@

                                                                                                                                                                          -

                                                                                                                                                                          Generated by pdoc 0.11.3.

                                                                                                                                                                          +

                                                                                                                                                                          Generated by pdoc 0.11.5.

                                                                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/middleware/authorization/single_team_authorization.html b/docs/static/api-docs/slack_bolt/middleware/authorization/single_team_authorization.html index e660424a..535b1853 100644 --- a/docs/static/api-docs/slack_bolt/middleware/authorization/single_team_authorization.html +++ b/docs/static/api-docs/slack_bolt/middleware/authorization/single_team_authorization.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.authorization.single_team_authorization API documentation - + @@ -40,15 +51,6 @@

                                                                                                                                                                          Classes

                                                                                                                                                                          (*,
                                                                                                                                                                          auth_test_result: slack_sdk.web.slack_response.SlackResponse | None = None,
                                                                                                                                                                          base_logger: logging.Logger | None = None,
                                                                                                                                                                          user_facing_authorize_error_message: str | None = None)
                                                                                                                                                                          -

                                                                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                          -

                                                                                                                                                                          Single-workspace authorization.

                                                                                                                                                                          -

                                                                                                                                                                          Args

                                                                                                                                                                          -
                                                                                                                                                                          -
                                                                                                                                                                          auth_test_result
                                                                                                                                                                          -
                                                                                                                                                                          The initial auth.test API call result.
                                                                                                                                                                          -
                                                                                                                                                                          base_logger
                                                                                                                                                                          -
                                                                                                                                                                          The base logger
                                                                                                                                                                          -
                                                                                                                                                                          Expand source code @@ -121,6 +123,15 @@

                                                                                                                                                                          Args

                                                                                                                                                                          self.logger.error(f"Failed to authorize with the given token ({e})") return _build_user_facing_error_response(self.user_facing_authorize_error_message)
                                                                                                                                                                          +

                                                                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                          +

                                                                                                                                                                          Single-workspace authorization.

                                                                                                                                                                          +

                                                                                                                                                                          Args

                                                                                                                                                                          +
                                                                                                                                                                          +
                                                                                                                                                                          auth_test_result
                                                                                                                                                                          +
                                                                                                                                                                          The initial auth.test API call result.
                                                                                                                                                                          +
                                                                                                                                                                          base_logger
                                                                                                                                                                          +
                                                                                                                                                                          The base logger
                                                                                                                                                                          +

                                                                                                                                                                          Ancestors

                                                                                                                                                                          • Authorization
                                                                                                                                                                          • @@ -160,7 +171,7 @@

                                                                                                                                                                            -

                                                                                                                                                                            Generated by pdoc 0.11.3.

                                                                                                                                                                            +

                                                                                                                                                                            Generated by pdoc 0.11.5.

                                                                                                                                                                            diff --git a/docs/static/api-docs/slack_bolt/middleware/custom_middleware.html b/docs/static/api-docs/slack_bolt/middleware/custom_middleware.html index 3c07434a..4364973a 100644 --- a/docs/static/api-docs/slack_bolt/middleware/custom_middleware.html +++ b/docs/static/api-docs/slack_bolt/middleware/custom_middleware.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.custom_middleware API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                                                            Classes

                                                                                                                                                                            (*, app_name: str, func: Callable, base_logger: logging.Logger | None = None)
                                                                                                                                                                            -

                                                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                            Expand source code @@ -82,6 +92,7 @@

                                                                                                                                                                            Classes

                                                                                                                                                                            def name(self) -> str: return f"CustomMiddleware(func={get_name_for_callable(self.func)})"
                                                                                                                                                                            +

                                                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                            Ancestors

                                                                                                                                                                            • Middleware
                                                                                                                                                                            • @@ -90,19 +101,19 @@

                                                                                                                                                                              Class variables

                                                                                                                                                                              var app_name : str
                                                                                                                                                                              -
                                                                                                                                                                              +

                                                                                                                                                                              The type of the None singleton.

                                                                                                                                                                              var arg_names : MutableSequence[str]
                                                                                                                                                                              -
                                                                                                                                                                              +

                                                                                                                                                                              The type of the None singleton.

                                                                                                                                                                              var func : Callable[..., Any]
                                                                                                                                                                              -
                                                                                                                                                                              +

                                                                                                                                                                              The type of the None singleton.

                                                                                                                                                                              var logger : logging.Logger
                                                                                                                                                                              -
                                                                                                                                                                              +

                                                                                                                                                                              The type of the None singleton.

                                                                                                                                                                              Inherited members

                                                                                                                                                                              @@ -145,7 +156,7 @@

                                                                                                                                                                              diff --git a/docs/static/api-docs/slack_bolt/middleware/ignoring_self_events/async_ignoring_self_events.html b/docs/static/api-docs/slack_bolt/middleware/ignoring_self_events/async_ignoring_self_events.html index f47c02d2..5b0f3165 100644 --- a/docs/static/api-docs/slack_bolt/middleware/ignoring_self_events/async_ignoring_self_events.html +++ b/docs/static/api-docs/slack_bolt/middleware/ignoring_self_events/async_ignoring_self_events.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.ignoring_self_events.async_ignoring_self_events API documentation - + @@ -40,8 +51,6 @@

                                                                                                                                                                              Classes

                                                                                                                                                                              (base_logger: logging.Logger | None = None,
                                                                                                                                                                              ignoring_self_assistant_message_events_enabled: bool = True)
                                                                                                                                                                              -

                                                                                                                                                                              A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                              -

                                                                                                                                                                              Ignores the events generated by this bot user itself.

                                                                                                                                                                              Expand source code @@ -68,6 +77,8 @@

                                                                                                                                                                              Classes

                                                                                                                                                                              else: return await next()
                                                                                                                                                                              +

                                                                                                                                                                              A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                              +

                                                                                                                                                                              Ignores the events generated by this bot user itself.

                                                                                                                                                                              Ancestors

                                                                                                                                                                              • IgnoringSelfEvents
                                                                                                                                                                              • @@ -78,6 +89,7 @@

                                                                                                                                                                                Inherited members

                                                                                                                                                                                • IgnoringSelfEvents: @@ -113,7 +125,7 @@

                                                                                                                                                                                  -

                                                                                                                                                                                  Generated by pdoc 0.11.3.

                                                                                                                                                                                  +

                                                                                                                                                                                  Generated by pdoc 0.11.5.

                                                                                                                                                                                  diff --git a/docs/static/api-docs/slack_bolt/middleware/ignoring_self_events/ignoring_self_events.html b/docs/static/api-docs/slack_bolt/middleware/ignoring_self_events/ignoring_self_events.html index 8961f06c..2c1a5eff 100644 --- a/docs/static/api-docs/slack_bolt/middleware/ignoring_self_events/ignoring_self_events.html +++ b/docs/static/api-docs/slack_bolt/middleware/ignoring_self_events/ignoring_self_events.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.ignoring_self_events.ignoring_self_events API documentation - + @@ -40,8 +51,6 @@

                                                                                                                                                                                  Classes

                                                                                                                                                                                  (base_logger: logging.Logger | None = None,
                                                                                                                                                                                  ignoring_self_assistant_message_events_enabled: bool = True)
                                                                                                                                                                                  -

                                                                                                                                                                                  A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                  -

                                                                                                                                                                                  Ignores the events generated by this bot user itself.

                                                                                                                                                                                  Expand source code @@ -107,6 +116,8 @@

                                                                                                                                                                                  Classes

                                                                                                                                                                                  event = body.get("event") self.logger.debug(f"Skipped self event: {event}")
                                                                                                                                                                                  +

                                                                                                                                                                                  A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                  +

                                                                                                                                                                                  Ignores the events generated by this bot user itself.

                                                                                                                                                                                  Ancestors

                                                                                                                                                                                  • Middleware
                                                                                                                                                                                  • @@ -119,7 +130,7 @@

                                                                                                                                                                                    Class variables

                                                                                                                                                                                    var events_that_should_be_kept
                                                                                                                                                                                    -
                                                                                                                                                                                    +

                                                                                                                                                                                    The type of the None singleton.

                                                                                                                                                                                    Inherited members

                                                                                                                                                                                    @@ -159,7 +170,7 @@

                                                                                                                                                                                    -

                                                                                                                                                                                    Generated by pdoc 0.11.3.

                                                                                                                                                                                    +

                                                                                                                                                                                    Generated by pdoc 0.11.5.

                                                                                                                                                                                    diff --git a/docs/static/api-docs/slack_bolt/middleware/ignoring_self_events/index.html b/docs/static/api-docs/slack_bolt/middleware/ignoring_self_events/index.html index 72dade33..9c37fbb8 100644 --- a/docs/static/api-docs/slack_bolt/middleware/ignoring_self_events/index.html +++ b/docs/static/api-docs/slack_bolt/middleware/ignoring_self_events/index.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.ignoring_self_events API documentation - + @@ -51,8 +62,6 @@

                                                                                                                                                                                    Classes

                                                                                                                                                                                    (base_logger: logging.Logger | None = None,
                                                                                                                                                                                    ignoring_self_assistant_message_events_enabled: bool = True)
                                                                                                                                                                                    -

                                                                                                                                                                                    A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                    -

                                                                                                                                                                                    Ignores the events generated by this bot user itself.

                                                                                                                                                                                    Expand source code @@ -118,6 +127,8 @@

                                                                                                                                                                                    Classes

                                                                                                                                                                                    event = body.get("event") self.logger.debug(f"Skipped self event: {event}")
                                                                                                                                                                                    +

                                                                                                                                                                                    A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                    +

                                                                                                                                                                                    Ignores the events generated by this bot user itself.

                                                                                                                                                                                    Ancestors

                                                                                                                                                                                    • Middleware
                                                                                                                                                                                    • @@ -130,7 +141,7 @@

                                                                                                                                                                                      Class variables

                                                                                                                                                                                      var events_that_should_be_kept
                                                                                                                                                                                      -
                                                                                                                                                                                      +

                                                                                                                                                                                      The type of the None singleton.

                                                                                                                                                                                      Inherited members

                                                                                                                                                                                      @@ -176,7 +187,7 @@

                                                                                                                                                                                      -

                                                                                                                                                                                      Generated by pdoc 0.11.3.

                                                                                                                                                                                      +

                                                                                                                                                                                      Generated by pdoc 0.11.5.

                                                                                                                                                                                      diff --git a/docs/static/api-docs/slack_bolt/middleware/index.html b/docs/static/api-docs/slack_bolt/middleware/index.html index 0e0ca818..abbaa52d 100644 --- a/docs/static/api-docs/slack_bolt/middleware/index.html +++ b/docs/static/api-docs/slack_bolt/middleware/index.html @@ -3,20 +3,31 @@ - + slack_bolt.middleware API documentation - + @@ -107,7 +118,6 @@

                                                                                                                                                                                      Classes

                                                                                                                                                                                      class AttachingFunctionToken
                                                                                                                                                                                      -

                                                                                                                                                                                      A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                      Expand source code @@ -126,6 +136,7 @@

                                                                                                                                                                                      Classes

                                                                                                                                                                                      return next()
                                                                                                                                                                                      +

                                                                                                                                                                                      A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                      Ancestors

                                                                                                                                                                                      • Middleware
                                                                                                                                                                                      • @@ -145,7 +156,6 @@

                                                                                                                                                                                        Inherited members

                                                                                                                                                                                        (*, app_name: str, func: Callable, base_logger: logging.Logger | None = None)
                                                                                                                                                                                        -

                                                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                        Expand source code @@ -187,6 +197,7 @@

                                                                                                                                                                                        Inherited members

                                                                                                                                                                                        def name(self) -> str: return f"CustomMiddleware(func={get_name_for_callable(self.func)})"
                                                                                                                                                                                        +

                                                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                        Ancestors

                                                                                                                                                                                        • Middleware
                                                                                                                                                                                        • @@ -195,19 +206,19 @@

                                                                                                                                                                                          Class variables

                                                                                                                                                                                          var app_name : str
                                                                                                                                                                                          -
                                                                                                                                                                                          +

                                                                                                                                                                                          The type of the None singleton.

                                                                                                                                                                                          var arg_names : MutableSequence[str]
                                                                                                                                                                                          -
                                                                                                                                                                                          +

                                                                                                                                                                                          The type of the None singleton.

                                                                                                                                                                                          var func : Callable[..., Any]
                                                                                                                                                                                          -
                                                                                                                                                                                          +

                                                                                                                                                                                          The type of the None singleton.

                                                                                                                                                                                          var logger : logging.Logger
                                                                                                                                                                                          -
                                                                                                                                                                                          +

                                                                                                                                                                                          The type of the None singleton.

                                                                                                                                                                                          Inherited members

                                                                                                                                                                                          @@ -225,8 +236,6 @@

                                                                                                                                                                                          Inherited members

                                                                                                                                                                                          (base_logger: logging.Logger | None = None,
                                                                                                                                                                                          ignoring_self_assistant_message_events_enabled: bool = True)
                                                                                                                                                                                          -

                                                                                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                          -

                                                                                                                                                                                          Ignores the events generated by this bot user itself.

                                                                                                                                                                                          Expand source code @@ -292,6 +301,8 @@

                                                                                                                                                                                          Inherited members

                                                                                                                                                                                          event = body.get("event") self.logger.debug(f"Skipped self event: {event}")
                                                                                                                                                                                          +

                                                                                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                          +

                                                                                                                                                                                          Ignores the events generated by this bot user itself.

                                                                                                                                                                                          Ancestors

                                                                                                                                                                                          • Middleware
                                                                                                                                                                                          • @@ -304,7 +315,7 @@

                                                                                                                                                                                            Class variables

                                                                                                                                                                                            var events_that_should_be_kept
                                                                                                                                                                                            -
                                                                                                                                                                                            +

                                                                                                                                                                                            The type of the None singleton.

                                                                                                                                                                                            Inherited members

                                                                                                                                                                                            @@ -321,7 +332,6 @@

                                                                                                                                                                                            Inherited members

                                                                                                                                                                                            class Middleware
                                                                                                                                                                                            -

                                                                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                            Expand source code @@ -371,6 +381,7 @@

                                                                                                                                                                                            Inherited members

                                                                                                                                                                                            """The name of this middleware""" return f"{self.__module__}.{self.__class__.__name__}"
                                                                                                                                                                                            +

                                                                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                            Subclasses

                                                                                                                                                                                            • Assistant
                                                                                                                                                                                            • @@ -388,7 +399,6 @@

                                                                                                                                                                                              Instance variables

                                                                                                                                                                                              prop name : str
                                                                                                                                                                                              -

                                                                                                                                                                                              The name of this middleware

                                                                                                                                                                                              Expand source code @@ -398,6 +408,7 @@

                                                                                                                                                                                              Instance variables

                                                                                                                                                                                              """The name of this middleware""" return f"{self.__module__}.{self.__class__.__name__}"
                                                                                                                                                                                              +

                                                                                                                                                                                              The name of this middleware

                                                                                                                                                                                              Methods

                                                                                                                                                                                              @@ -406,6 +417,47 @@

                                                                                                                                                                                              Methods

                                                                                                                                                                                              def process(self,
                                                                                                                                                                                              *,
                                                                                                                                                                                              req: BoltRequest,
                                                                                                                                                                                              resp: BoltResponse,
                                                                                                                                                                                              next: Callable[[], BoltResponse]) ‑> BoltResponse | None
                                                                                                                                                                                              +
                                                                                                                                                                                              + +Expand source code + +
                                                                                                                                                                                              @abstractmethod
                                                                                                                                                                                              +def process(
                                                                                                                                                                                              +    self,
                                                                                                                                                                                              +    *,
                                                                                                                                                                                              +    req: BoltRequest,
                                                                                                                                                                                              +    resp: BoltResponse,
                                                                                                                                                                                              +    # As this method is not supposed to be invoked by bolt-python users,
                                                                                                                                                                                              +    # the naming conflict with the built-in one affects
                                                                                                                                                                                              +    # only the internals of this method
                                                                                                                                                                                              +    next: Callable[[], BoltResponse],
                                                                                                                                                                                              +) -> Optional[BoltResponse]:
                                                                                                                                                                                              +    """Processes a request data before other middleware and listeners.
                                                                                                                                                                                              +    A middleware calls `next()` function if the chain should continue.
                                                                                                                                                                                              +
                                                                                                                                                                                              +        @app.middleware
                                                                                                                                                                                              +        def simple_middleware(req, resp, next):
                                                                                                                                                                                              +            # do something here
                                                                                                                                                                                              +            next()
                                                                                                                                                                                              +
                                                                                                                                                                                              +    This `process(req, resp, next)` method is supposed to be invoked only inside bolt-python.
                                                                                                                                                                                              +    If you want to avoid the name `next()` in your middleware functions, you can use `next_()` method instead.
                                                                                                                                                                                              +
                                                                                                                                                                                              +        @app.middleware
                                                                                                                                                                                              +        def simple_middleware(req, resp, next_):
                                                                                                                                                                                              +            # do something here
                                                                                                                                                                                              +            next_()
                                                                                                                                                                                              +
                                                                                                                                                                                              +    Args:
                                                                                                                                                                                              +        req: The incoming request
                                                                                                                                                                                              +        resp: The response
                                                                                                                                                                                              +        next: The function to tell the chain that it can continue
                                                                                                                                                                                              +
                                                                                                                                                                                              +    Returns:
                                                                                                                                                                                              +        Processed response (optional)
                                                                                                                                                                                              +    """
                                                                                                                                                                                              +    raise NotImplementedError()
                                                                                                                                                                                              +

                                                                                                                                                                                              Processes a request data before other middleware and listeners. A middleware calls next() function if the chain should continue.

                                                                                                                                                                                              @app.middleware
                                                                                                                                                                                              @@ -439,19 +491,6 @@ 

                                                                                                                                                                                              Returns

                                                                                                                                                                                              (*,
                                                                                                                                                                                              authorize: Authorize,
                                                                                                                                                                                              base_logger: logging.Logger | None = None,
                                                                                                                                                                                              user_token_resolution: str = 'authed_user',
                                                                                                                                                                                              user_facing_authorize_error_message: str | None = None)
                                                                                                                                                                                              -

                                                                                                                                                                                              A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                              -

                                                                                                                                                                                              Multi-workspace authorization.

                                                                                                                                                                                              -

                                                                                                                                                                                              Args

                                                                                                                                                                                              -
                                                                                                                                                                                              -
                                                                                                                                                                                              authorize
                                                                                                                                                                                              -
                                                                                                                                                                                              The function to authorize incoming requests from Slack.
                                                                                                                                                                                              -
                                                                                                                                                                                              base_logger
                                                                                                                                                                                              -
                                                                                                                                                                                              The base logger
                                                                                                                                                                                              -
                                                                                                                                                                                              user_token_resolution
                                                                                                                                                                                              -
                                                                                                                                                                                              "authed_user" or "actor"
                                                                                                                                                                                              -
                                                                                                                                                                                              user_facing_authorize_error_message
                                                                                                                                                                                              -
                                                                                                                                                                                              The user-facing error message when installation is not found
                                                                                                                                                                                              -
                                                                                                                                                                                              Expand source code @@ -547,6 +586,19 @@

                                                                                                                                                                                              Args

                                                                                                                                                                                              self.logger.error(f"Failed to authorize with the given token ({e})") return _build_user_facing_error_response(self.user_facing_authorize_error_message)
                                                                                                                                                                                              +

                                                                                                                                                                                              A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                              +

                                                                                                                                                                                              Multi-workspace authorization.

                                                                                                                                                                                              +

                                                                                                                                                                                              Args

                                                                                                                                                                                              +
                                                                                                                                                                                              +
                                                                                                                                                                                              authorize
                                                                                                                                                                                              +
                                                                                                                                                                                              The function to authorize incoming requests from Slack.
                                                                                                                                                                                              +
                                                                                                                                                                                              base_logger
                                                                                                                                                                                              +
                                                                                                                                                                                              The base logger
                                                                                                                                                                                              +
                                                                                                                                                                                              user_token_resolution
                                                                                                                                                                                              +
                                                                                                                                                                                              "authed_user" or "actor"
                                                                                                                                                                                              +
                                                                                                                                                                                              user_facing_authorize_error_message
                                                                                                                                                                                              +
                                                                                                                                                                                              The user-facing error message when installation is not found
                                                                                                                                                                                              +

                                                                                                                                                                                              Ancestors

                                                                                                                                                                                              • Authorization
                                                                                                                                                                                              • @@ -556,11 +608,11 @@

                                                                                                                                                                                                Class variables

                                                                                                                                                                                                var authorizeAuthorize
                                                                                                                                                                                                -
                                                                                                                                                                                                +

                                                                                                                                                                                                The type of the None singleton.

                                                                                                                                                                                                var user_token_resolution : str
                                                                                                                                                                                                -
                                                                                                                                                                                                +

                                                                                                                                                                                                The type of the None singleton.

                                                                                                                                                                                                Inherited members

                                                                                                                                                                                                @@ -578,17 +630,6 @@

                                                                                                                                                                                                Inherited members

                                                                                                                                                                                                (signing_secret: str, base_logger: logging.Logger | None = None)
                                                                                                                                                                                                -

                                                                                                                                                                                                A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                -

                                                                                                                                                                                                Verifies an incoming request by checking the validity of -x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                                                                                -

                                                                                                                                                                                                Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                                                                                -

                                                                                                                                                                                                Args

                                                                                                                                                                                                -
                                                                                                                                                                                                -
                                                                                                                                                                                                signing_secret
                                                                                                                                                                                                -
                                                                                                                                                                                                The signing secret
                                                                                                                                                                                                -
                                                                                                                                                                                                base_logger
                                                                                                                                                                                                -
                                                                                                                                                                                                The base logger
                                                                                                                                                                                                -
                                                                                                                                                                                                Expand source code @@ -644,6 +685,17 @@

                                                                                                                                                                                                Args

                                                                                                                                                                                                "Invalid request signature detected " f"(signature: {signature}, timestamp: {timestamp}, body: {body})" )
                                                                                                                                                                                                +

                                                                                                                                                                                                A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                +

                                                                                                                                                                                                Verifies an incoming request by checking the validity of +x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                                                                                +

                                                                                                                                                                                                Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                                                                                +

                                                                                                                                                                                                Args

                                                                                                                                                                                                +
                                                                                                                                                                                                +
                                                                                                                                                                                                signing_secret
                                                                                                                                                                                                +
                                                                                                                                                                                                The signing secret
                                                                                                                                                                                                +
                                                                                                                                                                                                base_logger
                                                                                                                                                                                                +
                                                                                                                                                                                                The base logger
                                                                                                                                                                                                +

                                                                                                                                                                                                Ancestors

                                                                                                                                                                                                • Middleware
                                                                                                                                                                                                • @@ -667,15 +719,6 @@

                                                                                                                                                                                                  Inherited members

                                                                                                                                                                                                  (*,
                                                                                                                                                                                                  auth_test_result: slack_sdk.web.slack_response.SlackResponse | None = None,
                                                                                                                                                                                                  base_logger: logging.Logger | None = None,
                                                                                                                                                                                                  user_facing_authorize_error_message: str | None = None)
                                                                                                                                                                                                  -

                                                                                                                                                                                                  A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                  -

                                                                                                                                                                                                  Single-workspace authorization.

                                                                                                                                                                                                  -

                                                                                                                                                                                                  Args

                                                                                                                                                                                                  -
                                                                                                                                                                                                  -
                                                                                                                                                                                                  auth_test_result
                                                                                                                                                                                                  -
                                                                                                                                                                                                  The initial auth.test API call result.
                                                                                                                                                                                                  -
                                                                                                                                                                                                  base_logger
                                                                                                                                                                                                  -
                                                                                                                                                                                                  The base logger
                                                                                                                                                                                                  -
                                                                                                                                                                                                  Expand source code @@ -748,6 +791,15 @@

                                                                                                                                                                                                  Args

                                                                                                                                                                                                  self.logger.error(f"Failed to authorize with the given token ({e})") return _build_user_facing_error_response(self.user_facing_authorize_error_message)
                                                                                                                                                                                                  +

                                                                                                                                                                                                  A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                  +

                                                                                                                                                                                                  Single-workspace authorization.

                                                                                                                                                                                                  +

                                                                                                                                                                                                  Args

                                                                                                                                                                                                  +
                                                                                                                                                                                                  +
                                                                                                                                                                                                  auth_test_result
                                                                                                                                                                                                  +
                                                                                                                                                                                                  The initial auth.test API call result.
                                                                                                                                                                                                  +
                                                                                                                                                                                                  base_logger
                                                                                                                                                                                                  +
                                                                                                                                                                                                  The base logger
                                                                                                                                                                                                  +

                                                                                                                                                                                                  Ancestors

                                                                                                                                                                                                  • Authorization
                                                                                                                                                                                                  • @@ -768,17 +820,6 @@

                                                                                                                                                                                                    Inherited members

                                                                                                                                                                                                    (verification_token: str | None = None,
                                                                                                                                                                                                    base_logger: logging.Logger | None = None)
                                                                                                                                                                                                    -

                                                                                                                                                                                                    A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                    -

                                                                                                                                                                                                    Handles slack_bolt.middleware.ssl_check requests. -Refer to https://api.slack.com/interactivity/slash-commands for details.

                                                                                                                                                                                                    -

                                                                                                                                                                                                    Args

                                                                                                                                                                                                    -
                                                                                                                                                                                                    -
                                                                                                                                                                                                    verification_token
                                                                                                                                                                                                    -
                                                                                                                                                                                                    The verification token to check -(optional as it's already deprecated - https://api.slack.com/authentication/verifying-requests-from-slack#verification_token_deprecation)
                                                                                                                                                                                                    -
                                                                                                                                                                                                    base_logger
                                                                                                                                                                                                    -
                                                                                                                                                                                                    The base logger
                                                                                                                                                                                                    -
                                                                                                                                                                                                    Expand source code @@ -837,6 +878,17 @@

                                                                                                                                                                                                    Args

                                                                                                                                                                                                    def _build_error_response() -> BoltResponse: return BoltResponse(status=401, body={"error": "invalid verification token"})
                                                                                                                                                                                                    +

                                                                                                                                                                                                    A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                    +

                                                                                                                                                                                                    Handles slack_bolt.middleware.ssl_check requests. +Refer to https://api.slack.com/interactivity/slash-commands for details.

                                                                                                                                                                                                    +

                                                                                                                                                                                                    Args

                                                                                                                                                                                                    +
                                                                                                                                                                                                    +
                                                                                                                                                                                                    verification_token
                                                                                                                                                                                                    +
                                                                                                                                                                                                    The verification token to check +(optional as it's already deprecated - https://api.slack.com/authentication/verifying-requests-from-slack#verification_token_deprecation)
                                                                                                                                                                                                    +
                                                                                                                                                                                                    base_logger
                                                                                                                                                                                                    +
                                                                                                                                                                                                    The base logger
                                                                                                                                                                                                    +

                                                                                                                                                                                                    Ancestors

                                                                                                                                                                                                    • Middleware
                                                                                                                                                                                                    • @@ -849,11 +901,11 @@

                                                                                                                                                                                                      Class variables

                                                                                                                                                                                                      var logger : logging.Logger
                                                                                                                                                                                                      -
                                                                                                                                                                                                      +

                                                                                                                                                                                                      The type of the None singleton.

                                                                                                                                                                                                      var verification_token : str | None
                                                                                                                                                                                                      -
                                                                                                                                                                                                      +

                                                                                                                                                                                                      The type of the None singleton.

                                                                                                                                                                                                      Inherited members

                                                                                                                                                                                                      @@ -871,14 +923,6 @@

                                                                                                                                                                                                      Inherited members

                                                                                                                                                                                                      (base_logger: logging.Logger | None = None)
                                                                                                                                                                                                      -

                                                                                                                                                                                                      A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                      -

                                                                                                                                                                                                      Handles url_verification requests.

                                                                                                                                                                                                      -

                                                                                                                                                                                                      Refer to https://api.slack.com/events/url_verification for details.

                                                                                                                                                                                                      -

                                                                                                                                                                                                      Args

                                                                                                                                                                                                      -
                                                                                                                                                                                                      -
                                                                                                                                                                                                      base_logger
                                                                                                                                                                                                      -
                                                                                                                                                                                                      The base logger
                                                                                                                                                                                                      -
                                                                                                                                                                                                      Expand source code @@ -919,6 +963,14 @@

                                                                                                                                                                                                      Args

                                                                                                                                                                                                      def _build_success_response(body: dict) -> BoltResponse: return BoltResponse(status=200, body={"challenge": body.get("challenge")})
                                                                                                                                                                                                      +

                                                                                                                                                                                                      A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                      +

                                                                                                                                                                                                      Handles url_verification requests.

                                                                                                                                                                                                      +

                                                                                                                                                                                                      Refer to https://api.slack.com/events/url_verification for details.

                                                                                                                                                                                                      +

                                                                                                                                                                                                      Args

                                                                                                                                                                                                      +
                                                                                                                                                                                                      +
                                                                                                                                                                                                      base_logger
                                                                                                                                                                                                      +
                                                                                                                                                                                                      The base logger
                                                                                                                                                                                                      +

                                                                                                                                                                                                      Ancestors

                                                                                                                                                                                                      • Middleware
                                                                                                                                                                                                      • @@ -1025,7 +1077,7 @@

                                                                                                                                                                                                        -

                                                                                                                                                                                                        Generated by pdoc 0.11.3.

                                                                                                                                                                                                        +

                                                                                                                                                                                                        Generated by pdoc 0.11.5.

                                                                                                                                                                                                        diff --git a/docs/static/api-docs/slack_bolt/middleware/message_listener_matches/async_message_listener_matches.html b/docs/static/api-docs/slack_bolt/middleware/message_listener_matches/async_message_listener_matches.html index 6e3ed25b..79066955 100644 --- a/docs/static/api-docs/slack_bolt/middleware/message_listener_matches/async_message_listener_matches.html +++ b/docs/static/api-docs/slack_bolt/middleware/message_listener_matches/async_message_listener_matches.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.message_listener_matches.async_message_listener_matches API documentation - + @@ -40,8 +51,6 @@

                                                                                                                                                                                                        Classes

                                                                                                                                                                                                        (keyword: str | Pattern)
                                                                                                                                                                                                        -

                                                                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                        -

                                                                                                                                                                                                        Captures matched keywords and saves the values in context.

                                                                                                                                                                                                        Expand source code @@ -75,6 +84,8 @@

                                                                                                                                                                                                        Classes

                                                                                                                                                                                                        # As the text doesn't match, skip running the listener return resp
                                                                                                                                                                                                        +

                                                                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                        +

                                                                                                                                                                                                        Captures matched keywords and saves the values in context.

                                                                                                                                                                                                        Ancestors

                                                                                                                                                                                                        • AsyncMiddleware
                                                                                                                                                                                                        • @@ -113,7 +124,7 @@

                                                                                                                                                                                                          -

                                                                                                                                                                                                          Generated by pdoc 0.11.3.

                                                                                                                                                                                                          +

                                                                                                                                                                                                          Generated by pdoc 0.11.5.

                                                                                                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/middleware/message_listener_matches/index.html b/docs/static/api-docs/slack_bolt/middleware/message_listener_matches/index.html index 66b8211b..340bfca8 100644 --- a/docs/static/api-docs/slack_bolt/middleware/message_listener_matches/index.html +++ b/docs/static/api-docs/slack_bolt/middleware/message_listener_matches/index.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.message_listener_matches API documentation - + @@ -51,8 +62,6 @@

                                                                                                                                                                                                          Classes

                                                                                                                                                                                                          (keyword: str | Pattern)
                                                                                                                                                                                                          -

                                                                                                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                          -

                                                                                                                                                                                                          Captures matched keywords and saves the values in context.

                                                                                                                                                                                                          Expand source code @@ -86,6 +95,8 @@

                                                                                                                                                                                                          Classes

                                                                                                                                                                                                          # As the text doesn't match, skip running the listener return resp
                                                                                                                                                                                                          +

                                                                                                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                          +

                                                                                                                                                                                                          Captures matched keywords and saves the values in context.

                                                                                                                                                                                                          Ancestors

                                                                                                                                                                                                          • Middleware
                                                                                                                                                                                                          • @@ -130,7 +141,7 @@

                                                                                                                                                                                                            -

                                                                                                                                                                                                            Generated by pdoc 0.11.3.

                                                                                                                                                                                                            +

                                                                                                                                                                                                            Generated by pdoc 0.11.5.

                                                                                                                                                                                                            diff --git a/docs/static/api-docs/slack_bolt/middleware/message_listener_matches/message_listener_matches.html b/docs/static/api-docs/slack_bolt/middleware/message_listener_matches/message_listener_matches.html index 65a62429..67481a68 100644 --- a/docs/static/api-docs/slack_bolt/middleware/message_listener_matches/message_listener_matches.html +++ b/docs/static/api-docs/slack_bolt/middleware/message_listener_matches/message_listener_matches.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.message_listener_matches.message_listener_matches API documentation - + @@ -40,8 +51,6 @@

                                                                                                                                                                                                            Classes

                                                                                                                                                                                                            (keyword: str | Pattern)
                                                                                                                                                                                                            -

                                                                                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                            -

                                                                                                                                                                                                            Captures matched keywords and saves the values in context.

                                                                                                                                                                                                            Expand source code @@ -75,6 +84,8 @@

                                                                                                                                                                                                            Classes

                                                                                                                                                                                                            # As the text doesn't match, skip running the listener return resp
                                                                                                                                                                                                            +

                                                                                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                            +

                                                                                                                                                                                                            Captures matched keywords and saves the values in context.

                                                                                                                                                                                                            Ancestors

                                                                                                                                                                                                            • Middleware
                                                                                                                                                                                                            • @@ -113,7 +124,7 @@

                                                                                                                                                                                                              -

                                                                                                                                                                                                              Generated by pdoc 0.11.3.

                                                                                                                                                                                                              +

                                                                                                                                                                                                              Generated by pdoc 0.11.5.

                                                                                                                                                                                                              diff --git a/docs/static/api-docs/slack_bolt/middleware/middleware.html b/docs/static/api-docs/slack_bolt/middleware/middleware.html index c73ea7eb..f2940d31 100644 --- a/docs/static/api-docs/slack_bolt/middleware/middleware.html +++ b/docs/static/api-docs/slack_bolt/middleware/middleware.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.middleware API documentation - + @@ -39,7 +50,6 @@

                                                                                                                                                                                                              Classes

                                                                                                                                                                                                              class Middleware
                                                                                                                                                                                                              -

                                                                                                                                                                                                              A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                              Expand source code @@ -89,6 +99,7 @@

                                                                                                                                                                                                              Classes

                                                                                                                                                                                                              """The name of this middleware""" return f"{self.__module__}.{self.__class__.__name__}"
                                                                                                                                                                                                              +

                                                                                                                                                                                                              A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                              Subclasses

                                                                                                                                                                                                              • Assistant
                                                                                                                                                                                                              • @@ -106,7 +117,6 @@

                                                                                                                                                                                                                Instance variables

                                                                                                                                                                                                                prop name : str
                                                                                                                                                                                                                -

                                                                                                                                                                                                                The name of this middleware

                                                                                                                                                                                                                Expand source code @@ -116,6 +126,7 @@

                                                                                                                                                                                                                Instance variables

                                                                                                                                                                                                                """The name of this middleware""" return f"{self.__module__}.{self.__class__.__name__}"
                                                                                                                                                                                                                +

                                                                                                                                                                                                                The name of this middleware

                                                                                                                                                                                                                Methods

                                                                                                                                                                                                                @@ -124,6 +135,47 @@

                                                                                                                                                                                                                Methods

                                                                                                                                                                                                                def process(self,
                                                                                                                                                                                                                *,
                                                                                                                                                                                                                req: BoltRequest,
                                                                                                                                                                                                                resp: BoltResponse,
                                                                                                                                                                                                                next: Callable[[], BoltResponse]) ‑> BoltResponse | None
                                                                                                                                                                                                                +
                                                                                                                                                                                                                + +Expand source code + +
                                                                                                                                                                                                                @abstractmethod
                                                                                                                                                                                                                +def process(
                                                                                                                                                                                                                +    self,
                                                                                                                                                                                                                +    *,
                                                                                                                                                                                                                +    req: BoltRequest,
                                                                                                                                                                                                                +    resp: BoltResponse,
                                                                                                                                                                                                                +    # As this method is not supposed to be invoked by bolt-python users,
                                                                                                                                                                                                                +    # the naming conflict with the built-in one affects
                                                                                                                                                                                                                +    # only the internals of this method
                                                                                                                                                                                                                +    next: Callable[[], BoltResponse],
                                                                                                                                                                                                                +) -> Optional[BoltResponse]:
                                                                                                                                                                                                                +    """Processes a request data before other middleware and listeners.
                                                                                                                                                                                                                +    A middleware calls `next()` function if the chain should continue.
                                                                                                                                                                                                                +
                                                                                                                                                                                                                +        @app.middleware
                                                                                                                                                                                                                +        def simple_middleware(req, resp, next):
                                                                                                                                                                                                                +            # do something here
                                                                                                                                                                                                                +            next()
                                                                                                                                                                                                                +
                                                                                                                                                                                                                +    This `process(req, resp, next)` method is supposed to be invoked only inside bolt-python.
                                                                                                                                                                                                                +    If you want to avoid the name `next()` in your middleware functions, you can use `next_()` method instead.
                                                                                                                                                                                                                +
                                                                                                                                                                                                                +        @app.middleware
                                                                                                                                                                                                                +        def simple_middleware(req, resp, next_):
                                                                                                                                                                                                                +            # do something here
                                                                                                                                                                                                                +            next_()
                                                                                                                                                                                                                +
                                                                                                                                                                                                                +    Args:
                                                                                                                                                                                                                +        req: The incoming request
                                                                                                                                                                                                                +        resp: The response
                                                                                                                                                                                                                +        next: The function to tell the chain that it can continue
                                                                                                                                                                                                                +
                                                                                                                                                                                                                +    Returns:
                                                                                                                                                                                                                +        Processed response (optional)
                                                                                                                                                                                                                +    """
                                                                                                                                                                                                                +    raise NotImplementedError()
                                                                                                                                                                                                                +

                                                                                                                                                                                                                Processes a request data before other middleware and listeners. A middleware calls next() function if the chain should continue.

                                                                                                                                                                                                                @app.middleware
                                                                                                                                                                                                                @@ -180,7 +232,7 @@ 

                                                                                                                                                                                                                -

                                                                                                                                                                                                                Generated by pdoc 0.11.3.

                                                                                                                                                                                                                +

                                                                                                                                                                                                                Generated by pdoc 0.11.5.

                                                                                                                                                                                                                diff --git a/docs/static/api-docs/slack_bolt/middleware/middleware_error_handler.html b/docs/static/api-docs/slack_bolt/middleware/middleware_error_handler.html index 8b32c049..8dcce602 100644 --- a/docs/static/api-docs/slack_bolt/middleware/middleware_error_handler.html +++ b/docs/static/api-docs/slack_bolt/middleware/middleware_error_handler.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.middleware_error_handler API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                                                                                                Classes

                                                                                                                                                                                                                (logger: logging.Logger,
                                                                                                                                                                                                                func: Callable[..., BoltResponse | None])
                                                                                                                                                                                                                -
                                                                                                                                                                                                                Expand source code @@ -71,6 +81,7 @@

                                                                                                                                                                                                                Classes

                                                                                                                                                                                                                response.headers = returned_response.headers # type: ignore[union-attr] response.body = returned_response.body # type: ignore[union-attr]

                                                                                                                                                                                                                +

                                                                                                                                                                                                                Ancestors

                                                                                                                                                                                                                • MiddlewareErrorHandler
                                                                                                                                                                                                                • @@ -89,7 +100,6 @@

                                                                                                                                                                                                                  Inherited members

                                                                                                                                                                                                                  (logger: logging.Logger)
                                                                                                                                                                                                                  -
                                                                                                                                                                                                                  Expand source code @@ -107,6 +117,7 @@

                                                                                                                                                                                                                  Inherited members

                                                                                                                                                                                                                  message = f"Failed to run a middleware (error: {error})" self.logger.exception(message)
                                                                                                                                                                                                                  +

                                                                                                                                                                                                                  Ancestors

                                                                                                                                                                                                                  • MiddlewareErrorHandler
                                                                                                                                                                                                                  • @@ -124,7 +135,6 @@

                                                                                                                                                                                                                    Inherited members

                                                                                                                                                                                                                    class MiddlewareErrorHandler
                                                                                                                                                                                                                    -
                                                                                                                                                                                                                    Expand source code @@ -146,6 +156,7 @@

                                                                                                                                                                                                                    Inherited members

                                                                                                                                                                                                                    """ raise NotImplementedError()
                                                                                                                                                                                                                    +

                                                                                                                                                                                                                    Subclasses

                                                                                                                                                                                                                    • CustomMiddlewareErrorHandler
                                                                                                                                                                                                                    • @@ -157,6 +168,26 @@

                                                                                                                                                                                                                      Methods

                                                                                                                                                                                                                      def handle(self,
                                                                                                                                                                                                                      error: Exception,
                                                                                                                                                                                                                      request: BoltRequest,
                                                                                                                                                                                                                      response: BoltResponse | None) ‑> None
                                                                                                                                                                                                                      +
                                                                                                                                                                                                                      + +Expand source code + +
                                                                                                                                                                                                                      @abstractmethod
                                                                                                                                                                                                                      +def handle(
                                                                                                                                                                                                                      +    self,
                                                                                                                                                                                                                      +    error: Exception,
                                                                                                                                                                                                                      +    request: BoltRequest,
                                                                                                                                                                                                                      +    response: Optional[BoltResponse],  # TODO: why is this optional
                                                                                                                                                                                                                      +) -> None:
                                                                                                                                                                                                                      +    """Handles an unhandled exception.
                                                                                                                                                                                                                      +
                                                                                                                                                                                                                      +    Args:
                                                                                                                                                                                                                      +        error: The raised exception.
                                                                                                                                                                                                                      +        request: The request.
                                                                                                                                                                                                                      +        response: The response.
                                                                                                                                                                                                                      +    """
                                                                                                                                                                                                                      +    raise NotImplementedError()
                                                                                                                                                                                                                      +

                                                                                                                                                                                                                      Handles an unhandled exception.

                                                                                                                                                                                                                      Args

                                                                                                                                                                                                                      @@ -203,7 +234,7 @@

                                                                                                                                                                                                                      -

                                                                                                                                                                                                                      Generated by pdoc 0.11.3.

                                                                                                                                                                                                                      +

                                                                                                                                                                                                                      Generated by pdoc 0.11.5.

                                                                                                                                                                                                                      diff --git a/docs/static/api-docs/slack_bolt/middleware/request_verification/async_request_verification.html b/docs/static/api-docs/slack_bolt/middleware/request_verification/async_request_verification.html index 88871be7..e5d368b8 100644 --- a/docs/static/api-docs/slack_bolt/middleware/request_verification/async_request_verification.html +++ b/docs/static/api-docs/slack_bolt/middleware/request_verification/async_request_verification.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.request_verification.async_request_verification API documentation - + @@ -40,19 +51,6 @@

                                                                                                                                                                                                                      Classes

                                                                                                                                                                                                                      (signing_secret: str, base_logger: logging.Logger | None = None)
                                                                                                                                                                                                                      -

                                                                                                                                                                                                                      Verifies an incoming request by checking the validity of -x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                                                                                                      -

                                                                                                                                                                                                                      Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                                                                                                      -

                                                                                                                                                                                                                      Verifies an incoming request by checking the validity of -x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                                                                                                      -

                                                                                                                                                                                                                      Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                                                                                                      -

                                                                                                                                                                                                                      Args

                                                                                                                                                                                                                      -
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                      signing_secret
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                      The signing secret
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                      base_logger
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                      The base logger
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                      Expand source code @@ -86,6 +84,19 @@

                                                                                                                                                                                                                      Args

                                                                                                                                                                                                                      self._debug_log_error(signature, timestamp, body) return self._build_error_response()
                                                                                                                                                                                                                      +

                                                                                                                                                                                                                      Verifies an incoming request by checking the validity of +x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                                                                                                      +

                                                                                                                                                                                                                      Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                                                                                                      +

                                                                                                                                                                                                                      Verifies an incoming request by checking the validity of +x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                                                                                                      +

                                                                                                                                                                                                                      Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                                                                                                      +

                                                                                                                                                                                                                      Args

                                                                                                                                                                                                                      +
                                                                                                                                                                                                                      +
                                                                                                                                                                                                                      signing_secret
                                                                                                                                                                                                                      +
                                                                                                                                                                                                                      The signing secret
                                                                                                                                                                                                                      +
                                                                                                                                                                                                                      base_logger
                                                                                                                                                                                                                      +
                                                                                                                                                                                                                      The base logger
                                                                                                                                                                                                                      +

                                                                                                                                                                                                                      Ancestors

                                                                                                                                                                                                                      • RequestVerification
                                                                                                                                                                                                                      • @@ -131,7 +142,7 @@

                                                                                                                                                                                                                        -

                                                                                                                                                                                                                        Generated by pdoc 0.11.3.

                                                                                                                                                                                                                        +

                                                                                                                                                                                                                        Generated by pdoc 0.11.5.

                                                                                                                                                                                                                        diff --git a/docs/static/api-docs/slack_bolt/middleware/request_verification/index.html b/docs/static/api-docs/slack_bolt/middleware/request_verification/index.html index f9521810..228076e0 100644 --- a/docs/static/api-docs/slack_bolt/middleware/request_verification/index.html +++ b/docs/static/api-docs/slack_bolt/middleware/request_verification/index.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.request_verification API documentation - + @@ -51,17 +62,6 @@

                                                                                                                                                                                                                        Classes

                                                                                                                                                                                                                        (signing_secret: str, base_logger: logging.Logger | None = None)
                                                                                                                                                                                                                        -

                                                                                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                        -

                                                                                                                                                                                                                        Verifies an incoming request by checking the validity of -x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                                                                                                        -

                                                                                                                                                                                                                        Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                                                                                                        -

                                                                                                                                                                                                                        Args

                                                                                                                                                                                                                        -
                                                                                                                                                                                                                        -
                                                                                                                                                                                                                        signing_secret
                                                                                                                                                                                                                        -
                                                                                                                                                                                                                        The signing secret
                                                                                                                                                                                                                        -
                                                                                                                                                                                                                        base_logger
                                                                                                                                                                                                                        -
                                                                                                                                                                                                                        The base logger
                                                                                                                                                                                                                        -
                                                                                                                                                                                                                        Expand source code @@ -117,6 +117,17 @@

                                                                                                                                                                                                                        Args

                                                                                                                                                                                                                        "Invalid request signature detected " f"(signature: {signature}, timestamp: {timestamp}, body: {body})" )
                                                                                                                                                                                                                        +

                                                                                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                        +

                                                                                                                                                                                                                        Verifies an incoming request by checking the validity of +x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                                                                                                        +

                                                                                                                                                                                                                        Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                                                                                                        +

                                                                                                                                                                                                                        Args

                                                                                                                                                                                                                        +
                                                                                                                                                                                                                        +
                                                                                                                                                                                                                        signing_secret
                                                                                                                                                                                                                        +
                                                                                                                                                                                                                        The signing secret
                                                                                                                                                                                                                        +
                                                                                                                                                                                                                        base_logger
                                                                                                                                                                                                                        +
                                                                                                                                                                                                                        The base logger
                                                                                                                                                                                                                        +

                                                                                                                                                                                                                        Ancestors

                                                                                                                                                                                                                        • Middleware
                                                                                                                                                                                                                        • @@ -165,7 +176,7 @@

                                                                                                                                                                                                                          -

                                                                                                                                                                                                                          Generated by pdoc 0.11.3.

                                                                                                                                                                                                                          +

                                                                                                                                                                                                                          Generated by pdoc 0.11.5.

                                                                                                                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/middleware/request_verification/request_verification.html b/docs/static/api-docs/slack_bolt/middleware/request_verification/request_verification.html index 691496c2..675aa4cd 100644 --- a/docs/static/api-docs/slack_bolt/middleware/request_verification/request_verification.html +++ b/docs/static/api-docs/slack_bolt/middleware/request_verification/request_verification.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.request_verification.request_verification API documentation - + @@ -40,17 +51,6 @@

                                                                                                                                                                                                                          Classes

                                                                                                                                                                                                                          (signing_secret: str, base_logger: logging.Logger | None = None)
                                                                                                                                                                                                                          -

                                                                                                                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                          -

                                                                                                                                                                                                                          Verifies an incoming request by checking the validity of -x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                                                                                                          -

                                                                                                                                                                                                                          Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                                                                                                          -

                                                                                                                                                                                                                          Args

                                                                                                                                                                                                                          -
                                                                                                                                                                                                                          -
                                                                                                                                                                                                                          signing_secret
                                                                                                                                                                                                                          -
                                                                                                                                                                                                                          The signing secret
                                                                                                                                                                                                                          -
                                                                                                                                                                                                                          base_logger
                                                                                                                                                                                                                          -
                                                                                                                                                                                                                          The base logger
                                                                                                                                                                                                                          -
                                                                                                                                                                                                                          Expand source code @@ -106,6 +106,17 @@

                                                                                                                                                                                                                          Args

                                                                                                                                                                                                                          "Invalid request signature detected " f"(signature: {signature}, timestamp: {timestamp}, body: {body})" )
                                                                                                                                                                                                                          +

                                                                                                                                                                                                                          A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                          +

                                                                                                                                                                                                                          Verifies an incoming request by checking the validity of +x-slack-signature, x-slack-request-timestamp, and its body data.

                                                                                                                                                                                                                          +

                                                                                                                                                                                                                          Refer to https://api.slack.com/authentication/verifying-requests-from-slack for details.

                                                                                                                                                                                                                          +

                                                                                                                                                                                                                          Args

                                                                                                                                                                                                                          +
                                                                                                                                                                                                                          +
                                                                                                                                                                                                                          signing_secret
                                                                                                                                                                                                                          +
                                                                                                                                                                                                                          The signing secret
                                                                                                                                                                                                                          +
                                                                                                                                                                                                                          base_logger
                                                                                                                                                                                                                          +
                                                                                                                                                                                                                          The base logger
                                                                                                                                                                                                                          +

                                                                                                                                                                                                                          Ancestors

                                                                                                                                                                                                                          • Middleware
                                                                                                                                                                                                                          • @@ -148,7 +159,7 @@

                                                                                                                                                                                                                            -

                                                                                                                                                                                                                            Generated by pdoc 0.11.3.

                                                                                                                                                                                                                            +

                                                                                                                                                                                                                            Generated by pdoc 0.11.5.

                                                                                                                                                                                                                            diff --git a/docs/static/api-docs/slack_bolt/middleware/ssl_check/async_ssl_check.html b/docs/static/api-docs/slack_bolt/middleware/ssl_check/async_ssl_check.html index 4fea5ac0..d19f77eb 100644 --- a/docs/static/api-docs/slack_bolt/middleware/ssl_check/async_ssl_check.html +++ b/docs/static/api-docs/slack_bolt/middleware/ssl_check/async_ssl_check.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.ssl_check.async_ssl_check API documentation - + @@ -40,17 +51,6 @@

                                                                                                                                                                                                                            Classes

                                                                                                                                                                                                                            (verification_token: str | None = None,
                                                                                                                                                                                                                            base_logger: logging.Logger | None = None)
                                                                                                                                                                                                                            -

                                                                                                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                            -

                                                                                                                                                                                                                            Handles ssl_check requests. -Refer to https://api.slack.com/interactivity/slash-commands for details.

                                                                                                                                                                                                                            -

                                                                                                                                                                                                                            Args

                                                                                                                                                                                                                            -
                                                                                                                                                                                                                            -
                                                                                                                                                                                                                            verification_token
                                                                                                                                                                                                                            -
                                                                                                                                                                                                                            The verification token to check -(optional as it's already deprecated - https://api.slack.com/authentication/verifying-requests-from-slack#verification_token_deprecation)
                                                                                                                                                                                                                            -
                                                                                                                                                                                                                            base_logger
                                                                                                                                                                                                                            -
                                                                                                                                                                                                                            The base logger
                                                                                                                                                                                                                            -
                                                                                                                                                                                                                            Expand source code @@ -73,6 +73,17 @@

                                                                                                                                                                                                                            Args

                                                                                                                                                                                                                            else: return await next()
                                                                                                                                                                                                                            +

                                                                                                                                                                                                                            A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                            +

                                                                                                                                                                                                                            Handles ssl_check requests. +Refer to https://api.slack.com/interactivity/slash-commands for details.

                                                                                                                                                                                                                            +

                                                                                                                                                                                                                            Args

                                                                                                                                                                                                                            +
                                                                                                                                                                                                                            +
                                                                                                                                                                                                                            verification_token
                                                                                                                                                                                                                            +
                                                                                                                                                                                                                            The verification token to check +(optional as it's already deprecated - https://api.slack.com/authentication/verifying-requests-from-slack#verification_token_deprecation)
                                                                                                                                                                                                                            +
                                                                                                                                                                                                                            base_logger
                                                                                                                                                                                                                            +
                                                                                                                                                                                                                            The base logger
                                                                                                                                                                                                                            +

                                                                                                                                                                                                                            Ancestors

                                                                                                                                                                                                                            • SslCheck
                                                                                                                                                                                                                            • @@ -83,8 +94,10 @@

                                                                                                                                                                                                                              Inherited members

                                                                                                                                                                                                                              • SslCheck:
                                                                                                                                                                                                                              • AsyncMiddleware: @@ -118,7 +131,7 @@

                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                Generated by pdoc 0.11.3.

                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                Generated by pdoc 0.11.5.

                                                                                                                                                                                                                                diff --git a/docs/static/api-docs/slack_bolt/middleware/ssl_check/index.html b/docs/static/api-docs/slack_bolt/middleware/ssl_check/index.html index b05f1c44..e2d67d33 100644 --- a/docs/static/api-docs/slack_bolt/middleware/ssl_check/index.html +++ b/docs/static/api-docs/slack_bolt/middleware/ssl_check/index.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.ssl_check API documentation - + @@ -51,17 +62,6 @@

                                                                                                                                                                                                                                Classes

                                                                                                                                                                                                                                (verification_token: str | None = None,
                                                                                                                                                                                                                                base_logger: logging.Logger | None = None)
                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                Handles slack_bolt.middleware.ssl_check.ssl_check requests. -Refer to https://api.slack.com/interactivity/slash-commands for details.

                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                Args

                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                verification_token
                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                The verification token to check -(optional as it's already deprecated - https://api.slack.com/authentication/verifying-requests-from-slack#verification_token_deprecation)
                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                base_logger
                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                The base logger
                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                Expand source code @@ -120,6 +120,17 @@

                                                                                                                                                                                                                                Args

                                                                                                                                                                                                                                def _build_error_response() -> BoltResponse: return BoltResponse(status=401, body={"error": "invalid verification token"})
                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                Handles slack_bolt.middleware.ssl_check.ssl_check requests. +Refer to https://api.slack.com/interactivity/slash-commands for details.

                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                Args

                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                verification_token
                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                The verification token to check +(optional as it's already deprecated - https://api.slack.com/authentication/verifying-requests-from-slack#verification_token_deprecation)
                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                base_logger
                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                The base logger
                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                Ancestors

                                                                                                                                                                                                                                • Middleware
                                                                                                                                                                                                                                • @@ -132,11 +143,11 @@

                                                                                                                                                                                                                                  Class variables

                                                                                                                                                                                                                                  var logger : logging.Logger
                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                  The type of the None singleton.

                                                                                                                                                                                                                                  var verification_token : str | None
                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                  The type of the None singleton.

                                                                                                                                                                                                                                  Inherited members

                                                                                                                                                                                                                                  @@ -183,7 +194,7 @@

                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                  Generated by pdoc 0.11.3.

                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                  Generated by pdoc 0.11.5.

                                                                                                                                                                                                                                  diff --git a/docs/static/api-docs/slack_bolt/middleware/ssl_check/ssl_check.html b/docs/static/api-docs/slack_bolt/middleware/ssl_check/ssl_check.html index f1a41e50..d8985697 100644 --- a/docs/static/api-docs/slack_bolt/middleware/ssl_check/ssl_check.html +++ b/docs/static/api-docs/slack_bolt/middleware/ssl_check/ssl_check.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.ssl_check.ssl_check API documentation - + @@ -40,17 +51,6 @@

                                                                                                                                                                                                                                  Classes

                                                                                                                                                                                                                                  (verification_token: str | None = None,
                                                                                                                                                                                                                                  base_logger: logging.Logger | None = None)
                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                  A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                  Handles ssl_check requests. -Refer to https://api.slack.com/interactivity/slash-commands for details.

                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                  Args

                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  verification_token
                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  The verification token to check -(optional as it's already deprecated - https://api.slack.com/authentication/verifying-requests-from-slack#verification_token_deprecation)
                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  base_logger
                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  The base logger
                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  Expand source code @@ -109,6 +109,17 @@

                                                                                                                                                                                                                                  Args

                                                                                                                                                                                                                                  def _build_error_response() -> BoltResponse: return BoltResponse(status=401, body={"error": "invalid verification token"})
                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                  A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                  Handles ssl_check requests. +Refer to https://api.slack.com/interactivity/slash-commands for details.

                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                  Args

                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                  verification_token
                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                  The verification token to check +(optional as it's already deprecated - https://api.slack.com/authentication/verifying-requests-from-slack#verification_token_deprecation)
                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                  base_logger
                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                  The base logger
                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                  Ancestors

                                                                                                                                                                                                                                  • Middleware
                                                                                                                                                                                                                                  • @@ -121,11 +132,11 @@

                                                                                                                                                                                                                                    Class variables

                                                                                                                                                                                                                                    var logger : logging.Logger
                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                    The type of the None singleton.

                                                                                                                                                                                                                                    var verification_token : str | None
                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                    The type of the None singleton.

                                                                                                                                                                                                                                    Inherited members

                                                                                                                                                                                                                                    @@ -166,7 +177,7 @@

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Generated by pdoc 0.11.3.

                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                    Generated by pdoc 0.11.5.

                                                                                                                                                                                                                                    diff --git a/docs/static/api-docs/slack_bolt/middleware/url_verification/async_url_verification.html b/docs/static/api-docs/slack_bolt/middleware/url_verification/async_url_verification.html index 2ae16379..44bcaee1 100644 --- a/docs/static/api-docs/slack_bolt/middleware/url_verification/async_url_verification.html +++ b/docs/static/api-docs/slack_bolt/middleware/url_verification/async_url_verification.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.url_verification.async_url_verification API documentation - + @@ -40,14 +51,6 @@

                                                                                                                                                                                                                                    Classes

                                                                                                                                                                                                                                    (base_logger: logging.Logger | None = None)
                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Handles url_verification requests.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Refer to https://api.slack.com/events/url_verification for details.

                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                    Args

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    base_logger
                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    The base logger
                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    Expand source code @@ -68,6 +71,14 @@

                                                                                                                                                                                                                                    Args

                                                                                                                                                                                                                                    else: return await next()
                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                    A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                    Handles url_verification requests.

                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                    Refer to https://api.slack.com/events/url_verification for details.

                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                    Args

                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                    base_logger
                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                    The base logger
                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                    Ancestors

                                                                                                                                                                                                                                    • UrlVerification
                                                                                                                                                                                                                                    • @@ -113,7 +124,7 @@

                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                      Generated by pdoc 0.11.3.

                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                      Generated by pdoc 0.11.5.

                                                                                                                                                                                                                                      diff --git a/docs/static/api-docs/slack_bolt/middleware/url_verification/index.html b/docs/static/api-docs/slack_bolt/middleware/url_verification/index.html index 0439abdd..ff0720cf 100644 --- a/docs/static/api-docs/slack_bolt/middleware/url_verification/index.html +++ b/docs/static/api-docs/slack_bolt/middleware/url_verification/index.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.url_verification API documentation - + @@ -51,14 +62,6 @@

                                                                                                                                                                                                                                      Classes

                                                                                                                                                                                                                                      (base_logger: logging.Logger | None = None)
                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                      A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                      Handles url_verification requests.

                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                      Refer to https://api.slack.com/events/url_verification for details.

                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                      Args

                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                      base_logger
                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                      The base logger
                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                      Expand source code @@ -99,6 +102,14 @@

                                                                                                                                                                                                                                      Args

                                                                                                                                                                                                                                      def _build_success_response(body: dict) -> BoltResponse: return BoltResponse(status=200, body={"challenge": body.get("challenge")})
                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                      A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                      Handles url_verification requests.

                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                      Refer to https://api.slack.com/events/url_verification for details.

                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                      Args

                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                      base_logger
                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                      The base logger
                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                      Ancestors

                                                                                                                                                                                                                                      • Middleware
                                                                                                                                                                                                                                      • @@ -147,7 +158,7 @@

                                                                                                                                                                                                                                        diff --git a/docs/static/api-docs/slack_bolt/middleware/url_verification/url_verification.html b/docs/static/api-docs/slack_bolt/middleware/url_verification/url_verification.html index 48673a3d..04ad520e 100644 --- a/docs/static/api-docs/slack_bolt/middleware/url_verification/url_verification.html +++ b/docs/static/api-docs/slack_bolt/middleware/url_verification/url_verification.html @@ -3,19 +3,30 @@ - + slack_bolt.middleware.url_verification.url_verification API documentation - + @@ -40,14 +51,6 @@

                                                                                                                                                                                                                                        Classes

                                                                                                                                                                                                                                        (base_logger: logging.Logger | None = None)
                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                        Handles url_verification requests.

                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                        Refer to https://api.slack.com/events/url_verification for details.

                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                        Args

                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                        base_logger
                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                        The base logger
                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                        Expand source code @@ -88,6 +91,14 @@

                                                                                                                                                                                                                                        Args

                                                                                                                                                                                                                                        def _build_success_response(body: dict) -> BoltResponse: return BoltResponse(status=200, body={"challenge": body.get("challenge")})
                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                        A middleware can process request data before other middleware and listener functions.

                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                        Handles url_verification requests.

                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                        Refer to https://api.slack.com/events/url_verification for details.

                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                        Args

                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                        base_logger
                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                        The base logger
                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                        Ancestors

                                                                                                                                                                                                                                        • Middleware
                                                                                                                                                                                                                                        • @@ -130,7 +141,7 @@

                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                          Generated by pdoc 0.11.3.

                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                          Generated by pdoc 0.11.5.

                                                                                                                                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/oauth/async_callback_options.html b/docs/static/api-docs/slack_bolt/oauth/async_callback_options.html index e7819835..40ae06c1 100644 --- a/docs/static/api-docs/slack_bolt/oauth/async_callback_options.html +++ b/docs/static/api-docs/slack_bolt/oauth/async_callback_options.html @@ -3,19 +3,30 @@ - + slack_bolt.oauth.async_callback_options API documentation - + @@ -40,7 +51,6 @@

                                                                                                                                                                                                                                          Classes

                                                                                                                                                                                                                                          (success: Callable[[AsyncSuccessArgs], Awaitable[BoltResponse]],
                                                                                                                                                                                                                                          failure: Callable[[AsyncFailureArgs], Awaitable[BoltResponse]])
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          Expand source code @@ -57,6 +67,7 @@

                                                                                                                                                                                                                                          Classes

                                                                                                                                                                                                                                          self.success = success self.failure = failure
                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                          Subclasses

                                                                                                                                                                                                                                          @@ -78,22 +89,6 @@

                                                                                                                                                                                                                                          Class variables

                                                                                                                                                                                                                                          (*,
                                                                                                                                                                                                                                          request: AsyncBoltRequest,
                                                                                                                                                                                                                                          reason: str,
                                                                                                                                                                                                                                          error: Exception | None = None,
                                                                                                                                                                                                                                          suggested_status_code: int,
                                                                                                                                                                                                                                          settings: AsyncOAuthSettings,
                                                                                                                                                                                                                                          default: AsyncCallbackOptions)
                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                          The arguments for a failure function.

                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                          Args

                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          request
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          The request.
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          reason
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          The response.
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          error
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          An exception if exists.
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          suggested_status_code
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          The recommended HTTP status code for the failure.
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          settings
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          The settings for Slack OAuth flow.
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          default
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          The default AsyncCallbackOptions.
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          Expand source code @@ -126,24 +121,28 @@

                                                                                                                                                                                                                                          Args

                                                                                                                                                                                                                                          self.settings = settings self.default = default
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -class AsyncSuccessArgs -(*,
                                                                                                                                                                                                                                          request: AsyncBoltRequest,
                                                                                                                                                                                                                                          installation: slack_sdk.oauth.installation_store.models.installation.Installation,
                                                                                                                                                                                                                                          settings: AsyncOAuthSettings,
                                                                                                                                                                                                                                          default: AsyncCallbackOptions)
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                          The arguments for a success function.

                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                          The arguments for a failure function.

                                                                                                                                                                                                                                          Args

                                                                                                                                                                                                                                          request
                                                                                                                                                                                                                                          The request.
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          installation
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          The installation data.
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          reason
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          The response.
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          error
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          An exception if exists.
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          suggested_status_code
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          The recommended HTTP status code for the failure.
                                                                                                                                                                                                                                          settings
                                                                                                                                                                                                                                          The settings for Slack OAuth flow.
                                                                                                                                                                                                                                          default
                                                                                                                                                                                                                                          The default AsyncCallbackOptions.
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          +class AsyncSuccessArgs +(*,
                                                                                                                                                                                                                                          request: AsyncBoltRequest,
                                                                                                                                                                                                                                          installation: slack_sdk.oauth.installation_store.models.installation.Installation,
                                                                                                                                                                                                                                          settings: AsyncOAuthSettings,
                                                                                                                                                                                                                                          default: AsyncCallbackOptions)
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          Expand source code @@ -170,13 +169,24 @@

                                                                                                                                                                                                                                          Args

                                                                                                                                                                                                                                          self.settings = settings self.default = default
                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                          The arguments for a success function.

                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                          Args

                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          request
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          The request.
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          installation
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          The installation data.
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          settings
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          The settings for Slack OAuth flow.
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          default
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          The default AsyncCallbackOptions.
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                          class DefaultAsyncCallbackOptions (*,
                                                                                                                                                                                                                                          logger: logging.Logger,
                                                                                                                                                                                                                                          state_utils: slack_sdk.oauth.state_utils.OAuthStateUtils,
                                                                                                                                                                                                                                          redirect_uri_page_renderer: slack_sdk.oauth.redirect_uri_page_renderer.RedirectUriPageRenderer)
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          Expand source code @@ -217,21 +227,20 @@

                                                                                                                                                                                                                                          Args

                                                                                                                                                                                                                                          status=args.suggested_status_code, )
                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                          Ancestors

                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                          Class variables

                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          var failure : Callable[[AsyncFailureArgs], Awaitable[BoltResponse]]
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          var success : Callable[[AsyncSuccessArgs], Awaitable[BoltResponse]]
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                          Inherited members

                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                      @@ -263,10 +272,6 @@

                                                                                                                                                                                                                    • DefaultAsyncCallbackOptions

                                                                                                                                                                                                                      -
                                                                                                                                                                                                                    @@ -274,7 +279,7 @@

                                                                                                                                                                                                                    -

                                                                                                                                                                                                                    Generated by pdoc 0.11.3.

                                                                                                                                                                                                                    +

                                                                                                                                                                                                                    Generated by pdoc 0.11.5.

                                                                                                                                                                                                                    diff --git a/docs/static/api-docs/slack_bolt/oauth/async_internals.html b/docs/static/api-docs/slack_bolt/oauth/async_internals.html index 598e3b30..ba6a3164 100644 --- a/docs/static/api-docs/slack_bolt/oauth/async_internals.html +++ b/docs/static/api-docs/slack_bolt/oauth/async_internals.html @@ -3,19 +3,30 @@ - + slack_bolt.oauth.async_internals API documentation - + @@ -37,12 +48,51 @@

                                                                                                                                                                                                                    Functions

                                                                                                                                                                                                                    def get_or_create_default_installation_store(client_id: str) ‑> slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore
                                                                                                                                                                                                                    +
                                                                                                                                                                                                                    + +Expand source code + +
                                                                                                                                                                                                                    def get_or_create_default_installation_store(client_id: str) -> AsyncInstallationStore:
                                                                                                                                                                                                                    +    store = default_installation_stores.get(client_id)
                                                                                                                                                                                                                    +    if store is None:
                                                                                                                                                                                                                    +        store = FileInstallationStore(client_id=client_id)
                                                                                                                                                                                                                    +        default_installation_stores[client_id] = store
                                                                                                                                                                                                                    +    return store
                                                                                                                                                                                                                    +
                                                                                                                                                                                                                    def select_consistent_installation_store(client_id: str,
                                                                                                                                                                                                                    app_store: slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore | None,
                                                                                                                                                                                                                    oauth_flow_store: slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore | None,
                                                                                                                                                                                                                    logger: logging.Logger) ‑> slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore | None
                                                                                                                                                                                                                    +
                                                                                                                                                                                                                    + +Expand source code + +
                                                                                                                                                                                                                    def select_consistent_installation_store(
                                                                                                                                                                                                                    +    client_id: str,
                                                                                                                                                                                                                    +    app_store: Optional[AsyncInstallationStore],
                                                                                                                                                                                                                    +    oauth_flow_store: Optional[AsyncInstallationStore],
                                                                                                                                                                                                                    +    logger: Logger,
                                                                                                                                                                                                                    +) -> Optional[AsyncInstallationStore]:
                                                                                                                                                                                                                    +    default = get_or_create_default_installation_store(client_id)
                                                                                                                                                                                                                    +    if app_store is not None:
                                                                                                                                                                                                                    +        if oauth_flow_store is not None:
                                                                                                                                                                                                                    +            if oauth_flow_store is default:
                                                                                                                                                                                                                    +                # only app_store is intentionally set in this case
                                                                                                                                                                                                                    +                return app_store
                                                                                                                                                                                                                    +
                                                                                                                                                                                                                    +            # if both are intentionally set, prioritize app_store
                                                                                                                                                                                                                    +            if oauth_flow_store is not app_store:
                                                                                                                                                                                                                    +                logger.warning(warning_installation_store_conflicts())
                                                                                                                                                                                                                    +            return oauth_flow_store
                                                                                                                                                                                                                    +        else:
                                                                                                                                                                                                                    +            # only app_store is available
                                                                                                                                                                                                                    +            return app_store
                                                                                                                                                                                                                    +    else:
                                                                                                                                                                                                                    +        # only oauth_flow_store is available
                                                                                                                                                                                                                    +        return oauth_flow_store
                                                                                                                                                                                                                    +

                                                                                                                                                    @@ -70,7 +120,7 @@

                                                                                                                                                    Functions

                                                                                                                                                    diff --git a/docs/static/api-docs/slack_bolt/oauth/async_oauth_flow.html b/docs/static/api-docs/slack_bolt/oauth/async_oauth_flow.html index 6f8153f3..182973db 100644 --- a/docs/static/api-docs/slack_bolt/oauth/async_oauth_flow.html +++ b/docs/static/api-docs/slack_bolt/oauth/async_oauth_flow.html @@ -3,19 +3,30 @@ - + slack_bolt.oauth.async_oauth_flow API documentation - + @@ -40,16 +51,6 @@

                                                                                                                                                    Classes

                                                                                                                                                    (*,
                                                                                                                                                    client: slack_sdk.web.async_client.AsyncWebClient | None = None,
                                                                                                                                                    logger: logging.Logger | None = None,
                                                                                                                                                    settings: AsyncOAuthSettings)
                                                                                                                                                    -

                                                                                                                                                    The module to run the Slack app installation flow (OAuth flow).

                                                                                                                                                    -

                                                                                                                                                    Args

                                                                                                                                                    -
                                                                                                                                                    -
                                                                                                                                                    client
                                                                                                                                                    -
                                                                                                                                                    The slack_sdk.web.async_client.AsyncWebClient instance.
                                                                                                                                                    -
                                                                                                                                                    logger
                                                                                                                                                    -
                                                                                                                                                    The logger.
                                                                                                                                                    -
                                                                                                                                                    settings
                                                                                                                                                    -
                                                                                                                                                    OAuth settings to configure this module.
                                                                                                                                                    -
                                                                                                                                                    Expand source code @@ -397,35 +398,45 @@

                                                                                                                                                    Args

                                                                                                                                                    # may raise BoltError await self.settings.installation_store.async_save(installation)
                                                                                                                                                    +

                                                                                                                                                    The module to run the Slack app installation flow (OAuth flow).

                                                                                                                                                    +

                                                                                                                                                    Args

                                                                                                                                                    +
                                                                                                                                                    +
                                                                                                                                                    client
                                                                                                                                                    +
                                                                                                                                                    The slack_sdk.web.async_client.AsyncWebClient instance.
                                                                                                                                                    +
                                                                                                                                                    logger
                                                                                                                                                    +
                                                                                                                                                    The logger.
                                                                                                                                                    +
                                                                                                                                                    settings
                                                                                                                                                    +
                                                                                                                                                    OAuth settings to configure this module.
                                                                                                                                                    +

                                                                                                                                                    Class variables

                                                                                                                                                    var client_id : str
                                                                                                                                                    -
                                                                                                                                                    +

                                                                                                                                                    The type of the None singleton.

                                                                                                                                                    var failure_handler : Callable[[AsyncFailureArgs], Awaitable[BoltResponse]]
                                                                                                                                                    -
                                                                                                                                                    +

                                                                                                                                                    The type of the None singleton.

                                                                                                                                                    var install_path : str
                                                                                                                                                    -
                                                                                                                                                    +

                                                                                                                                                    The type of the None singleton.

                                                                                                                                                    var redirect_uri : str | None
                                                                                                                                                    -
                                                                                                                                                    +

                                                                                                                                                    The type of the None singleton.

                                                                                                                                                    var redirect_uri_path : str
                                                                                                                                                    -
                                                                                                                                                    +

                                                                                                                                                    The type of the None singleton.

                                                                                                                                                    var settingsAsyncOAuthSettings
                                                                                                                                                    -
                                                                                                                                                    +

                                                                                                                                                    The type of the None singleton.

                                                                                                                                                    var success_handler : Callable[[AsyncSuccessArgs], Awaitable[BoltResponse]]
                                                                                                                                                    -
                                                                                                                                                    +

                                                                                                                                                    The type of the None singleton.

                                                                                                                                                    Static methods

                                                                                                                                                    @@ -441,7 +452,6 @@

                                                                                                                                                    Instance variables

                                                                                                                                                    prop client : slack_sdk.web.async_client.AsyncWebClient
                                                                                                                                                    -
                                                                                                                                                    Expand source code @@ -452,10 +462,10 @@

                                                                                                                                                    Instance variables

                                                                                                                                                    self._async_client = create_async_web_client(logger=self.logger) return self._async_client
                                                                                                                                                    +
                                                                                                                                                    prop logger : logging.Logger
                                                                                                                                                    -
                                                                                                                                                    Expand source code @@ -466,6 +476,7 @@

                                                                                                                                                    Instance variables

                                                                                                                                                    self._logger = logging.getLogger(__name__) return self._logger
                                                                                                                                                    +

                                                                                                                                                    Methods

                                                                                                                                                    @@ -474,48 +485,276 @@

                                                                                                                                                    Methods

                                                                                                                                                    async def append_set_cookie_headers(self, headers: dict, set_cookie_value: str | None)
                                                                                                                                                    +
                                                                                                                                                    + +Expand source code + +
                                                                                                                                                    async def append_set_cookie_headers(self, headers: dict, set_cookie_value: Optional[str]):
                                                                                                                                                    +    if set_cookie_value is not None:
                                                                                                                                                    +        headers["Set-Cookie"] = [set_cookie_value]
                                                                                                                                                    +    return headers
                                                                                                                                                    +
                                                                                                                                                    async def build_authorize_url(self,
                                                                                                                                                    state: str,
                                                                                                                                                    request: AsyncBoltRequest) ‑> str
                                                                                                                                                    +
                                                                                                                                                    + +Expand source code + +
                                                                                                                                                    async def build_authorize_url(self, state: str, request: AsyncBoltRequest) -> str:
                                                                                                                                                    +    team_ids: Optional[Sequence[str]] = request.query.get("team")
                                                                                                                                                    +    return self.settings.authorize_url_generator.generate(
                                                                                                                                                    +        state=state,
                                                                                                                                                    +        team=team_ids[0] if team_ids is not None else None,
                                                                                                                                                    +    )
                                                                                                                                                    +
                                                                                                                                                    async def build_install_page_html(self,
                                                                                                                                                    url: str,
                                                                                                                                                    request: AsyncBoltRequest) ‑> str
                                                                                                                                                    +
                                                                                                                                                    + +Expand source code + +
                                                                                                                                                    async def build_install_page_html(self, url: str, request: AsyncBoltRequest) -> str:
                                                                                                                                                    +    return _build_default_install_page_html(url)
                                                                                                                                                    +
                                                                                                                                                    async def handle_callback(self,
                                                                                                                                                    request: AsyncBoltRequest) ‑> BoltResponse
                                                                                                                                                    +
                                                                                                                                                    + +Expand source code + +
                                                                                                                                                    async def handle_callback(self, request: AsyncBoltRequest) -> BoltResponse:
                                                                                                                                                    +
                                                                                                                                                    +    # failure due to end-user's cancellation or invalid redirection to slack.com
                                                                                                                                                    +    error = request.query.get("error", [None])[0]
                                                                                                                                                    +    if error is not None:
                                                                                                                                                    +        return await self.failure_handler(
                                                                                                                                                    +            AsyncFailureArgs(
                                                                                                                                                    +                request=request,
                                                                                                                                                    +                reason=error,
                                                                                                                                                    +                suggested_status_code=200,
                                                                                                                                                    +                settings=self.settings,
                                                                                                                                                    +                default=self.default_callback_options,
                                                                                                                                                    +            )
                                                                                                                                                    +        )
                                                                                                                                                    +
                                                                                                                                                    +    # state parameter verification
                                                                                                                                                    +    if self.settings.state_validation_enabled is True:
                                                                                                                                                    +        state: Optional[str] = request.query.get("state", [None])[0]
                                                                                                                                                    +        if not self.settings.state_utils.is_valid_browser(state, request.headers):
                                                                                                                                                    +            return await self.failure_handler(
                                                                                                                                                    +                AsyncFailureArgs(
                                                                                                                                                    +                    request=request,
                                                                                                                                                    +                    reason="invalid_browser",
                                                                                                                                                    +                    suggested_status_code=400,
                                                                                                                                                    +                    settings=self.settings,
                                                                                                                                                    +                    default=self.default_callback_options,
                                                                                                                                                    +                )
                                                                                                                                                    +            )
                                                                                                                                                    +
                                                                                                                                                    +        valid_state_consumed = await self.settings.state_store.async_consume(state)  # type: ignore[arg-type]
                                                                                                                                                    +        if not valid_state_consumed:
                                                                                                                                                    +            return await self.failure_handler(
                                                                                                                                                    +                AsyncFailureArgs(
                                                                                                                                                    +                    request=request,
                                                                                                                                                    +                    reason="invalid_state",
                                                                                                                                                    +                    suggested_status_code=401,
                                                                                                                                                    +                    settings=self.settings,
                                                                                                                                                    +                    default=self.default_callback_options,
                                                                                                                                                    +                )
                                                                                                                                                    +            )
                                                                                                                                                    +
                                                                                                                                                    +    # run installation
                                                                                                                                                    +    code = request.query.get("code", [None])[0]
                                                                                                                                                    +    if code is None:
                                                                                                                                                    +        return await self.failure_handler(
                                                                                                                                                    +            AsyncFailureArgs(
                                                                                                                                                    +                request=request,
                                                                                                                                                    +                reason="missing_code",
                                                                                                                                                    +                suggested_status_code=401,
                                                                                                                                                    +                settings=self.settings,
                                                                                                                                                    +                default=self.default_callback_options,
                                                                                                                                                    +            )
                                                                                                                                                    +        )
                                                                                                                                                    +
                                                                                                                                                    +    installation = await self.run_installation(code)
                                                                                                                                                    +    if installation is None:
                                                                                                                                                    +        # failed to run installation with the code
                                                                                                                                                    +        return await self.failure_handler(
                                                                                                                                                    +            AsyncFailureArgs(
                                                                                                                                                    +                request=request,
                                                                                                                                                    +                reason="invalid_code",
                                                                                                                                                    +                suggested_status_code=401,
                                                                                                                                                    +                settings=self.settings,
                                                                                                                                                    +                default=self.default_callback_options,
                                                                                                                                                    +            )
                                                                                                                                                    +        )
                                                                                                                                                    +
                                                                                                                                                    +    # persist the installation
                                                                                                                                                    +    try:
                                                                                                                                                    +        await self.store_installation(request, installation)
                                                                                                                                                    +    except BoltError as err:
                                                                                                                                                    +        return await self.failure_handler(
                                                                                                                                                    +            AsyncFailureArgs(
                                                                                                                                                    +                request=request,
                                                                                                                                                    +                reason="storage_error",
                                                                                                                                                    +                error=err,
                                                                                                                                                    +                suggested_status_code=500,
                                                                                                                                                    +                settings=self.settings,
                                                                                                                                                    +                default=self.default_callback_options,
                                                                                                                                                    +            )
                                                                                                                                                    +        )
                                                                                                                                                    +
                                                                                                                                                    +    # display a successful completion page to the end-user
                                                                                                                                                    +    return await self.success_handler(
                                                                                                                                                    +        AsyncSuccessArgs(
                                                                                                                                                    +            request=request,
                                                                                                                                                    +            installation=installation,
                                                                                                                                                    +            settings=self.settings,
                                                                                                                                                    +            default=self.default_callback_options,
                                                                                                                                                    +        )
                                                                                                                                                    +    )
                                                                                                                                                    +
                                                                                                                                                    async def handle_installation(self,
                                                                                                                                                    request: AsyncBoltRequest) ‑> BoltResponse
                                                                                                                                                    +
                                                                                                                                                    + +Expand source code + +
                                                                                                                                                    async def handle_installation(self, request: AsyncBoltRequest) -> BoltResponse:
                                                                                                                                                    +    set_cookie_value: Optional[str] = None
                                                                                                                                                    +    url = await self.build_authorize_url("", request)
                                                                                                                                                    +    if self.settings.state_validation_enabled is True:
                                                                                                                                                    +        state = await self.issue_new_state(request)
                                                                                                                                                    +        url = await self.build_authorize_url(state, request)
                                                                                                                                                    +        set_cookie_value = self.settings.state_utils.build_set_cookie_for_new_state(state)
                                                                                                                                                    +    if self.settings.install_page_rendering_enabled:
                                                                                                                                                    +        html = await self.build_install_page_html(url, request)
                                                                                                                                                    +        return BoltResponse(
                                                                                                                                                    +            status=200,
                                                                                                                                                    +            body=html,
                                                                                                                                                    +            headers=await self.append_set_cookie_headers(
                                                                                                                                                    +                {"Content-Type": "text/html; charset=utf-8"},
                                                                                                                                                    +                set_cookie_value,
                                                                                                                                                    +            ),
                                                                                                                                                    +        )
                                                                                                                                                    +    else:
                                                                                                                                                    +        return BoltResponse(
                                                                                                                                                    +            status=302,
                                                                                                                                                    +            body="",
                                                                                                                                                    +            headers=await self.append_set_cookie_headers(
                                                                                                                                                    +                {"Content-Type": "text/html; charset=utf-8", "Location": url},
                                                                                                                                                    +                set_cookie_value,
                                                                                                                                                    +            ),
                                                                                                                                                    +        )
                                                                                                                                                    +
                                                                                                                                                    async def issue_new_state(self,
                                                                                                                                                    request: AsyncBoltRequest) ‑> str
                                                                                                                                                    +
                                                                                                                                                    + +Expand source code + +
                                                                                                                                                    async def issue_new_state(self, request: AsyncBoltRequest) -> str:
                                                                                                                                                    +    return await self.settings.state_store.async_issue()
                                                                                                                                                    +
                                                                                                                                                    async def run_installation(self, code: str) ‑> slack_sdk.oauth.installation_store.models.installation.Installation | None
                                                                                                                                                    +
                                                                                                                                                    + +Expand source code + +
                                                                                                                                                    async def run_installation(self, code: str) -> Optional[Installation]:
                                                                                                                                                    +    try:
                                                                                                                                                    +        oauth_response: AsyncSlackResponse = await self.client.oauth_v2_access(
                                                                                                                                                    +            code=code,
                                                                                                                                                    +            client_id=self.settings.client_id,
                                                                                                                                                    +            client_secret=self.settings.client_secret,
                                                                                                                                                    +            redirect_uri=self.settings.redirect_uri,  # can be None
                                                                                                                                                    +        )
                                                                                                                                                    +        installed_enterprise: Dict[str, str] = oauth_response.get("enterprise") or {}
                                                                                                                                                    +        is_enterprise_install: bool = oauth_response.get("is_enterprise_install") or False
                                                                                                                                                    +        installed_team: Dict[str, str] = oauth_response.get("team") or {}
                                                                                                                                                    +        installer: Dict[str, str] = oauth_response.get("authed_user") or {}
                                                                                                                                                    +        incoming_webhook: Dict[str, str] = oauth_response.get("incoming_webhook") or {}
                                                                                                                                                    +
                                                                                                                                                    +        bot_token: Optional[str] = oauth_response.get("access_token")
                                                                                                                                                    +        # NOTE: oauth.v2.access doesn't include bot_id in response
                                                                                                                                                    +        bot_id: Optional[str] = None
                                                                                                                                                    +        enterprise_url: Optional[str] = None
                                                                                                                                                    +        if bot_token is not None:
                                                                                                                                                    +            auth_test = await self.client.auth_test(token=bot_token)
                                                                                                                                                    +            bot_id = auth_test["bot_id"]
                                                                                                                                                    +        if is_enterprise_install is True:
                                                                                                                                                    +            enterprise_url = auth_test.get("url")
                                                                                                                                                    +
                                                                                                                                                    +        return Installation(
                                                                                                                                                    +            app_id=oauth_response.get("app_id"),
                                                                                                                                                    +            enterprise_id=installed_enterprise.get("id"),
                                                                                                                                                    +            enterprise_name=installed_enterprise.get("name"),
                                                                                                                                                    +            enterprise_url=enterprise_url,
                                                                                                                                                    +            team_id=installed_team.get("id"),
                                                                                                                                                    +            team_name=installed_team.get("name"),
                                                                                                                                                    +            bot_token=bot_token,
                                                                                                                                                    +            bot_id=bot_id,
                                                                                                                                                    +            bot_user_id=oauth_response.get("bot_user_id"),
                                                                                                                                                    +            bot_scopes=oauth_response.get("scope"),  # type: ignore[arg-type] # comma-separated string
                                                                                                                                                    +            bot_refresh_token=oauth_response.get("refresh_token"),  # since v1.7
                                                                                                                                                    +            bot_token_expires_in=oauth_response.get("expires_in"),  # since v1.7
                                                                                                                                                    +            user_id=installer.get("id"),  # type: ignore[arg-type]
                                                                                                                                                    +            user_token=installer.get("access_token"),
                                                                                                                                                    +            user_scopes=installer.get("scope"),  # type: ignore[arg-type]# comma-separated string
                                                                                                                                                    +            user_refresh_token=installer.get("refresh_token"),  # since v1.7
                                                                                                                                                    +            user_token_expires_in=installer.get("expires_in"),  # type: ignore[arg-type] # since v1.7
                                                                                                                                                    +            incoming_webhook_url=incoming_webhook.get("url"),
                                                                                                                                                    +            incoming_webhook_channel=incoming_webhook.get("channel"),
                                                                                                                                                    +            incoming_webhook_channel_id=incoming_webhook.get("channel_id"),
                                                                                                                                                    +            incoming_webhook_configuration_url=incoming_webhook.get("configuration_url"),
                                                                                                                                                    +            is_enterprise_install=is_enterprise_install,
                                                                                                                                                    +            token_type=oauth_response.get("token_type"),
                                                                                                                                                    +        )
                                                                                                                                                    +
                                                                                                                                                    +    except SlackApiError as e:
                                                                                                                                                    +        message = f"Failed to fetch oauth.v2.access result with code: {code} - error: {e}"
                                                                                                                                                    +        self.logger.warning(message)
                                                                                                                                                    +        return None
                                                                                                                                                    +
                                                                                                                                                    async def store_installation(self,
                                                                                                                                                    request: AsyncBoltRequest,
                                                                                                                                                    installation: slack_sdk.oauth.installation_store.models.installation.Installation)
                                                                                                                                                    +
                                                                                                                                                    + +Expand source code + +
                                                                                                                                                    async def store_installation(self, request: AsyncBoltRequest, installation: Installation):
                                                                                                                                                    +    # may raise BoltError
                                                                                                                                                    +    await self.settings.installation_store.async_save(installation)
                                                                                                                                                    +

                                                                                                                          @@ -564,7 +803,7 @@

                                                                                                                          -

                                                                                                                          Generated by pdoc 0.11.3.

                                                                                                                          +

                                                                                                                          Generated by pdoc 0.11.5.

                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/oauth/async_oauth_settings.html b/docs/static/api-docs/slack_bolt/oauth/async_oauth_settings.html index d9f4b6d0..18b10849 100644 --- a/docs/static/api-docs/slack_bolt/oauth/async_oauth_settings.html +++ b/docs/static/api-docs/slack_bolt/oauth/async_oauth_settings.html @@ -3,19 +3,30 @@ - + slack_bolt.oauth.async_oauth_settings API documentation - + @@ -40,56 +51,6 @@

                                                                                                                          Classes

                                                                                                                          (*,
                                                                                                                          client_id: str | None = None,
                                                                                                                          client_secret: str | None = None,
                                                                                                                          scopes: str | Sequence[str] | None = None,
                                                                                                                          user_scopes: str | Sequence[str] | None = None,
                                                                                                                          redirect_uri: str | None = None,
                                                                                                                          install_path: str = '/slack/install',
                                                                                                                          install_page_rendering_enabled: bool = True,
                                                                                                                          redirect_uri_path: str = '/slack/oauth_redirect',
                                                                                                                          callback_options: AsyncCallbackOptions | None = None,
                                                                                                                          success_url: str | None = None,
                                                                                                                          failure_url: str | None = None,
                                                                                                                          authorization_url: str | None = None,
                                                                                                                          installation_store: slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore | None = None,
                                                                                                                          installation_store_bot_only: bool = False,
                                                                                                                          token_rotation_expiration_minutes: int = 120,
                                                                                                                          user_token_resolution: str = 'authed_user',
                                                                                                                          state_validation_enabled: bool = True,
                                                                                                                          state_store: slack_sdk.oauth.state_store.async_state_store.AsyncOAuthStateStore | None = None,
                                                                                                                          state_cookie_name: str = 'slack-app-oauth-state',
                                                                                                                          state_expiration_seconds: int = 600,
                                                                                                                          logger: logging.Logger = <Logger slack_bolt.oauth.async_oauth_settings (WARNING)>)
                                                                                                                          -

                                                                                                                          The settings for Slack App installation (OAuth flow).

                                                                                                                          -

                                                                                                                          Args

                                                                                                                          -
                                                                                                                          -
                                                                                                                          client_id
                                                                                                                          -
                                                                                                                          Check the value in Settings > Basic Information > App Credentials
                                                                                                                          -
                                                                                                                          client_secret
                                                                                                                          -
                                                                                                                          Check the value in Settings > Basic Information > App Credentials
                                                                                                                          -
                                                                                                                          scopes
                                                                                                                          -
                                                                                                                          Check the value in Settings > Manage Distribution
                                                                                                                          -
                                                                                                                          user_scopes
                                                                                                                          -
                                                                                                                          Check the value in Settings > Manage Distribution
                                                                                                                          -
                                                                                                                          redirect_uri
                                                                                                                          -
                                                                                                                          Check the value in Features > OAuth & Permissions > Redirect URLs
                                                                                                                          -
                                                                                                                          install_path
                                                                                                                          -
                                                                                                                          The endpoint to start an OAuth flow (Default: /slack/install)
                                                                                                                          -
                                                                                                                          install_page_rendering_enabled
                                                                                                                          -
                                                                                                                          Renders a web page for install_path access if True
                                                                                                                          -
                                                                                                                          redirect_uri_path
                                                                                                                          -
                                                                                                                          The path of Redirect URL (Default: /slack/oauth_redirect)
                                                                                                                          -
                                                                                                                          callback_options
                                                                                                                          -
                                                                                                                          Give success/failure functions f you want to customize callback functions.
                                                                                                                          -
                                                                                                                          success_url
                                                                                                                          -
                                                                                                                          Set a complete URL if you want to redirect end-users when an installation completes.
                                                                                                                          -
                                                                                                                          failure_url
                                                                                                                          -
                                                                                                                          Set a complete URL if you want to redirect end-users when an installation fails.
                                                                                                                          -
                                                                                                                          authorization_url
                                                                                                                          -
                                                                                                                          Set a URL if you want to customize the URL https://slack.com/oauth/v2/authorize
                                                                                                                          -
                                                                                                                          installation_store
                                                                                                                          -
                                                                                                                          Specify the instance of InstallationStore (Default: FileInstallationStore)
                                                                                                                          -
                                                                                                                          installation_store_bot_only
                                                                                                                          -
                                                                                                                          Use InstallationStore#find_bot() if True (Default: False)
                                                                                                                          -
                                                                                                                          token_rotation_expiration_minutes
                                                                                                                          -
                                                                                                                          Minutes before refreshing tokens (Default: 2 hours)
                                                                                                                          -
                                                                                                                          user_token_resolution
                                                                                                                          -
                                                                                                                          The option to pick up a user token per request (Default: authed_user) -The available values are "authed_user" and "actor". When you want to resolve the user token per request -using the event's actor IDs, you can set "actor" instead. With this option, bolt-python tries to resolve -a user token for context.actor_enterprise/team/user_id. This can be useful for events in Slack Connect -channels. Note that actor IDs can be absent in some scenarios.
                                                                                                                          -
                                                                                                                          state_validation_enabled
                                                                                                                          -
                                                                                                                          Set False if your OAuth flow omits the state parameter validation (Default: True)
                                                                                                                          -
                                                                                                                          state_store
                                                                                                                          -
                                                                                                                          Specify the instance of InstallationStore (Default: FileOAuthStateStore)
                                                                                                                          -
                                                                                                                          state_cookie_name
                                                                                                                          -
                                                                                                                          The cookie name that is set for installers' browser. (Default: "slack-app-oauth-state")
                                                                                                                          -
                                                                                                                          state_expiration_seconds
                                                                                                                          -
                                                                                                                          The seconds that the state value is alive (Default: 600 seconds)
                                                                                                                          -
                                                                                                                          logger
                                                                                                                          -
                                                                                                                          The logger that will be used internally
                                                                                                                          -
                                                                                                                          Expand source code @@ -251,107 +212,157 @@

                                                                                                                          Args

                                                                                                                          failure_url=self.failure_url, )
                                                                                                                          +

                                                                                                                          The settings for Slack App installation (OAuth flow).

                                                                                                                          +

                                                                                                                          Args

                                                                                                                          +
                                                                                                                          +
                                                                                                                          client_id
                                                                                                                          +
                                                                                                                          Check the value in Settings > Basic Information > App Credentials
                                                                                                                          +
                                                                                                                          client_secret
                                                                                                                          +
                                                                                                                          Check the value in Settings > Basic Information > App Credentials
                                                                                                                          +
                                                                                                                          scopes
                                                                                                                          +
                                                                                                                          Check the value in Settings > Manage Distribution
                                                                                                                          +
                                                                                                                          user_scopes
                                                                                                                          +
                                                                                                                          Check the value in Settings > Manage Distribution
                                                                                                                          +
                                                                                                                          redirect_uri
                                                                                                                          +
                                                                                                                          Check the value in Features > OAuth & Permissions > Redirect URLs
                                                                                                                          +
                                                                                                                          install_path
                                                                                                                          +
                                                                                                                          The endpoint to start an OAuth flow (Default: /slack/install)
                                                                                                                          +
                                                                                                                          install_page_rendering_enabled
                                                                                                                          +
                                                                                                                          Renders a web page for install_path access if True
                                                                                                                          +
                                                                                                                          redirect_uri_path
                                                                                                                          +
                                                                                                                          The path of Redirect URL (Default: /slack/oauth_redirect)
                                                                                                                          +
                                                                                                                          callback_options
                                                                                                                          +
                                                                                                                          Give success/failure functions f you want to customize callback functions.
                                                                                                                          +
                                                                                                                          success_url
                                                                                                                          +
                                                                                                                          Set a complete URL if you want to redirect end-users when an installation completes.
                                                                                                                          +
                                                                                                                          failure_url
                                                                                                                          +
                                                                                                                          Set a complete URL if you want to redirect end-users when an installation fails.
                                                                                                                          +
                                                                                                                          authorization_url
                                                                                                                          +
                                                                                                                          Set a URL if you want to customize the URL https://slack.com/oauth/v2/authorize
                                                                                                                          +
                                                                                                                          installation_store
                                                                                                                          +
                                                                                                                          Specify the instance of InstallationStore (Default: FileInstallationStore)
                                                                                                                          +
                                                                                                                          installation_store_bot_only
                                                                                                                          +
                                                                                                                          Use InstallationStore#find_bot() if True (Default: False)
                                                                                                                          +
                                                                                                                          token_rotation_expiration_minutes
                                                                                                                          +
                                                                                                                          Minutes before refreshing tokens (Default: 2 hours)
                                                                                                                          +
                                                                                                                          user_token_resolution
                                                                                                                          +
                                                                                                                          The option to pick up a user token per request (Default: authed_user) +The available values are "authed_user" and "actor". When you want to resolve the user token per request +using the event's actor IDs, you can set "actor" instead. With this option, bolt-python tries to resolve +a user token for context.actor_enterprise/team/user_id. This can be useful for events in Slack Connect +channels. Note that actor IDs can be absent in some scenarios.
                                                                                                                          +
                                                                                                                          state_validation_enabled
                                                                                                                          +
                                                                                                                          Set False if your OAuth flow omits the state parameter validation (Default: True)
                                                                                                                          +
                                                                                                                          state_store
                                                                                                                          +
                                                                                                                          Specify the instance of InstallationStore (Default: FileOAuthStateStore)
                                                                                                                          +
                                                                                                                          state_cookie_name
                                                                                                                          +
                                                                                                                          The cookie name that is set for installers' browser. (Default: "slack-app-oauth-state")
                                                                                                                          +
                                                                                                                          state_expiration_seconds
                                                                                                                          +
                                                                                                                          The seconds that the state value is alive (Default: 600 seconds)
                                                                                                                          +
                                                                                                                          logger
                                                                                                                          +
                                                                                                                          The logger that will be used internally
                                                                                                                          +

                                                                                                                          Class variables

                                                                                                                          var authorization_url : str
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var authorizeAsyncAuthorize
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var authorize_url_generator : slack_sdk.oauth.authorize_url_generator.AuthorizeUrlGenerator
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var callback_optionsAsyncCallbackOptions | None
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var client_id : str
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var client_secret : str
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var failure_url : str | None
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var install_page_rendering_enabled : bool
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var install_path : str
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var installation_store : slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var installation_store_bot_only : bool
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var logger : logging.Logger
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var redirect_uri : str | None
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var redirect_uri_page_renderer : slack_sdk.oauth.redirect_uri_page_renderer.RedirectUriPageRenderer
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var redirect_uri_path : str
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var scopes : Sequence[str] | None
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var state_expiration_seconds : int
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var state_store : slack_sdk.oauth.state_store.async_state_store.AsyncOAuthStateStore
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var state_utils : slack_sdk.oauth.state_utils.OAuthStateUtils
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var state_validation_enabled : bool
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var success_url : str | None
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var token_rotation_expiration_minutes : int
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var user_scopes : Sequence[str] | None
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          var user_token_resolution : str
                                                                                                                          -
                                                                                                                          +

                                                                                                                          The type of the None singleton.

                                                                                                                          @@ -406,7 +417,7 @@

                                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/oauth/callback_options.html b/docs/static/api-docs/slack_bolt/oauth/callback_options.html index d6073d23..ac2a200b 100644 --- a/docs/static/api-docs/slack_bolt/oauth/callback_options.html +++ b/docs/static/api-docs/slack_bolt/oauth/callback_options.html @@ -3,19 +3,30 @@ - + slack_bolt.oauth.callback_options API documentation - + @@ -40,14 +51,6 @@

                                                                                                                          Classes

                                                                                                                          (success: Callable[[SuccessArgs], BoltResponse],
                                                                                                                          failure: Callable[[FailureArgs], BoltResponse])
                                                                                                                          -

                                                                                                                          The configurations for OAuth flow.

                                                                                                                          -

                                                                                                                          Args

                                                                                                                          -
                                                                                                                          -
                                                                                                                          success
                                                                                                                          -
                                                                                                                          A handler for successful installation.
                                                                                                                          -
                                                                                                                          failure
                                                                                                                          -
                                                                                                                          A handler for any types of installation failures.
                                                                                                                          -
                                                                                                                          Expand source code @@ -70,6 +73,14 @@

                                                                                                                          Args

                                                                                                                          self.success = success self.failure = failure
                                                                                                                          +

                                                                                                                          The configurations for OAuth flow.

                                                                                                                          +

                                                                                                                          Args

                                                                                                                          +
                                                                                                                          +
                                                                                                                          success
                                                                                                                          +
                                                                                                                          A handler for successful installation.
                                                                                                                          +
                                                                                                                          failure
                                                                                                                          +
                                                                                                                          A handler for any types of installation failures.
                                                                                                                          +

                                                                                                                          Subclasses

                                                                                                                          @@ -91,14 +102,6 @@

                                                                                                                          Class variables

                                                                                                                          (*,
                                                                                                                          logger: logging.Logger,
                                                                                                                          state_utils: slack_sdk.oauth.state_utils.OAuthStateUtils,
                                                                                                                          redirect_uri_page_renderer: slack_sdk.oauth.redirect_uri_page_renderer.RedirectUriPageRenderer)
                                                                                                                          -

                                                                                                                          The configurations for OAuth flow.

                                                                                                                          -

                                                                                                                          Args

                                                                                                                          -
                                                                                                                          -
                                                                                                                          success
                                                                                                                          -
                                                                                                                          A handler for successful installation.
                                                                                                                          -
                                                                                                                          failure
                                                                                                                          -
                                                                                                                          A handler for any types of installation failures.
                                                                                                                          -
                                                                                                                          Expand source code @@ -139,43 +142,33 @@

                                                                                                                          Args

                                                                                                                          status=args.suggested_status_code, )
                                                                                                                          +

                                                                                                                          The configurations for OAuth flow.

                                                                                                                          +

                                                                                                                          Args

                                                                                                                          +
                                                                                                                          +
                                                                                                                          success
                                                                                                                          +
                                                                                                                          A handler for successful installation.
                                                                                                                          +
                                                                                                                          failure
                                                                                                                          +
                                                                                                                          A handler for any types of installation failures.
                                                                                                                          +

                                                                                                                          Ancestors

                                                                                                                          -

                                                                                                                          Class variables

                                                                                                                          -
                                                                                                                          -
                                                                                                                          var failure : Callable[[FailureArgs], BoltResponse]
                                                                                                                          -
                                                                                                                          -
                                                                                                                          -
                                                                                                                          -
                                                                                                                          var success : Callable[[SuccessArgs], BoltResponse]
                                                                                                                          -
                                                                                                                          -
                                                                                                                          -
                                                                                                                          -
                                                                                                                          +

                                                                                                                          Inherited members

                                                                                                                          +
                                                                                                                          class FailureArgs (*,
                                                                                                                          request: BoltRequest,
                                                                                                                          reason: str,
                                                                                                                          error: Exception | None = None,
                                                                                                                          suggested_status_code: int,
                                                                                                                          settings: OAuthSettings,
                                                                                                                          default: CallbackOptions)
                                                                                                                          -

                                                                                                                          The arguments for a failure function.

                                                                                                                          -

                                                                                                                          Args

                                                                                                                          -
                                                                                                                          -
                                                                                                                          request
                                                                                                                          -
                                                                                                                          The request.
                                                                                                                          -
                                                                                                                          reason
                                                                                                                          -
                                                                                                                          The response.
                                                                                                                          -
                                                                                                                          error
                                                                                                                          -
                                                                                                                          An exception if exists.
                                                                                                                          -
                                                                                                                          suggested_status_code
                                                                                                                          -
                                                                                                                          The recommended HTTP status code for the failure.
                                                                                                                          -
                                                                                                                          settings
                                                                                                                          -
                                                                                                                          The settings for Slack OAuth flow.
                                                                                                                          -
                                                                                                                          default
                                                                                                                          -
                                                                                                                          The default CallbackOptions.
                                                                                                                          -
                                                                                                                          Expand source code @@ -208,24 +201,28 @@

                                                                                                                          Args

                                                                                                                          self.settings = settings self.default = default
                                                                                                                          -
                                                                                                                          -
                                                                                                                          -class SuccessArgs -(*,
                                                                                                                          request: BoltRequest,
                                                                                                                          installation: slack_sdk.oauth.installation_store.models.installation.Installation,
                                                                                                                          settings: OAuthSettings,
                                                                                                                          default: CallbackOptions)
                                                                                                                          -
                                                                                                                          -
                                                                                                                          -

                                                                                                                          The arguments for a success function.

                                                                                                                          +

                                                                                                                          The arguments for a failure function.

                                                                                                                          Args

                                                                                                                          request
                                                                                                                          The request.
                                                                                                                          -
                                                                                                                          installation
                                                                                                                          -
                                                                                                                          The installation data.
                                                                                                                          +
                                                                                                                          reason
                                                                                                                          +
                                                                                                                          The response.
                                                                                                                          +
                                                                                                                          error
                                                                                                                          +
                                                                                                                          An exception if exists.
                                                                                                                          +
                                                                                                                          suggested_status_code
                                                                                                                          +
                                                                                                                          The recommended HTTP status code for the failure.
                                                                                                                          settings
                                                                                                                          The settings for Slack OAuth flow.
                                                                                                                          default
                                                                                                                          -
                                                                                                                          The default CallbackOptions
                                                                                                                          +
                                                                                                                          The default CallbackOptions.
                                                                                                                          +
                                                                                                                          +
                                                                                                                          +class SuccessArgs +(*,
                                                                                                                          request: BoltRequest,
                                                                                                                          installation: slack_sdk.oauth.installation_store.models.installation.Installation,
                                                                                                                          settings: OAuthSettings,
                                                                                                                          default: CallbackOptions)
                                                                                                                          +
                                                                                                                          +
                                                                                                                          Expand source code @@ -252,6 +249,18 @@

                                                                                                                          Args

                                                                                                                          self.settings = settings self.default = default
                                                                                                                          +

                                                                                                                          The arguments for a success function.

                                                                                                                          +

                                                                                                                          Args

                                                                                                                          +
                                                                                                                          +
                                                                                                                          request
                                                                                                                          +
                                                                                                                          The request.
                                                                                                                          +
                                                                                                                          installation
                                                                                                                          +
                                                                                                                          The installation data.
                                                                                                                          +
                                                                                                                          settings
                                                                                                                          +
                                                                                                                          The settings for Slack OAuth flow.
                                                                                                                          +
                                                                                                                          default
                                                                                                                          +
                                                                                                                          The default CallbackOptions
                                                                                                                          +

                                                                                                                @@ -277,10 +286,6 @@

                                                                                                                DefaultCallbackOptions

                                                                                                                -
                                                                                                              • FailureArgs

                                                                                                                @@ -294,7 +299,7 @@

                                                                                                                -

                                                                                                                Generated by pdoc 0.11.3.

                                                                                                                +

                                                                                                                Generated by pdoc 0.11.5.

                                                                                                                diff --git a/docs/static/api-docs/slack_bolt/oauth/index.html b/docs/static/api-docs/slack_bolt/oauth/index.html index 697750f3..6281fbcc 100644 --- a/docs/static/api-docs/slack_bolt/oauth/index.html +++ b/docs/static/api-docs/slack_bolt/oauth/index.html @@ -3,19 +3,30 @@ - + slack_bolt.oauth API documentation - + @@ -77,16 +88,6 @@

                                                                                                                Classes

                                                                                                                (*,
                                                                                                                client: slack_sdk.web.client.WebClient | None = None,
                                                                                                                logger: logging.Logger | None = None,
                                                                                                                settings: OAuthSettings)
                                                                                                                -

                                                                                                                The module to run the Slack app installation flow (OAuth flow).

                                                                                                                -

                                                                                                                Args

                                                                                                                -
                                                                                                                -
                                                                                                                client
                                                                                                                -
                                                                                                                The slack_sdk.web.WebClient instance.
                                                                                                                -
                                                                                                                logger
                                                                                                                -
                                                                                                                The logger.
                                                                                                                -
                                                                                                                settings
                                                                                                                -
                                                                                                                OAuth settings to configure this module.
                                                                                                                -
                                                                                                                Expand source code @@ -433,6 +434,16 @@

                                                                                                                Args

                                                                                                                # may raise BoltError self.settings.installation_store.save(installation)
                                                                                                                +

                                                                                                                The module to run the Slack app installation flow (OAuth flow).

                                                                                                                +

                                                                                                                Args

                                                                                                                +
                                                                                                                +
                                                                                                                client
                                                                                                                +
                                                                                                                The slack_sdk.web.WebClient instance.
                                                                                                                +
                                                                                                                logger
                                                                                                                +
                                                                                                                The logger.
                                                                                                                +
                                                                                                                settings
                                                                                                                +
                                                                                                                OAuth settings to configure this module.
                                                                                                                +

                                                                                                                Subclasses

                                                                                                                • LambdaS3OAuthFlow
                                                                                                                • @@ -441,31 +452,31 @@

                                                                                                                  Class variables

                                                                                                                  var client_id : str
                                                                                                                  -
                                                                                                                  +

                                                                                                                  The type of the None singleton.

                                                                                                                  var failure_handler : Callable[[FailureArgs], BoltResponse]
                                                                                                                  -
                                                                                                                  +

                                                                                                                  The type of the None singleton.

                                                                                                                  var install_path : str
                                                                                                                  -
                                                                                                                  +

                                                                                                                  The type of the None singleton.

                                                                                                                  var redirect_uri : str | None
                                                                                                                  -
                                                                                                                  +

                                                                                                                  The type of the None singleton.

                                                                                                                  var redirect_uri_path : str
                                                                                                                  -
                                                                                                                  +

                                                                                                                  The type of the None singleton.

                                                                                                                  var settingsOAuthSettings
                                                                                                                  -
                                                                                                                  +

                                                                                                                  The type of the None singleton.

                                                                                                                  var success_handler : Callable[[SuccessArgs], BoltResponse]
                                                                                                                  -
                                                                                                                  +

                                                                                                                  The type of the None singleton.

                                                                                                                  Static methods

                                                                                                                  @@ -481,7 +492,6 @@

                                                                                                                  Instance variables

                                                                                                                  prop client : slack_sdk.web.client.WebClient
                                                                                                                  -
                                                                                                                  Expand source code @@ -492,10 +502,10 @@

                                                                                                                  Instance variables

                                                                                                                  self._client = create_web_client(logger=self.logger) return self._client
                                                                                                                  +
                                                                                                                  prop logger : logging.Logger
                                                                                                                  -
                                                                                                                  Expand source code @@ -506,6 +516,7 @@

                                                                                                                  Instance variables

                                                                                                                  self._logger = logging.getLogger(__name__) return self._logger
                                                                                                                  +

                                                                                                                  Methods

                                                                                                                  @@ -514,48 +525,277 @@

                                                                                                                  Methods

                                                                                                                  def append_set_cookie_headers(self, headers: dict, set_cookie_value: str | None)
                                                                                                                  +
                                                                                                                  + +Expand source code + +
                                                                                                                  def append_set_cookie_headers(self, headers: dict, set_cookie_value: Optional[str]):
                                                                                                                  +    if set_cookie_value is not None:
                                                                                                                  +        headers["Set-Cookie"] = [set_cookie_value]
                                                                                                                  +    return headers
                                                                                                                  +
                                                                                                                  def build_authorize_url(self,
                                                                                                                  state: str,
                                                                                                                  request: BoltRequest) ‑> str
                                                                                                                  +
                                                                                                                  + +Expand source code + +
                                                                                                                  def build_authorize_url(self, state: str, request: BoltRequest) -> str:
                                                                                                                  +    team_ids: Optional[Sequence[str]] = request.query.get("team")
                                                                                                                  +    return self.settings.authorize_url_generator.generate(
                                                                                                                  +        state=state,
                                                                                                                  +        team=team_ids[0] if team_ids is not None else None,
                                                                                                                  +    )
                                                                                                                  +
                                                                                                                  def build_install_page_html(self,
                                                                                                                  url: str,
                                                                                                                  request: BoltRequest) ‑> str
                                                                                                                  +
                                                                                                                  + +Expand source code + +
                                                                                                                  def build_install_page_html(self, url: str, request: BoltRequest) -> str:
                                                                                                                  +    return _build_default_install_page_html(url)
                                                                                                                  +
                                                                                                                  def handle_callback(self,
                                                                                                                  request: BoltRequest) ‑> BoltResponse
                                                                                                                  +
                                                                                                                  + +Expand source code + +
                                                                                                                  def handle_callback(self, request: BoltRequest) -> BoltResponse:
                                                                                                                  +
                                                                                                                  +    # failure due to end-user's cancellation or invalid redirection to slack.com
                                                                                                                  +    error = request.query.get("error", [None])[0]
                                                                                                                  +    if error is not None:
                                                                                                                  +        return self.failure_handler(
                                                                                                                  +            FailureArgs(
                                                                                                                  +                request=request,
                                                                                                                  +                reason=error,
                                                                                                                  +                suggested_status_code=200,
                                                                                                                  +                settings=self.settings,
                                                                                                                  +                default=self.default_callback_options,
                                                                                                                  +            )
                                                                                                                  +        )
                                                                                                                  +
                                                                                                                  +    # state parameter verification
                                                                                                                  +    if self.settings.state_validation_enabled is True:
                                                                                                                  +        state = request.query.get("state", [None])[0]
                                                                                                                  +        if not self.settings.state_utils.is_valid_browser(state, request.headers):
                                                                                                                  +            return self.failure_handler(
                                                                                                                  +                FailureArgs(
                                                                                                                  +                    request=request,
                                                                                                                  +                    reason="invalid_browser",
                                                                                                                  +                    suggested_status_code=400,
                                                                                                                  +                    settings=self.settings,
                                                                                                                  +                    default=self.default_callback_options,
                                                                                                                  +                )
                                                                                                                  +            )
                                                                                                                  +
                                                                                                                  +        valid_state_consumed = self.settings.state_store.consume(state)  # type: ignore[arg-type]
                                                                                                                  +        if not valid_state_consumed:
                                                                                                                  +            return self.failure_handler(
                                                                                                                  +                FailureArgs(
                                                                                                                  +                    request=request,
                                                                                                                  +                    reason="invalid_state",
                                                                                                                  +                    suggested_status_code=401,
                                                                                                                  +                    settings=self.settings,
                                                                                                                  +                    default=self.default_callback_options,
                                                                                                                  +                )
                                                                                                                  +            )
                                                                                                                  +
                                                                                                                  +    # run installation
                                                                                                                  +    code = request.query.get("code", [None])[0]
                                                                                                                  +    if code is None:
                                                                                                                  +        return self.failure_handler(
                                                                                                                  +            FailureArgs(
                                                                                                                  +                request=request,
                                                                                                                  +                reason="missing_code",
                                                                                                                  +                suggested_status_code=401,
                                                                                                                  +                settings=self.settings,
                                                                                                                  +                default=self.default_callback_options,
                                                                                                                  +            )
                                                                                                                  +        )
                                                                                                                  +
                                                                                                                  +    installation = self.run_installation(code)
                                                                                                                  +    if installation is None:
                                                                                                                  +        # failed to run installation with the code
                                                                                                                  +        return self.failure_handler(
                                                                                                                  +            FailureArgs(
                                                                                                                  +                request=request,
                                                                                                                  +                reason="invalid_code",
                                                                                                                  +                suggested_status_code=401,
                                                                                                                  +                settings=self.settings,
                                                                                                                  +                default=self.default_callback_options,
                                                                                                                  +            )
                                                                                                                  +        )
                                                                                                                  +
                                                                                                                  +    # persist the installation
                                                                                                                  +    try:
                                                                                                                  +        self.store_installation(request, installation)
                                                                                                                  +    except BoltError as err:
                                                                                                                  +        return self.failure_handler(
                                                                                                                  +            FailureArgs(
                                                                                                                  +                request=request,
                                                                                                                  +                reason="storage_error",
                                                                                                                  +                error=err,
                                                                                                                  +                suggested_status_code=500,
                                                                                                                  +                settings=self.settings,
                                                                                                                  +                default=self.default_callback_options,
                                                                                                                  +            )
                                                                                                                  +        )
                                                                                                                  +
                                                                                                                  +    # display a successful completion page to the end-user
                                                                                                                  +    return self.success_handler(
                                                                                                                  +        SuccessArgs(
                                                                                                                  +            request=request,
                                                                                                                  +            installation=installation,
                                                                                                                  +            settings=self.settings,
                                                                                                                  +            default=self.default_callback_options,
                                                                                                                  +        )
                                                                                                                  +    )
                                                                                                                  +
                                                                                                                  def handle_installation(self,
                                                                                                                  request: BoltRequest) ‑> BoltResponse
                                                                                                                  +
                                                                                                                  + +Expand source code + +
                                                                                                                  def handle_installation(self, request: BoltRequest) -> BoltResponse:
                                                                                                                  +    set_cookie_value: Optional[str] = None
                                                                                                                  +    url = self.build_authorize_url("", request)
                                                                                                                  +    if self.settings.state_validation_enabled is True:
                                                                                                                  +        state = self.issue_new_state(request)
                                                                                                                  +        url = self.build_authorize_url(state, request)
                                                                                                                  +        set_cookie_value = self.settings.state_utils.build_set_cookie_for_new_state(state)
                                                                                                                  +
                                                                                                                  +    if self.settings.install_page_rendering_enabled:
                                                                                                                  +        html = self.build_install_page_html(url, request)
                                                                                                                  +        return BoltResponse(
                                                                                                                  +            status=200,
                                                                                                                  +            body=html,
                                                                                                                  +            headers=self.append_set_cookie_headers(
                                                                                                                  +                {"Content-Type": "text/html; charset=utf-8"},
                                                                                                                  +                set_cookie_value,
                                                                                                                  +            ),
                                                                                                                  +        )
                                                                                                                  +    else:
                                                                                                                  +        return BoltResponse(
                                                                                                                  +            status=302,
                                                                                                                  +            body="",
                                                                                                                  +            headers=self.append_set_cookie_headers(
                                                                                                                  +                {"Content-Type": "text/html; charset=utf-8", "Location": url},
                                                                                                                  +                set_cookie_value,
                                                                                                                  +            ),
                                                                                                                  +        )
                                                                                                                  +
                                                                                                                  def issue_new_state(self,
                                                                                                                  request: BoltRequest) ‑> str
                                                                                                                  +
                                                                                                                  + +Expand source code + +
                                                                                                                  def issue_new_state(self, request: BoltRequest) -> str:
                                                                                                                  +    return self.settings.state_store.issue()
                                                                                                                  +
                                                                                                                  def run_installation(self, code: str) ‑> slack_sdk.oauth.installation_store.models.installation.Installation | None
                                                                                                                  +
                                                                                                                  + +Expand source code + +
                                                                                                                  def run_installation(self, code: str) -> Optional[Installation]:
                                                                                                                  +    try:
                                                                                                                  +        oauth_response: SlackResponse = self.client.oauth_v2_access(
                                                                                                                  +            code=code,
                                                                                                                  +            client_id=self.settings.client_id,
                                                                                                                  +            client_secret=self.settings.client_secret,
                                                                                                                  +            redirect_uri=self.settings.redirect_uri,  # can be None
                                                                                                                  +        )
                                                                                                                  +        installed_enterprise: Dict[str, str] = oauth_response.get("enterprise") or {}
                                                                                                                  +        is_enterprise_install: bool = oauth_response.get("is_enterprise_install") or False
                                                                                                                  +        installed_team: Dict[str, str] = oauth_response.get("team") or {}
                                                                                                                  +        installer: Dict[str, str] = oauth_response.get("authed_user") or {}
                                                                                                                  +        incoming_webhook: Dict[str, str] = oauth_response.get("incoming_webhook") or {}
                                                                                                                  +
                                                                                                                  +        bot_token: Optional[str] = oauth_response.get("access_token")
                                                                                                                  +        # NOTE: oauth.v2.access doesn't include bot_id in response
                                                                                                                  +        bot_id: Optional[str] = None
                                                                                                                  +        enterprise_url: Optional[str] = None
                                                                                                                  +        if bot_token is not None:
                                                                                                                  +            auth_test = self.client.auth_test(token=bot_token)
                                                                                                                  +            bot_id = auth_test["bot_id"]
                                                                                                                  +            if is_enterprise_install is True:
                                                                                                                  +                enterprise_url = auth_test.get("url")
                                                                                                                  +
                                                                                                                  +        return Installation(
                                                                                                                  +            app_id=oauth_response.get("app_id"),
                                                                                                                  +            enterprise_id=installed_enterprise.get("id"),
                                                                                                                  +            enterprise_name=installed_enterprise.get("name"),
                                                                                                                  +            enterprise_url=enterprise_url,
                                                                                                                  +            team_id=installed_team.get("id"),
                                                                                                                  +            team_name=installed_team.get("name"),
                                                                                                                  +            bot_token=bot_token,
                                                                                                                  +            bot_id=bot_id,
                                                                                                                  +            bot_user_id=oauth_response.get("bot_user_id"),
                                                                                                                  +            bot_scopes=oauth_response.get("scope"),  # type: ignore[arg-type] # comma-separated string
                                                                                                                  +            bot_refresh_token=oauth_response.get("refresh_token"),  # since v1.7
                                                                                                                  +            bot_token_expires_in=oauth_response.get("expires_in"),  # since v1.7
                                                                                                                  +            user_id=installer.get("id"),  # type: ignore[arg-type]
                                                                                                                  +            user_token=installer.get("access_token"),
                                                                                                                  +            user_scopes=installer.get("scope"),  # type: ignore[arg-type] # comma-separated string
                                                                                                                  +            user_refresh_token=installer.get("refresh_token"),  # since v1.7
                                                                                                                  +            user_token_expires_in=installer.get("expires_in"),  # type: ignore[arg-type] # since v1.7
                                                                                                                  +            incoming_webhook_url=incoming_webhook.get("url"),
                                                                                                                  +            incoming_webhook_channel=incoming_webhook.get("channel"),
                                                                                                                  +            incoming_webhook_channel_id=incoming_webhook.get("channel_id"),
                                                                                                                  +            incoming_webhook_configuration_url=incoming_webhook.get("configuration_url"),
                                                                                                                  +            is_enterprise_install=is_enterprise_install,
                                                                                                                  +            token_type=oauth_response.get("token_type"),
                                                                                                                  +        )
                                                                                                                  +
                                                                                                                  +    except SlackApiError as e:
                                                                                                                  +        message = f"Failed to fetch oauth.v2.access result with code: {code} - error: {e}"
                                                                                                                  +        self.logger.warning(message)
                                                                                                                  +        return None
                                                                                                                  +
                                                                                                                  def store_installation(self,
                                                                                                                  request: BoltRequest,
                                                                                                                  installation: slack_sdk.oauth.installation_store.models.installation.Installation)
                                                                                                                  +
                                                                                                                  + +Expand source code + +
                                                                                                                  def store_installation(self, request: BoltRequest, installation: Installation):
                                                                                                                  +    # may raise BoltError
                                                                                                                  +    self.settings.installation_store.save(installation)
                                                                                                                  +

                                                                                                        • @@ -616,7 +856,7 @@

                                                                                                          -

                                                                                                          Generated by pdoc 0.11.3.

                                                                                                          +

                                                                                                          Generated by pdoc 0.11.5.

                                                                                                          diff --git a/docs/static/api-docs/slack_bolt/oauth/internals.html b/docs/static/api-docs/slack_bolt/oauth/internals.html index daa82281..e1b23978 100644 --- a/docs/static/api-docs/slack_bolt/oauth/internals.html +++ b/docs/static/api-docs/slack_bolt/oauth/internals.html @@ -3,19 +3,30 @@ - + slack_bolt.oauth.internals API documentation - + @@ -37,18 +48,77 @@

                                                                                                          Functions

                                                                                                          def build_detailed_error(reason: str) ‑> str
                                                                                                          +
                                                                                                          + +Expand source code + +
                                                                                                          def build_detailed_error(reason: str) -> str:
                                                                                                          +    if reason == "invalid_browser":
                                                                                                          +        return (
                                                                                                          +            f"{reason}: This can occur due to page reload, "
                                                                                                          +            "not beginning the OAuth flow from the valid starting URL, or "
                                                                                                          +            "the /slack/install URL not using https://"
                                                                                                          +        )
                                                                                                          +    elif reason == "invalid_state":
                                                                                                          +        return f"{reason}: The state parameter is no longer valid."
                                                                                                          +    elif reason == "missing_code":
                                                                                                          +        return f"{reason}: The code parameter is missing in this redirection."
                                                                                                          +    elif reason == "storage_error":
                                                                                                          +        return f"{reason}: The app's server encountered an issue. Contact the app developer."
                                                                                                          +    else:
                                                                                                          +        return f"{html.escape(reason)}: This error code is returned from Slack. Refer to the documents for details."
                                                                                                          +
                                                                                                          def get_or_create_default_installation_store(client_id: str) ‑> slack_sdk.oauth.installation_store.installation_store.InstallationStore
                                                                                                          +
                                                                                                          + +Expand source code + +
                                                                                                          def get_or_create_default_installation_store(client_id: str) -> InstallationStore:
                                                                                                          +    store = default_installation_stores.get(client_id)
                                                                                                          +    if store is None:
                                                                                                          +        store = FileInstallationStore(client_id=client_id)
                                                                                                          +        default_installation_stores[client_id] = store
                                                                                                          +    return store
                                                                                                          +
                                                                                                          def select_consistent_installation_store(client_id: str,
                                                                                                          app_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore | None,
                                                                                                          oauth_flow_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore | None,
                                                                                                          logger: logging.Logger) ‑> slack_sdk.oauth.installation_store.installation_store.InstallationStore | None
                                                                                                          +
                                                                                                          + +Expand source code + +
                                                                                                          def select_consistent_installation_store(
                                                                                                          +    client_id: str,
                                                                                                          +    app_store: Optional[InstallationStore],
                                                                                                          +    oauth_flow_store: Optional[InstallationStore],
                                                                                                          +    logger: Logger,
                                                                                                          +) -> Optional[InstallationStore]:
                                                                                                          +    default = get_or_create_default_installation_store(client_id)
                                                                                                          +    if app_store is not None:
                                                                                                          +        if oauth_flow_store is not None:
                                                                                                          +            if oauth_flow_store is default:
                                                                                                          +                # only app_store is intentionally set in this case
                                                                                                          +                return app_store
                                                                                                          +
                                                                                                          +            # if both are intentionally set, prioritize app_store
                                                                                                          +            if oauth_flow_store is not app_store:
                                                                                                          +                logger.warning(warning_installation_store_conflicts())
                                                                                                          +            return oauth_flow_store
                                                                                                          +        else:
                                                                                                          +            # only app_store is available
                                                                                                          +            return app_store
                                                                                                          +    else:
                                                                                                          +        # only oauth_flow_store is available
                                                                                                          +        return oauth_flow_store
                                                                                                          +

                                                                                                          @@ -61,7 +131,6 @@

                                                                                                          Classes

                                                                                                          (*,
                                                                                                          logger: logging.Logger,
                                                                                                          state_utils: slack_sdk.oauth.state_utils.OAuthStateUtils,
                                                                                                          redirect_uri_page_renderer: slack_sdk.oauth.redirect_uri_page_renderer.RedirectUriPageRenderer)
                                                                                                          -
                                                                                                          Expand source code @@ -123,6 +192,7 @@

                                                                                                          Classes

                                                                                                          body=self._redirect_uri_page_renderer.render_failure_page(detailed_error), )
                                                                                                          +
                                                                                                      @@ -155,7 +225,7 @@

                                                                                                      -

                                                                                                      Generated by pdoc 0.11.3.

                                                                                                      +

                                                                                                      Generated by pdoc 0.11.5.

                                                                                                      diff --git a/docs/static/api-docs/slack_bolt/oauth/oauth_flow.html b/docs/static/api-docs/slack_bolt/oauth/oauth_flow.html index 67b6b467..abae18cb 100644 --- a/docs/static/api-docs/slack_bolt/oauth/oauth_flow.html +++ b/docs/static/api-docs/slack_bolt/oauth/oauth_flow.html @@ -3,19 +3,30 @@ - + slack_bolt.oauth.oauth_flow API documentation - + @@ -40,16 +51,6 @@

                                                                                                      Classes

                                                                                                      (*,
                                                                                                      client: slack_sdk.web.client.WebClient | None = None,
                                                                                                      logger: logging.Logger | None = None,
                                                                                                      settings: OAuthSettings)
                                                                                                      -

                                                                                                      The module to run the Slack app installation flow (OAuth flow).

                                                                                                      -

                                                                                                      Args

                                                                                                      -
                                                                                                      -
                                                                                                      client
                                                                                                      -
                                                                                                      The slack_sdk.web.WebClient instance.
                                                                                                      -
                                                                                                      logger
                                                                                                      -
                                                                                                      The logger.
                                                                                                      -
                                                                                                      settings
                                                                                                      -
                                                                                                      OAuth settings to configure this module.
                                                                                                      -
                                                                                                      Expand source code @@ -396,6 +397,16 @@

                                                                                                      Args

                                                                                                      # may raise BoltError self.settings.installation_store.save(installation)
                                                                                                      +

                                                                                                      The module to run the Slack app installation flow (OAuth flow).

                                                                                                      +

                                                                                                      Args

                                                                                                      +
                                                                                                      +
                                                                                                      client
                                                                                                      +
                                                                                                      The slack_sdk.web.WebClient instance.
                                                                                                      +
                                                                                                      logger
                                                                                                      +
                                                                                                      The logger.
                                                                                                      +
                                                                                                      settings
                                                                                                      +
                                                                                                      OAuth settings to configure this module.
                                                                                                      +

                                                                                                      Subclasses

                                                                                                      • LambdaS3OAuthFlow
                                                                                                      • @@ -404,31 +415,31 @@

                                                                                                        Class variables

                                                                                                        var client_id : str
                                                                                                        -
                                                                                                        +

                                                                                                        The type of the None singleton.

                                                                                                        var failure_handler : Callable[[FailureArgs], BoltResponse]
                                                                                                        -
                                                                                                        +

                                                                                                        The type of the None singleton.

                                                                                                        var install_path : str
                                                                                                        -
                                                                                                        +

                                                                                                        The type of the None singleton.

                                                                                                        var redirect_uri : str | None
                                                                                                        -
                                                                                                        +

                                                                                                        The type of the None singleton.

                                                                                                        var redirect_uri_path : str
                                                                                                        -
                                                                                                        +

                                                                                                        The type of the None singleton.

                                                                                                        var settingsOAuthSettings
                                                                                                        -
                                                                                                        +

                                                                                                        The type of the None singleton.

                                                                                                        var success_handler : Callable[[SuccessArgs], BoltResponse]
                                                                                                        -
                                                                                                        +

                                                                                                        The type of the None singleton.

                                                                                                        Static methods

                                                                                                        @@ -444,7 +455,6 @@

                                                                                                        Instance variables

                                                                                                        prop client : slack_sdk.web.client.WebClient
                                                                                                        -
                                                                                                        Expand source code @@ -455,10 +465,10 @@

                                                                                                        Instance variables

                                                                                                        self._client = create_web_client(logger=self.logger) return self._client
                                                                                                        +
                                                                                                        prop logger : logging.Logger
                                                                                                        -
                                                                                                        Expand source code @@ -469,6 +479,7 @@

                                                                                                        Instance variables

                                                                                                        self._logger = logging.getLogger(__name__) return self._logger
                                                                                                        +

                                                                                                        Methods

                                                                                                        @@ -477,48 +488,277 @@

                                                                                                        Methods

                                                                                                        def append_set_cookie_headers(self, headers: dict, set_cookie_value: str | None)
                                                                                                        +
                                                                                                        + +Expand source code + +
                                                                                                        def append_set_cookie_headers(self, headers: dict, set_cookie_value: Optional[str]):
                                                                                                        +    if set_cookie_value is not None:
                                                                                                        +        headers["Set-Cookie"] = [set_cookie_value]
                                                                                                        +    return headers
                                                                                                        +
                                                                                                        def build_authorize_url(self,
                                                                                                        state: str,
                                                                                                        request: BoltRequest) ‑> str
                                                                                                        +
                                                                                                        + +Expand source code + +
                                                                                                        def build_authorize_url(self, state: str, request: BoltRequest) -> str:
                                                                                                        +    team_ids: Optional[Sequence[str]] = request.query.get("team")
                                                                                                        +    return self.settings.authorize_url_generator.generate(
                                                                                                        +        state=state,
                                                                                                        +        team=team_ids[0] if team_ids is not None else None,
                                                                                                        +    )
                                                                                                        +
                                                                                                        def build_install_page_html(self,
                                                                                                        url: str,
                                                                                                        request: BoltRequest) ‑> str
                                                                                                        +
                                                                                                        + +Expand source code + +
                                                                                                        def build_install_page_html(self, url: str, request: BoltRequest) -> str:
                                                                                                        +    return _build_default_install_page_html(url)
                                                                                                        +
                                                                                                        def handle_callback(self,
                                                                                                        request: BoltRequest) ‑> BoltResponse
                                                                                                        +
                                                                                                        + +Expand source code + +
                                                                                                        def handle_callback(self, request: BoltRequest) -> BoltResponse:
                                                                                                        +
                                                                                                        +    # failure due to end-user's cancellation or invalid redirection to slack.com
                                                                                                        +    error = request.query.get("error", [None])[0]
                                                                                                        +    if error is not None:
                                                                                                        +        return self.failure_handler(
                                                                                                        +            FailureArgs(
                                                                                                        +                request=request,
                                                                                                        +                reason=error,
                                                                                                        +                suggested_status_code=200,
                                                                                                        +                settings=self.settings,
                                                                                                        +                default=self.default_callback_options,
                                                                                                        +            )
                                                                                                        +        )
                                                                                                        +
                                                                                                        +    # state parameter verification
                                                                                                        +    if self.settings.state_validation_enabled is True:
                                                                                                        +        state = request.query.get("state", [None])[0]
                                                                                                        +        if not self.settings.state_utils.is_valid_browser(state, request.headers):
                                                                                                        +            return self.failure_handler(
                                                                                                        +                FailureArgs(
                                                                                                        +                    request=request,
                                                                                                        +                    reason="invalid_browser",
                                                                                                        +                    suggested_status_code=400,
                                                                                                        +                    settings=self.settings,
                                                                                                        +                    default=self.default_callback_options,
                                                                                                        +                )
                                                                                                        +            )
                                                                                                        +
                                                                                                        +        valid_state_consumed = self.settings.state_store.consume(state)  # type: ignore[arg-type]
                                                                                                        +        if not valid_state_consumed:
                                                                                                        +            return self.failure_handler(
                                                                                                        +                FailureArgs(
                                                                                                        +                    request=request,
                                                                                                        +                    reason="invalid_state",
                                                                                                        +                    suggested_status_code=401,
                                                                                                        +                    settings=self.settings,
                                                                                                        +                    default=self.default_callback_options,
                                                                                                        +                )
                                                                                                        +            )
                                                                                                        +
                                                                                                        +    # run installation
                                                                                                        +    code = request.query.get("code", [None])[0]
                                                                                                        +    if code is None:
                                                                                                        +        return self.failure_handler(
                                                                                                        +            FailureArgs(
                                                                                                        +                request=request,
                                                                                                        +                reason="missing_code",
                                                                                                        +                suggested_status_code=401,
                                                                                                        +                settings=self.settings,
                                                                                                        +                default=self.default_callback_options,
                                                                                                        +            )
                                                                                                        +        )
                                                                                                        +
                                                                                                        +    installation = self.run_installation(code)
                                                                                                        +    if installation is None:
                                                                                                        +        # failed to run installation with the code
                                                                                                        +        return self.failure_handler(
                                                                                                        +            FailureArgs(
                                                                                                        +                request=request,
                                                                                                        +                reason="invalid_code",
                                                                                                        +                suggested_status_code=401,
                                                                                                        +                settings=self.settings,
                                                                                                        +                default=self.default_callback_options,
                                                                                                        +            )
                                                                                                        +        )
                                                                                                        +
                                                                                                        +    # persist the installation
                                                                                                        +    try:
                                                                                                        +        self.store_installation(request, installation)
                                                                                                        +    except BoltError as err:
                                                                                                        +        return self.failure_handler(
                                                                                                        +            FailureArgs(
                                                                                                        +                request=request,
                                                                                                        +                reason="storage_error",
                                                                                                        +                error=err,
                                                                                                        +                suggested_status_code=500,
                                                                                                        +                settings=self.settings,
                                                                                                        +                default=self.default_callback_options,
                                                                                                        +            )
                                                                                                        +        )
                                                                                                        +
                                                                                                        +    # display a successful completion page to the end-user
                                                                                                        +    return self.success_handler(
                                                                                                        +        SuccessArgs(
                                                                                                        +            request=request,
                                                                                                        +            installation=installation,
                                                                                                        +            settings=self.settings,
                                                                                                        +            default=self.default_callback_options,
                                                                                                        +        )
                                                                                                        +    )
                                                                                                        +
                                                                                                        def handle_installation(self,
                                                                                                        request: BoltRequest) ‑> BoltResponse
                                                                                                        +
                                                                                                        + +Expand source code + +
                                                                                                        def handle_installation(self, request: BoltRequest) -> BoltResponse:
                                                                                                        +    set_cookie_value: Optional[str] = None
                                                                                                        +    url = self.build_authorize_url("", request)
                                                                                                        +    if self.settings.state_validation_enabled is True:
                                                                                                        +        state = self.issue_new_state(request)
                                                                                                        +        url = self.build_authorize_url(state, request)
                                                                                                        +        set_cookie_value = self.settings.state_utils.build_set_cookie_for_new_state(state)
                                                                                                        +
                                                                                                        +    if self.settings.install_page_rendering_enabled:
                                                                                                        +        html = self.build_install_page_html(url, request)
                                                                                                        +        return BoltResponse(
                                                                                                        +            status=200,
                                                                                                        +            body=html,
                                                                                                        +            headers=self.append_set_cookie_headers(
                                                                                                        +                {"Content-Type": "text/html; charset=utf-8"},
                                                                                                        +                set_cookie_value,
                                                                                                        +            ),
                                                                                                        +        )
                                                                                                        +    else:
                                                                                                        +        return BoltResponse(
                                                                                                        +            status=302,
                                                                                                        +            body="",
                                                                                                        +            headers=self.append_set_cookie_headers(
                                                                                                        +                {"Content-Type": "text/html; charset=utf-8", "Location": url},
                                                                                                        +                set_cookie_value,
                                                                                                        +            ),
                                                                                                        +        )
                                                                                                        +
                                                                                                        def issue_new_state(self,
                                                                                                        request: BoltRequest) ‑> str
                                                                                                        +
                                                                                                        + +Expand source code + +
                                                                                                        def issue_new_state(self, request: BoltRequest) -> str:
                                                                                                        +    return self.settings.state_store.issue()
                                                                                                        +
                                                                                                        def run_installation(self, code: str) ‑> slack_sdk.oauth.installation_store.models.installation.Installation | None
                                                                                                        +
                                                                                                        + +Expand source code + +
                                                                                                        def run_installation(self, code: str) -> Optional[Installation]:
                                                                                                        +    try:
                                                                                                        +        oauth_response: SlackResponse = self.client.oauth_v2_access(
                                                                                                        +            code=code,
                                                                                                        +            client_id=self.settings.client_id,
                                                                                                        +            client_secret=self.settings.client_secret,
                                                                                                        +            redirect_uri=self.settings.redirect_uri,  # can be None
                                                                                                        +        )
                                                                                                        +        installed_enterprise: Dict[str, str] = oauth_response.get("enterprise") or {}
                                                                                                        +        is_enterprise_install: bool = oauth_response.get("is_enterprise_install") or False
                                                                                                        +        installed_team: Dict[str, str] = oauth_response.get("team") or {}
                                                                                                        +        installer: Dict[str, str] = oauth_response.get("authed_user") or {}
                                                                                                        +        incoming_webhook: Dict[str, str] = oauth_response.get("incoming_webhook") or {}
                                                                                                        +
                                                                                                        +        bot_token: Optional[str] = oauth_response.get("access_token")
                                                                                                        +        # NOTE: oauth.v2.access doesn't include bot_id in response
                                                                                                        +        bot_id: Optional[str] = None
                                                                                                        +        enterprise_url: Optional[str] = None
                                                                                                        +        if bot_token is not None:
                                                                                                        +            auth_test = self.client.auth_test(token=bot_token)
                                                                                                        +            bot_id = auth_test["bot_id"]
                                                                                                        +            if is_enterprise_install is True:
                                                                                                        +                enterprise_url = auth_test.get("url")
                                                                                                        +
                                                                                                        +        return Installation(
                                                                                                        +            app_id=oauth_response.get("app_id"),
                                                                                                        +            enterprise_id=installed_enterprise.get("id"),
                                                                                                        +            enterprise_name=installed_enterprise.get("name"),
                                                                                                        +            enterprise_url=enterprise_url,
                                                                                                        +            team_id=installed_team.get("id"),
                                                                                                        +            team_name=installed_team.get("name"),
                                                                                                        +            bot_token=bot_token,
                                                                                                        +            bot_id=bot_id,
                                                                                                        +            bot_user_id=oauth_response.get("bot_user_id"),
                                                                                                        +            bot_scopes=oauth_response.get("scope"),  # type: ignore[arg-type] # comma-separated string
                                                                                                        +            bot_refresh_token=oauth_response.get("refresh_token"),  # since v1.7
                                                                                                        +            bot_token_expires_in=oauth_response.get("expires_in"),  # since v1.7
                                                                                                        +            user_id=installer.get("id"),  # type: ignore[arg-type]
                                                                                                        +            user_token=installer.get("access_token"),
                                                                                                        +            user_scopes=installer.get("scope"),  # type: ignore[arg-type] # comma-separated string
                                                                                                        +            user_refresh_token=installer.get("refresh_token"),  # since v1.7
                                                                                                        +            user_token_expires_in=installer.get("expires_in"),  # type: ignore[arg-type] # since v1.7
                                                                                                        +            incoming_webhook_url=incoming_webhook.get("url"),
                                                                                                        +            incoming_webhook_channel=incoming_webhook.get("channel"),
                                                                                                        +            incoming_webhook_channel_id=incoming_webhook.get("channel_id"),
                                                                                                        +            incoming_webhook_configuration_url=incoming_webhook.get("configuration_url"),
                                                                                                        +            is_enterprise_install=is_enterprise_install,
                                                                                                        +            token_type=oauth_response.get("token_type"),
                                                                                                        +        )
                                                                                                        +
                                                                                                        +    except SlackApiError as e:
                                                                                                        +        message = f"Failed to fetch oauth.v2.access result with code: {code} - error: {e}"
                                                                                                        +        self.logger.warning(message)
                                                                                                        +        return None
                                                                                                        +
                                                                                                        def store_installation(self,
                                                                                                        request: BoltRequest,
                                                                                                        installation: slack_sdk.oauth.installation_store.models.installation.Installation)
                                                                                                        +
                                                                                                        + +Expand source code + +
                                                                                                        def store_installation(self, request: BoltRequest, installation: Installation):
                                                                                                        +    # may raise BoltError
                                                                                                        +    self.settings.installation_store.save(installation)
                                                                                                        +

                                                                                                    @@ -567,7 +807,7 @@

                                                                                                    -

                                                                                                    Generated by pdoc 0.11.3.

                                                                                                    +

                                                                                                    Generated by pdoc 0.11.5.

                                                                                                    diff --git a/docs/static/api-docs/slack_bolt/oauth/oauth_settings.html b/docs/static/api-docs/slack_bolt/oauth/oauth_settings.html index bea18879..0555b761 100644 --- a/docs/static/api-docs/slack_bolt/oauth/oauth_settings.html +++ b/docs/static/api-docs/slack_bolt/oauth/oauth_settings.html @@ -3,19 +3,30 @@ - + slack_bolt.oauth.oauth_settings API documentation - + @@ -40,56 +51,6 @@

                                                                                                    Classes

                                                                                                    (*,
                                                                                                    client_id: str | None = None,
                                                                                                    client_secret: str | None = None,
                                                                                                    scopes: str | Sequence[str] | None = None,
                                                                                                    user_scopes: str | Sequence[str] | None = None,
                                                                                                    redirect_uri: str | None = None,
                                                                                                    install_path: str = '/slack/install',
                                                                                                    install_page_rendering_enabled: bool = True,
                                                                                                    redirect_uri_path: str = '/slack/oauth_redirect',
                                                                                                    callback_options: CallbackOptions | None = None,
                                                                                                    success_url: str | None = None,
                                                                                                    failure_url: str | None = None,
                                                                                                    authorization_url: str | None = None,
                                                                                                    installation_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore | None = None,
                                                                                                    installation_store_bot_only: bool = False,
                                                                                                    token_rotation_expiration_minutes: int = 120,
                                                                                                    user_token_resolution: str = 'authed_user',
                                                                                                    state_validation_enabled: bool = True,
                                                                                                    state_store: slack_sdk.oauth.state_store.state_store.OAuthStateStore | None = None,
                                                                                                    state_cookie_name: str = 'slack-app-oauth-state',
                                                                                                    state_expiration_seconds: int = 600,
                                                                                                    logger: logging.Logger = <Logger slack_bolt.oauth.oauth_settings (WARNING)>)
                                                                                                    -

                                                                                                    The settings for Slack App installation (OAuth flow).

                                                                                                    -

                                                                                                    Args

                                                                                                    -
                                                                                                    -
                                                                                                    client_id
                                                                                                    -
                                                                                                    Check the value in Settings > Basic Information > App Credentials
                                                                                                    -
                                                                                                    client_secret
                                                                                                    -
                                                                                                    Check the value in Settings > Basic Information > App Credentials
                                                                                                    -
                                                                                                    scopes
                                                                                                    -
                                                                                                    Check the value in Settings > Manage Distribution
                                                                                                    -
                                                                                                    user_scopes
                                                                                                    -
                                                                                                    Check the value in Settings > Manage Distribution
                                                                                                    -
                                                                                                    redirect_uri
                                                                                                    -
                                                                                                    Check the value in Features > OAuth & Permissions > Redirect URLs
                                                                                                    -
                                                                                                    install_path
                                                                                                    -
                                                                                                    The endpoint to start an OAuth flow (Default: /slack/install)
                                                                                                    -
                                                                                                    install_page_rendering_enabled
                                                                                                    -
                                                                                                    Renders a web page for install_path access if True
                                                                                                    -
                                                                                                    redirect_uri_path
                                                                                                    -
                                                                                                    The path of Redirect URL (Default: /slack/oauth_redirect)
                                                                                                    -
                                                                                                    callback_options
                                                                                                    -
                                                                                                    Give success/failure functions f you want to customize callback functions.
                                                                                                    -
                                                                                                    success_url
                                                                                                    -
                                                                                                    Set a complete URL if you want to redirect end-users when an installation completes.
                                                                                                    -
                                                                                                    failure_url
                                                                                                    -
                                                                                                    Set a complete URL if you want to redirect end-users when an installation fails.
                                                                                                    -
                                                                                                    authorization_url
                                                                                                    -
                                                                                                    Set a URL if you want to customize the URL https://slack.com/oauth/v2/authorize
                                                                                                    -
                                                                                                    installation_store
                                                                                                    -
                                                                                                    Specify the instance of InstallationStore (Default: FileInstallationStore)
                                                                                                    -
                                                                                                    installation_store_bot_only
                                                                                                    -
                                                                                                    Use InstallationStore#find_bot() if True (Default: False)
                                                                                                    -
                                                                                                    token_rotation_expiration_minutes
                                                                                                    -
                                                                                                    Minutes before refreshing tokens (Default: 2 hours)
                                                                                                    -
                                                                                                    user_token_resolution
                                                                                                    -
                                                                                                    The option to pick up a user token per request (Default: authed_user) -The available values are "authed_user" and "actor". When you want to resolve the user token per request -using the event's actor IDs, you can set "actor" instead. With this option, bolt-python tries to resolve -a user token for context.actor_enterprise/team/user_id. This can be useful for events in Slack Connect -channels. Note that actor IDs can be absent in some scenarios.
                                                                                                    -
                                                                                                    state_validation_enabled
                                                                                                    -
                                                                                                    Set False if your OAuth flow omits the state parameter validation (Default: True)
                                                                                                    -
                                                                                                    state_store
                                                                                                    -
                                                                                                    Specify the instance of InstallationStore (Default: FileOAuthStateStore)
                                                                                                    -
                                                                                                    state_cookie_name
                                                                                                    -
                                                                                                    The cookie name that is set for installers' browser. (Default: "slack-app-oauth-state")
                                                                                                    -
                                                                                                    state_expiration_seconds
                                                                                                    -
                                                                                                    The seconds that the state value is alive (Default: 600 seconds)
                                                                                                    -
                                                                                                    logger
                                                                                                    -
                                                                                                    The logger that will be used internally
                                                                                                    -
                                                                                                    Expand source code @@ -249,107 +210,157 @@

                                                                                                    Args

                                                                                                    failure_url=self.failure_url, )
                                                                                                    +

                                                                                                    The settings for Slack App installation (OAuth flow).

                                                                                                    +

                                                                                                    Args

                                                                                                    +
                                                                                                    +
                                                                                                    client_id
                                                                                                    +
                                                                                                    Check the value in Settings > Basic Information > App Credentials
                                                                                                    +
                                                                                                    client_secret
                                                                                                    +
                                                                                                    Check the value in Settings > Basic Information > App Credentials
                                                                                                    +
                                                                                                    scopes
                                                                                                    +
                                                                                                    Check the value in Settings > Manage Distribution
                                                                                                    +
                                                                                                    user_scopes
                                                                                                    +
                                                                                                    Check the value in Settings > Manage Distribution
                                                                                                    +
                                                                                                    redirect_uri
                                                                                                    +
                                                                                                    Check the value in Features > OAuth & Permissions > Redirect URLs
                                                                                                    +
                                                                                                    install_path
                                                                                                    +
                                                                                                    The endpoint to start an OAuth flow (Default: /slack/install)
                                                                                                    +
                                                                                                    install_page_rendering_enabled
                                                                                                    +
                                                                                                    Renders a web page for install_path access if True
                                                                                                    +
                                                                                                    redirect_uri_path
                                                                                                    +
                                                                                                    The path of Redirect URL (Default: /slack/oauth_redirect)
                                                                                                    +
                                                                                                    callback_options
                                                                                                    +
                                                                                                    Give success/failure functions f you want to customize callback functions.
                                                                                                    +
                                                                                                    success_url
                                                                                                    +
                                                                                                    Set a complete URL if you want to redirect end-users when an installation completes.
                                                                                                    +
                                                                                                    failure_url
                                                                                                    +
                                                                                                    Set a complete URL if you want to redirect end-users when an installation fails.
                                                                                                    +
                                                                                                    authorization_url
                                                                                                    +
                                                                                                    Set a URL if you want to customize the URL https://slack.com/oauth/v2/authorize
                                                                                                    +
                                                                                                    installation_store
                                                                                                    +
                                                                                                    Specify the instance of InstallationStore (Default: FileInstallationStore)
                                                                                                    +
                                                                                                    installation_store_bot_only
                                                                                                    +
                                                                                                    Use InstallationStore#find_bot() if True (Default: False)
                                                                                                    +
                                                                                                    token_rotation_expiration_minutes
                                                                                                    +
                                                                                                    Minutes before refreshing tokens (Default: 2 hours)
                                                                                                    +
                                                                                                    user_token_resolution
                                                                                                    +
                                                                                                    The option to pick up a user token per request (Default: authed_user) +The available values are "authed_user" and "actor". When you want to resolve the user token per request +using the event's actor IDs, you can set "actor" instead. With this option, bolt-python tries to resolve +a user token for context.actor_enterprise/team/user_id. This can be useful for events in Slack Connect +channels. Note that actor IDs can be absent in some scenarios.
                                                                                                    +
                                                                                                    state_validation_enabled
                                                                                                    +
                                                                                                    Set False if your OAuth flow omits the state parameter validation (Default: True)
                                                                                                    +
                                                                                                    state_store
                                                                                                    +
                                                                                                    Specify the instance of InstallationStore (Default: FileOAuthStateStore)
                                                                                                    +
                                                                                                    state_cookie_name
                                                                                                    +
                                                                                                    The cookie name that is set for installers' browser. (Default: "slack-app-oauth-state")
                                                                                                    +
                                                                                                    state_expiration_seconds
                                                                                                    +
                                                                                                    The seconds that the state value is alive (Default: 600 seconds)
                                                                                                    +
                                                                                                    logger
                                                                                                    +
                                                                                                    The logger that will be used internally
                                                                                                    +

                                                                                                    Class variables

                                                                                                    var authorization_url : str
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var authorizeAuthorize
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var authorize_url_generator : slack_sdk.oauth.authorize_url_generator.AuthorizeUrlGenerator
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var callback_optionsCallbackOptions | None
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var client_id : str
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var client_secret : str
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var failure_url : str | None
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var install_page_rendering_enabled : bool
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var install_path : str
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var installation_store : slack_sdk.oauth.installation_store.installation_store.InstallationStore
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var installation_store_bot_only : bool
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var logger : logging.Logger
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var redirect_uri : str | None
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var redirect_uri_page_renderer : slack_sdk.oauth.redirect_uri_page_renderer.RedirectUriPageRenderer
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var redirect_uri_path : str
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var scopes : Sequence[str] | None
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var state_expiration_seconds : int
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var state_store : slack_sdk.oauth.state_store.state_store.OAuthStateStore
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var state_utils : slack_sdk.oauth.state_utils.OAuthStateUtils
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var state_validation_enabled : bool
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var success_url : str | None
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var token_rotation_expiration_minutes : int
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var user_scopes : Sequence[str] | None
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    var user_token_resolution : str
                                                                                                    -
                                                                                                    +

                                                                                                    The type of the None singleton.

                                                                                                    @@ -404,7 +415,7 @@

                                                                                                    -

                                                                                                    Generated by pdoc 0.11.3.

                                                                                                    +

                                                                                                    Generated by pdoc 0.11.5.

                                                                                                    diff --git a/docs/static/api-docs/slack_bolt/request/async_internals.html b/docs/static/api-docs/slack_bolt/request/async_internals.html index 6e0e4063..635bdf58 100644 --- a/docs/static/api-docs/slack_bolt/request/async_internals.html +++ b/docs/static/api-docs/slack_bolt/request/async_internals.html @@ -3,19 +3,30 @@ - + slack_bolt.request.async_internals API documentation - + @@ -37,6 +48,61 @@

                                                                                                    Functions

                                                                                                    def build_async_context(context: AsyncBoltContext,
                                                                                                    body: Dict[str, Any]) ‑> AsyncBoltContext
                                                                                                    +
                                                                                                    + +Expand source code + +
                                                                                                    def build_async_context(
                                                                                                    +    context: AsyncBoltContext,
                                                                                                    +    body: Dict[str, Any],
                                                                                                    +) -> AsyncBoltContext:
                                                                                                    +    context["is_enterprise_install"] = extract_is_enterprise_install(body)
                                                                                                    +    enterprise_id = extract_enterprise_id(body)
                                                                                                    +    if enterprise_id:
                                                                                                    +        context["enterprise_id"] = enterprise_id
                                                                                                    +    team_id = extract_team_id(body)
                                                                                                    +    if team_id:
                                                                                                    +        context["team_id"] = team_id
                                                                                                    +    user_id = extract_user_id(body)
                                                                                                    +    if user_id:
                                                                                                    +        context["user_id"] = user_id
                                                                                                    +    # Actor IDs are useful for Events API on a Slack Connect channel
                                                                                                    +    actor_enterprise_id = extract_actor_enterprise_id(body)
                                                                                                    +    if actor_enterprise_id:
                                                                                                    +        context["actor_enterprise_id"] = actor_enterprise_id
                                                                                                    +    actor_team_id = extract_actor_team_id(body)
                                                                                                    +    if actor_team_id:
                                                                                                    +        context["actor_team_id"] = actor_team_id
                                                                                                    +    actor_user_id = extract_actor_user_id(body)
                                                                                                    +    if actor_user_id:
                                                                                                    +        context["actor_user_id"] = actor_user_id
                                                                                                    +    channel_id = extract_channel_id(body)
                                                                                                    +    if channel_id:
                                                                                                    +        context["channel_id"] = channel_id
                                                                                                    +    thread_ts = extract_thread_ts(body)
                                                                                                    +    if thread_ts:
                                                                                                    +        context["thread_ts"] = thread_ts
                                                                                                    +    function_execution_id = extract_function_execution_id(body)
                                                                                                    +    if function_execution_id:
                                                                                                    +        context["function_execution_id"] = function_execution_id
                                                                                                    +        function_bot_access_token = extract_function_bot_access_token(body)
                                                                                                    +        if function_bot_access_token is not None:
                                                                                                    +            context["function_bot_access_token"] = function_bot_access_token
                                                                                                    +        function_inputs = extract_function_inputs(body)
                                                                                                    +        if function_inputs is not None:
                                                                                                    +            context["inputs"] = function_inputs
                                                                                                    +    if "response_url" in body:
                                                                                                    +        context["response_url"] = body["response_url"]
                                                                                                    +    elif "response_urls" in body:
                                                                                                    +        # In the case where response_url_enabled: true in a modal exists
                                                                                                    +        response_urls = body["response_urls"]
                                                                                                    +        if len(response_urls) >= 1:
                                                                                                    +            if len(response_urls) > 1:
                                                                                                    +                context.logger.debug(debug_multiple_response_urls_detected())
                                                                                                    +            response_url = response_urls[0].get("response_url")
                                                                                                    +            context["response_url"] = response_url
                                                                                                    +    return context
                                                                                                    +

                                                                                                  @@ -63,7 +129,7 @@

                                                                                                  Functions

                                                                                                  diff --git a/docs/static/api-docs/slack_bolt/request/async_request.html b/docs/static/api-docs/slack_bolt/request/async_request.html index f6b64207..c08c47ec 100644 --- a/docs/static/api-docs/slack_bolt/request/async_request.html +++ b/docs/static/api-docs/slack_bolt/request/async_request.html @@ -3,19 +3,30 @@ - + slack_bolt.request.async_request API documentation - + @@ -40,20 +51,6 @@

                                                                                                  Classes

                                                                                                  (*,
                                                                                                  body: str | dict,
                                                                                                  query: str | Dict[str, str] | Dict[str, Sequence[str]] | None = None,
                                                                                                  headers: Dict[str, str | Sequence[str]] | None = None,
                                                                                                  context: Dict[str, Any] | None = None,
                                                                                                  mode: str = 'http')
                                                                                                  -

                                                                                                  Request to a Bolt app.

                                                                                                  -

                                                                                                  Args

                                                                                                  -
                                                                                                  -
                                                                                                  body
                                                                                                  -
                                                                                                  The raw request body (only plain text is supported for "http" mode)
                                                                                                  -
                                                                                                  query
                                                                                                  -
                                                                                                  The query string data in any data format.
                                                                                                  -
                                                                                                  headers
                                                                                                  -
                                                                                                  The request headers.
                                                                                                  -
                                                                                                  context
                                                                                                  -
                                                                                                  The context in this request.
                                                                                                  -
                                                                                                  mode
                                                                                                  -
                                                                                                  The mode used for this request. (either "http" or "socket_mode")
                                                                                                  -
                                                                                                  Expand source code @@ -128,43 +125,57 @@

                                                                                                  Args

                                                                                                  mode=self.mode, )
                                                                                                  +

                                                                                                  Request to a Bolt app.

                                                                                                  +

                                                                                                  Args

                                                                                                  +
                                                                                                  +
                                                                                                  body
                                                                                                  +
                                                                                                  The raw request body (only plain text is supported for "http" mode)
                                                                                                  +
                                                                                                  query
                                                                                                  +
                                                                                                  The query string data in any data format.
                                                                                                  +
                                                                                                  headers
                                                                                                  +
                                                                                                  The request headers.
                                                                                                  +
                                                                                                  context
                                                                                                  +
                                                                                                  The context in this request.
                                                                                                  +
                                                                                                  mode
                                                                                                  +
                                                                                                  The mode used for this request. (either "http" or "socket_mode")
                                                                                                  +

                                                                                                  Class variables

                                                                                                  var body : Dict[str, Any]
                                                                                                  -
                                                                                                  +

                                                                                                  The type of the None singleton.

                                                                                                  var content_type : str | None
                                                                                                  -
                                                                                                  +

                                                                                                  The type of the None singleton.

                                                                                                  var contextAsyncBoltContext
                                                                                                  -
                                                                                                  +

                                                                                                  The type of the None singleton.

                                                                                                  var headers : Dict[str, Sequence[str]]
                                                                                                  -
                                                                                                  +

                                                                                                  The type of the None singleton.

                                                                                                  var lazy_function_name : str | None
                                                                                                  -
                                                                                                  +

                                                                                                  The type of the None singleton.

                                                                                                  var lazy_only : bool
                                                                                                  -
                                                                                                  +

                                                                                                  The type of the None singleton.

                                                                                                  var mode : str
                                                                                                  -
                                                                                                  +

                                                                                                  The type of the None singleton.

                                                                                                  var query : Dict[str, Sequence[str]]
                                                                                                  -
                                                                                                  +

                                                                                                  The type of the None singleton.

                                                                                                  var raw_body : str
                                                                                                  -
                                                                                                  +

                                                                                                  The type of the None singleton.

                                                                                                  Methods

                                                                                                  @@ -173,6 +184,20 @@

                                                                                                  Methods

                                                                                                  def to_copyable(self) ‑> AsyncBoltRequest
                                                                                                  +
                                                                                                  + +Expand source code + +
                                                                                                  def to_copyable(self) -> "AsyncBoltRequest":
                                                                                                  +    body: Union[str, dict] = self.raw_body if self.mode == "http" else self.body
                                                                                                  +    return AsyncBoltRequest(
                                                                                                  +        body=body,
                                                                                                  +        query=self.query,
                                                                                                  +        headers=self.headers,
                                                                                                  +        context=self.context.to_copyable(),
                                                                                                  +        mode=self.mode,
                                                                                                  +    )
                                                                                                  +

                                                                                              @@ -213,7 +238,7 @@

                                                                                              -

                                                                                              Generated by pdoc 0.11.3.

                                                                                              +

                                                                                              Generated by pdoc 0.11.5.

                                                                                              diff --git a/docs/static/api-docs/slack_bolt/request/index.html b/docs/static/api-docs/slack_bolt/request/index.html index a72b8d66..8e00109c 100644 --- a/docs/static/api-docs/slack_bolt/request/index.html +++ b/docs/static/api-docs/slack_bolt/request/index.html @@ -3,19 +3,30 @@ - + slack_bolt.request API documentation - + @@ -66,20 +77,6 @@

                                                                                              Classes

                                                                                              (*,
                                                                                              body: str | dict,
                                                                                              query: str | Dict[str, str] | Dict[str, Sequence[str]] | None = None,
                                                                                              headers: Dict[str, str | Sequence[str]] | None = None,
                                                                                              context: Dict[str, Any] | None = None,
                                                                                              mode: str = 'http')
                                                                                              -

                                                                                              Request to a Bolt app.

                                                                                              -

                                                                                              Args

                                                                                              -
                                                                                              -
                                                                                              body
                                                                                              -
                                                                                              The raw request body (only plain text is supported for "http" mode)
                                                                                              -
                                                                                              query
                                                                                              -
                                                                                              The query string data in any data format.
                                                                                              -
                                                                                              headers
                                                                                              -
                                                                                              The request headers.
                                                                                              -
                                                                                              context
                                                                                              -
                                                                                              The context in this request.
                                                                                              -
                                                                                              mode
                                                                                              -
                                                                                              The mode used for this request. (either "http" or "socket_mode")
                                                                                              -
                                                                                              Expand source code @@ -153,43 +150,57 @@

                                                                                              Args

                                                                                              mode=self.mode, )
                                                                                              +

                                                                                              Request to a Bolt app.

                                                                                              +

                                                                                              Args

                                                                                              +
                                                                                              +
                                                                                              body
                                                                                              +
                                                                                              The raw request body (only plain text is supported for "http" mode)
                                                                                              +
                                                                                              query
                                                                                              +
                                                                                              The query string data in any data format.
                                                                                              +
                                                                                              headers
                                                                                              +
                                                                                              The request headers.
                                                                                              +
                                                                                              context
                                                                                              +
                                                                                              The context in this request.
                                                                                              +
                                                                                              mode
                                                                                              +
                                                                                              The mode used for this request. (either "http" or "socket_mode")
                                                                                              +

                                                                                              Class variables

                                                                                              var body : Dict[str, Any]
                                                                                              -
                                                                                              +

                                                                                              The type of the None singleton.

                                                                                              var content_type : str | None
                                                                                              -
                                                                                              +

                                                                                              The type of the None singleton.

                                                                                              var contextBoltContext
                                                                                              -
                                                                                              +

                                                                                              The type of the None singleton.

                                                                                              var headers : Dict[str, Sequence[str]]
                                                                                              -
                                                                                              +

                                                                                              The type of the None singleton.

                                                                                              var lazy_function_name : str | None
                                                                                              -
                                                                                              +

                                                                                              The type of the None singleton.

                                                                                              var lazy_only : bool
                                                                                              -
                                                                                              +

                                                                                              The type of the None singleton.

                                                                                              var mode : str
                                                                                              -
                                                                                              +

                                                                                              The type of the None singleton.

                                                                                              var query : Dict[str, Sequence[str]]
                                                                                              -
                                                                                              +

                                                                                              The type of the None singleton.

                                                                                              var raw_body : str
                                                                                              -
                                                                                              +

                                                                                              The type of the None singleton.

                                                                                              Methods

                                                                                              @@ -198,6 +209,20 @@

                                                                                              Methods

                                                                                              def to_copyable(self) ‑> BoltRequest
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def to_copyable(self) -> "BoltRequest":
                                                                                              +    body: Union[str, dict] = self.raw_body if self.mode == "http" else self.body
                                                                                              +    return BoltRequest(
                                                                                              +        body=body,
                                                                                              +        query=self.query,
                                                                                              +        headers=self.headers,
                                                                                              +        context=self.context.to_copyable(),
                                                                                              +        mode=self.mode,
                                                                                              +    )
                                                                                              +

                                                                                              @@ -247,7 +272,7 @@

                                                                                              -

                                                                                              Generated by pdoc 0.11.3.

                                                                                              +

                                                                                              Generated by pdoc 0.11.5.

                                                                                              diff --git a/docs/static/api-docs/slack_bolt/request/internals.html b/docs/static/api-docs/slack_bolt/request/internals.html index 70befd5b..68fa34da 100644 --- a/docs/static/api-docs/slack_bolt/request/internals.html +++ b/docs/static/api-docs/slack_bolt/request/internals.html @@ -3,19 +3,30 @@ - + slack_bolt.request.internals API documentation - + @@ -37,114 +48,515 @@

                                                                                              Functions

                                                                                              def build_context(context: BoltContext,
                                                                                              body: Dict[str, Any]) ‑> BoltContext
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def build_context(context: BoltContext, body: Dict[str, Any]) -> BoltContext:
                                                                                              +    context["is_enterprise_install"] = extract_is_enterprise_install(body)
                                                                                              +    enterprise_id = extract_enterprise_id(body)
                                                                                              +    if enterprise_id:
                                                                                              +        context["enterprise_id"] = enterprise_id
                                                                                              +    team_id = extract_team_id(body)
                                                                                              +    if team_id:
                                                                                              +        context["team_id"] = team_id
                                                                                              +    user_id = extract_user_id(body)
                                                                                              +    if user_id:
                                                                                              +        context["user_id"] = user_id
                                                                                              +    # Actor IDs are useful for Events API on a Slack Connect channel
                                                                                              +    actor_enterprise_id = extract_actor_enterprise_id(body)
                                                                                              +    if actor_enterprise_id:
                                                                                              +        context["actor_enterprise_id"] = actor_enterprise_id
                                                                                              +    actor_team_id = extract_actor_team_id(body)
                                                                                              +    if actor_team_id:
                                                                                              +        context["actor_team_id"] = actor_team_id
                                                                                              +    actor_user_id = extract_actor_user_id(body)
                                                                                              +    if actor_user_id:
                                                                                              +        context["actor_user_id"] = actor_user_id
                                                                                              +    channel_id = extract_channel_id(body)
                                                                                              +    if channel_id:
                                                                                              +        context["channel_id"] = channel_id
                                                                                              +    thread_ts = extract_thread_ts(body)
                                                                                              +    if thread_ts:
                                                                                              +        context["thread_ts"] = thread_ts
                                                                                              +    function_execution_id = extract_function_execution_id(body)
                                                                                              +    if function_execution_id is not None:
                                                                                              +        context["function_execution_id"] = function_execution_id
                                                                                              +        function_bot_access_token = extract_function_bot_access_token(body)
                                                                                              +        if function_bot_access_token is not None:
                                                                                              +            context["function_bot_access_token"] = function_bot_access_token
                                                                                              +        inputs = extract_function_inputs(body)
                                                                                              +        if inputs is not None:
                                                                                              +            context["inputs"] = inputs
                                                                                              +    if "response_url" in body:
                                                                                              +        context["response_url"] = body["response_url"]
                                                                                              +    elif "response_urls" in body:
                                                                                              +        # In the case where response_url_enabled: true in a modal exists
                                                                                              +        response_urls = body["response_urls"]
                                                                                              +        if len(response_urls) >= 1:
                                                                                              +            if len(response_urls) > 1:
                                                                                              +                context.logger.debug(debug_multiple_response_urls_detected())
                                                                                              +            response_url = response_urls[0].get("response_url")
                                                                                              +            context["response_url"] = response_url
                                                                                              +    return context
                                                                                              +
                                                                                              def build_normalized_headers(headers: Dict[str, str | Sequence[str]] | None) ‑> Dict[str, Sequence[str]]
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def build_normalized_headers(headers: Optional[Dict[str, Union[str, Sequence[str]]]]) -> Dict[str, Sequence[str]]:
                                                                                              +    normalized_headers: Dict[str, Sequence[str]] = {}
                                                                                              +    if headers is not None:
                                                                                              +        for key, value in headers.items():
                                                                                              +            normalized_name = key.lower()
                                                                                              +            if isinstance(value, list):
                                                                                              +                normalized_headers[normalized_name] = value
                                                                                              +            elif isinstance(value, str):
                                                                                              +                normalized_headers[normalized_name] = [value]
                                                                                              +            else:
                                                                                              +                raise ValueError(f"Unsupported type ({type(value)}) of element in headers ({headers})")
                                                                                              +    return normalized_headers
                                                                                              +
                                                                                              def debug_multiple_response_urls_detected() ‑> str
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def debug_multiple_response_urls_detected() -> str:
                                                                                              +    return (
                                                                                              +        "`response_urls` in the body has multiple URLs in it. "
                                                                                              +        "If you would like to use non-primary one, "
                                                                                              +        "please manually extract the one from body['response_urls']."
                                                                                              +    )
                                                                                              +
                                                                                              def error_message_raw_body_required_in_http_mode() ‑> str
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def error_message_raw_body_required_in_http_mode() -> str:
                                                                                              +    return "`body` must be a raw string data when running in the HTTP server mode"
                                                                                              +
                                                                                              def extract_actor_enterprise_id(payload: Dict[str, Any]) ‑> str | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_actor_enterprise_id(payload: Dict[str, Any]) -> Optional[str]:
                                                                                              +    if payload.get("is_ext_shared_channel") is True:
                                                                                              +        if payload.get("type") == "event_callback":
                                                                                              +            # For safety, we don't set actor IDs for the events like "file_shared",
                                                                                              +            # which do not provide any team ID in $.event data. In the case, the IDs cannot be correct.
                                                                                              +            event_team_id = payload.get("event", {}).get("user_team") or payload.get("event", {}).get("team")
                                                                                              +            if event_team_id is not None and str(event_team_id).startswith("E"):
                                                                                              +                return event_team_id
                                                                                              +            if event_team_id == payload.get("team_id"):
                                                                                              +                return payload.get("enterprise_id")
                                                                                              +            return None
                                                                                              +    return extract_enterprise_id(payload)
                                                                                              +
                                                                                              def extract_actor_team_id(payload: Dict[str, Any]) ‑> str | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_actor_team_id(payload: Dict[str, Any]) -> Optional[str]:
                                                                                              +    if payload.get("is_ext_shared_channel") is True:
                                                                                              +        if payload.get("type") == "event_callback":
                                                                                              +            event_type = payload.get("event", {}).get("type")
                                                                                              +            if event_type == "app_mention":
                                                                                              +                # The $.event.user_team can be an enterprise_id in app_mention events.
                                                                                              +                # In the scenario, there is no way to retrieve actor_team_id as of March 2023
                                                                                              +                user_team = payload.get("event", {}).get("user_team")
                                                                                              +                if user_team is None:
                                                                                              +                    # working with an app installed in this user's org/workspace side
                                                                                              +                    return payload.get("event", {}).get("team")
                                                                                              +                if str(user_team).startswith("T"):
                                                                                              +                    # interacting from a connected non-grid workspace
                                                                                              +                    return user_team
                                                                                              +                # Interacting from a connected grid workspace; in this case, team_id cannot be resolved as of March 2023
                                                                                              +                return None
                                                                                              +            # For safety, we don't set actor IDs for the events like "file_shared",
                                                                                              +            # which do not provide any team ID in $.event data. In the case, the IDs cannot be correct.
                                                                                              +            event_user_team = payload.get("event", {}).get("user_team")
                                                                                              +            if event_user_team is not None:
                                                                                              +                if str(event_user_team).startswith("T"):
                                                                                              +                    return event_user_team
                                                                                              +                elif str(event_user_team).startswith("E"):
                                                                                              +                    if event_user_team == payload.get("enterprise_id"):
                                                                                              +                        return payload.get("team_id")
                                                                                              +                    elif event_user_team == payload.get("context_enterprise_id"):
                                                                                              +                        return payload.get("context_team_id")
                                                                                              +
                                                                                              +            event_team = payload.get("event", {}).get("team")
                                                                                              +            if event_team is not None:
                                                                                              +                if str(event_team).startswith("T"):
                                                                                              +                    return event_team
                                                                                              +                elif str(event_team).startswith("E"):
                                                                                              +                    if event_team == payload.get("enterprise_id"):
                                                                                              +                        return payload.get("team_id")
                                                                                              +                    elif event_team == payload.get("context_enterprise_id"):
                                                                                              +                        return payload.get("context_team_id")
                                                                                              +            return None
                                                                                              +
                                                                                              +    return extract_team_id(payload)
                                                                                              +
                                                                                              def extract_actor_user_id(payload: Dict[str, Any]) ‑> str | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_actor_user_id(payload: Dict[str, Any]) -> Optional[str]:
                                                                                              +    if payload.get("is_ext_shared_channel") is True:
                                                                                              +        if payload.get("type") == "event_callback":
                                                                                              +            event = payload.get("event")
                                                                                              +            if event is None:
                                                                                              +                return None
                                                                                              +            if extract_actor_enterprise_id(payload) is None and extract_actor_team_id(payload) is None:
                                                                                              +                # When both enterprise_id and team_id are not identified, we skip returning user_id too for safety
                                                                                              +                return None
                                                                                              +            return event.get("user") or event.get("user_id")
                                                                                              +    return extract_user_id(payload)
                                                                                              +
                                                                                              def extract_channel_id(payload: Dict[str, Any]) ‑> str | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_channel_id(payload: Dict[str, Any]) -> Optional[str]:
                                                                                              +    channel = payload.get("channel")
                                                                                              +    if channel is not None:
                                                                                              +        if isinstance(channel, str):
                                                                                              +            return channel
                                                                                              +        elif "id" in channel:
                                                                                              +            return channel.get("id")
                                                                                              +    if "channel_id" in payload:
                                                                                              +        return payload.get("channel_id")
                                                                                              +    if payload.get("event") is not None:
                                                                                              +        return extract_channel_id(payload["event"])
                                                                                              +    if payload.get("item") is not None:
                                                                                              +        # reaction_added: body["event"]["item"]
                                                                                              +        return extract_channel_id(payload["item"])
                                                                                              +    if payload.get("assistant_thread") is not None:
                                                                                              +        # assistant_thread_started
                                                                                              +        return extract_channel_id(payload["assistant_thread"])
                                                                                              +    return None
                                                                                              +
                                                                                              def extract_content_type(headers: Dict[str, Sequence[str]]) ‑> str | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_content_type(headers: Dict[str, Sequence[str]]) -> Optional[str]:
                                                                                              +    content_type: Optional[str] = headers.get("content-type", [None])[0]
                                                                                              +    if content_type:
                                                                                              +        return content_type.split(";")[0]
                                                                                              +    return None
                                                                                              +
                                                                                              def extract_enterprise_id(payload: Dict[str, Any]) ‑> str | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_enterprise_id(payload: Dict[str, Any]) -> Optional[str]:
                                                                                              +    org = payload.get("enterprise")
                                                                                              +    if org is not None:
                                                                                              +        if isinstance(org, str):
                                                                                              +            return org
                                                                                              +        elif "id" in org:
                                                                                              +            return org.get("id")
                                                                                              +    if payload.get("authorizations") is not None and len(payload["authorizations"]) > 0:
                                                                                              +        # To make Events API handling functioning also for shared channels,
                                                                                              +        # we should use .authorizations[0].enterprise_id over .enterprise_id
                                                                                              +        return extract_enterprise_id(payload["authorizations"][0])
                                                                                              +    if "enterprise_id" in payload:
                                                                                              +        return payload.get("enterprise_id")
                                                                                              +    if payload.get("team") is not None and "enterprise_id" in payload["team"]:
                                                                                              +        # In the case where the type is view_submission
                                                                                              +        return payload["team"].get("enterprise_id")
                                                                                              +    if payload.get("event") is not None:
                                                                                              +        return extract_enterprise_id(payload["event"])
                                                                                              +    return None
                                                                                              +
                                                                                              def extract_function_bot_access_token(payload: Dict[str, Any]) ‑> str | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_function_bot_access_token(payload: Dict[str, Any]) -> Optional[str]:
                                                                                              +    if payload.get("bot_access_token") is not None:
                                                                                              +        return payload.get("bot_access_token")
                                                                                              +    if payload.get("event") is not None:
                                                                                              +        return payload["event"].get("bot_access_token")
                                                                                              +    return None
                                                                                              +
                                                                                              def extract_function_execution_id(payload: Dict[str, Any]) ‑> str | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_function_execution_id(payload: Dict[str, Any]) -> Optional[str]:
                                                                                              +    if payload.get("function_execution_id") is not None:
                                                                                              +        return payload.get("function_execution_id")
                                                                                              +    if payload.get("event") is not None:
                                                                                              +        return extract_function_execution_id(payload["event"])
                                                                                              +    if payload.get("function_data") is not None:
                                                                                              +        return payload["function_data"].get("execution_id")
                                                                                              +    return None
                                                                                              +
                                                                                              def extract_function_inputs(payload: Dict[str, Any]) ‑> Dict[str, Any] | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_function_inputs(payload: Dict[str, Any]) -> Optional[Dict[str, Any]]:
                                                                                              +    if payload.get("event") is not None:
                                                                                              +        return payload["event"].get("inputs")
                                                                                              +    if payload.get("function_data") is not None:
                                                                                              +        return payload["function_data"].get("inputs")
                                                                                              +    return None
                                                                                              +
                                                                                              def extract_is_enterprise_install(payload: Dict[str, Any]) ‑> bool | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_is_enterprise_install(payload: Dict[str, Any]) -> Optional[bool]:
                                                                                              +    if payload.get("authorizations") is not None and len(payload["authorizations"]) > 0:
                                                                                              +        # To make Events API handling functioning also for shared channels,
                                                                                              +        # we should use .authorizations[0].is_enterprise_install over .is_enterprise_install
                                                                                              +        return extract_is_enterprise_install(payload["authorizations"][0])
                                                                                              +    if "is_enterprise_install" in payload:
                                                                                              +        is_enterprise_install = payload.get("is_enterprise_install")
                                                                                              +        return is_enterprise_install is not None and (is_enterprise_install is True or is_enterprise_install == "true")
                                                                                              +    return False
                                                                                              +
                                                                                              def extract_team_id(payload: Dict[str, Any]) ‑> str | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_team_id(payload: Dict[str, Any]) -> Optional[str]:
                                                                                              +    app_installed_team_id = payload.get("view", {}).get("app_installed_team_id")
                                                                                              +    if app_installed_team_id is not None:
                                                                                              +        # view_submission payloads can have `view.app_installed_team_id` when a modal view that was opened
                                                                                              +        # in a different workspace via some operations inside a Slack Connect channel.
                                                                                              +        # Note that the same for enterprise_id does not exist. When you need to know the enterprise_id as well,
                                                                                              +        # you have to run some query toward your InstallationStore to know the org where the team_id belongs to.
                                                                                              +        return app_installed_team_id
                                                                                              +    if payload.get("team") is not None:
                                                                                              +        # With org-wide installations, payload.team in interactivity payloads can be None
                                                                                              +        # You need to extract either payload.user.team_id or payload.view.team_id as below
                                                                                              +        team = payload.get("team")
                                                                                              +        if isinstance(team, str):
                                                                                              +            return team
                                                                                              +        elif team and "id" in team:
                                                                                              +            return team.get("id")
                                                                                              +    if payload.get("authorizations") is not None and len(payload["authorizations"]) > 0:
                                                                                              +        # To make Events API handling functioning also for shared channels,
                                                                                              +        # we should use .authorizations[0].team_id over .team_id
                                                                                              +        return extract_team_id(payload["authorizations"][0])
                                                                                              +    if "team_id" in payload:
                                                                                              +        return payload.get("team_id")
                                                                                              +    if payload.get("event") is not None:
                                                                                              +        return extract_team_id(payload["event"])
                                                                                              +    if payload.get("user") is not None:
                                                                                              +        return payload["user"]["team_id"]
                                                                                              +    if payload.get("view") is not None:
                                                                                              +        return payload.get("view", {})["team_id"]
                                                                                              +    return None
                                                                                              +
                                                                                              def extract_thread_ts(payload: Dict[str, Any]) ‑> str | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_thread_ts(payload: Dict[str, Any]) -> Optional[str]:
                                                                                              +    # This utility initially supports only the use cases for AI assistants, but it may be fine to add more patterns.
                                                                                              +    # That said, note that thread_ts is always required for assistant threads, but it's not for channels.
                                                                                              +    # Thus, blindly setting this thread_ts to say utility can break existing apps' behaviors.
                                                                                              +    if is_assistant_event(payload):
                                                                                              +        event = payload["event"]
                                                                                              +        if (
                                                                                              +            event.get("assistant_thread") is not None
                                                                                              +            and event["assistant_thread"].get("channel_id") is not None
                                                                                              +            and event["assistant_thread"].get("thread_ts") is not None
                                                                                              +        ):
                                                                                              +            # assistant_thread_started, assistant_thread_context_changed
                                                                                              +            # "assistant_thread" property can exist for message event without channel_id and thread_ts
                                                                                              +            # Thus, the above if check verifies these properties exist
                                                                                              +            return event["assistant_thread"]["thread_ts"]
                                                                                              +        elif event.get("channel") is not None:
                                                                                              +            if event.get("thread_ts") is not None:
                                                                                              +                # message in an assistant thread
                                                                                              +                return event["thread_ts"]
                                                                                              +            elif event.get("message", {}).get("thread_ts") is not None:
                                                                                              +                # message_changed
                                                                                              +                return event["message"]["thread_ts"]
                                                                                              +            elif event.get("previous_message", {}).get("thread_ts") is not None:
                                                                                              +                # message_deleted
                                                                                              +                return event["previous_message"]["thread_ts"]
                                                                                              +    return None
                                                                                              +
                                                                                              def extract_user_id(payload: Dict[str, Any]) ‑> str | None
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def extract_user_id(payload: Dict[str, Any]) -> Optional[str]:
                                                                                              +    user = payload.get("user")
                                                                                              +    if user is not None:
                                                                                              +        if isinstance(user, str):
                                                                                              +            return user
                                                                                              +        elif "id" in user:
                                                                                              +            return user.get("id")
                                                                                              +    if "user_id" in payload:
                                                                                              +        return payload.get("user_id")
                                                                                              +    if payload.get("event") is not None:
                                                                                              +        return extract_user_id(payload["event"])
                                                                                              +    if payload.get("message") is not None:
                                                                                              +        # message_changed: body["event"]["message"]
                                                                                              +        return extract_user_id(payload["message"])
                                                                                              +    if payload.get("previous_message") is not None:
                                                                                              +        # message_deleted: body["event"]["previous_message"]
                                                                                              +        return extract_user_id(payload["previous_message"])
                                                                                              +    return None
                                                                                              +
                                                                                              def parse_body(body: str, content_type: str | None) ‑> Dict[str, Any]
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def parse_body(body: str, content_type: Optional[str]) -> Dict[str, Any]:
                                                                                              +    if not body:
                                                                                              +        return {}
                                                                                              +    if (content_type is not None and content_type == "application/json") or body.startswith("{"):
                                                                                              +        return json.loads(body)
                                                                                              +    else:
                                                                                              +        if "payload" in body:  # This is not JSON format yet
                                                                                              +            params = dict(parse_qsl(body, keep_blank_values=True))
                                                                                              +            payload = params.get("payload")
                                                                                              +            if payload is not None:
                                                                                              +                return json.loads(payload)
                                                                                              +            else:
                                                                                              +                return {}
                                                                                              +        else:
                                                                                              +            return dict(parse_qsl(body, keep_blank_values=True))
                                                                                              +
                                                                                              def parse_query(query: str | Dict[str, str] | Dict[str, Sequence[str]] | None) ‑> Dict[str, Sequence[str]]
                                                                                              +
                                                                                              + +Expand source code + +
                                                                                              def parse_query(query: Optional[Union[str, Dict[str, str], Dict[str, Sequence[str]]]]) -> Dict[str, Sequence[str]]:
                                                                                              +    if query is None:
                                                                                              +        return {}
                                                                                              +    elif isinstance(query, str):
                                                                                              +        return dict(parse_qs(query, keep_blank_values=True))
                                                                                              +    elif isinstance(query, dict) or hasattr(query, "items"):
                                                                                              +        result: Dict[str, Sequence[str]] = {}
                                                                                              +        for name, value in query.items():
                                                                                              +            if isinstance(value, list):
                                                                                              +                result[name] = value
                                                                                              +            elif isinstance(value, str):
                                                                                              +                result[name] = [value]
                                                                                              +            else:
                                                                                              +                raise ValueError(f"Unsupported type ({type(value)}) of element in headers ({query})")
                                                                                              +        return result
                                                                                              +    else:
                                                                                              +        raise ValueError(f"Unsupported type of query detected ({type(query)})")
                                                                                              +

                                                                                            @@ -189,7 +601,7 @@

                                                                                            Functions

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/request/payload_utils.html b/docs/static/api-docs/slack_bolt/request/payload_utils.html index cb6ba9b7..21490bdc 100644 --- a/docs/static/api-docs/slack_bolt/request/payload_utils.html +++ b/docs/static/api-docs/slack_bolt/request/payload_utils.html @@ -3,19 +3,30 @@ - + slack_bolt.request.payload_utils API documentation - + @@ -37,210 +48,520 @@

                                                                                            Functions

                                                                                            def is_action(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_action(body: Dict[str, Any]) -> bool:
                                                                                            +    return (
                                                                                            +        is_attachment_action(body)
                                                                                            +        or is_block_actions(body)
                                                                                            +        or is_dialog_submission(body)
                                                                                            +        or is_dialog_cancellation(body)
                                                                                            +        or is_workflow_step_edit(body)
                                                                                            +    )
                                                                                            +
                                                                                            def is_assistant_event(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_assistant_event(body: Dict[str, Any]) -> bool:
                                                                                            +    return is_event(body) and (
                                                                                            +        is_assistant_thread_started_event(body)
                                                                                            +        or is_assistant_thread_context_changed_event(body)
                                                                                            +        or is_user_message_event_in_assistant_thread(body)
                                                                                            +        or is_bot_message_event_in_assistant_thread(body)
                                                                                            +    )
                                                                                            +
                                                                                            def is_assistant_thread_context_changed_event(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_assistant_thread_context_changed_event(body: Dict[str, Any]) -> bool:
                                                                                            +    if is_event(body):
                                                                                            +        return body["event"]["type"] == "assistant_thread_context_changed"
                                                                                            +    return False
                                                                                            +
                                                                                            def is_assistant_thread_started_event(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_assistant_thread_started_event(body: Dict[str, Any]) -> bool:
                                                                                            +    if is_event(body):
                                                                                            +        return body["event"]["type"] == "assistant_thread_started"
                                                                                            +    return False
                                                                                            +
                                                                                            def is_attachment_action(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_attachment_action(body: Dict[str, Any]) -> bool:
                                                                                            +    return body is not None and _is_expected_type(body, "interactive_message") and "callback_id" in body
                                                                                            +
                                                                                            def is_block_actions(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_block_actions(body: Dict[str, Any]) -> bool:
                                                                                            +    return body is not None and _is_expected_type(body, "block_actions") and "actions" in body
                                                                                            +
                                                                                            def is_block_suggestion(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_block_suggestion(body: Dict[str, Any]) -> bool:
                                                                                            +    return body is not None and _is_expected_type(body, "block_suggestion") and "action_id" in body
                                                                                            +
                                                                                            def is_bot_message_event_in_assistant_thread(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_bot_message_event_in_assistant_thread(body: Dict[str, Any]) -> bool:
                                                                                            +    if is_event(body):
                                                                                            +        return (
                                                                                            +            is_message_event_in_assistant_thread(body)
                                                                                            +            and body["event"].get("subtype") is None
                                                                                            +            and body["event"].get("thread_ts") is not None
                                                                                            +            and body["event"].get("bot_id") is not None
                                                                                            +        )
                                                                                            +    return False
                                                                                            +
                                                                                            def is_dialog_cancellation(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_dialog_cancellation(body: Dict[str, Any]) -> bool:
                                                                                            +    return body is not None and _is_expected_type(body, "dialog_cancellation") and "callback_id" in body
                                                                                            +
                                                                                            def is_dialog_submission(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_dialog_submission(body: Dict[str, Any]) -> bool:
                                                                                            +    return body is not None and _is_expected_type(body, "dialog_submission") and "callback_id" in body
                                                                                            +
                                                                                            def is_dialog_suggestion(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_dialog_suggestion(body: Dict[str, Any]) -> bool:
                                                                                            +    return body is not None and _is_expected_type(body, "dialog_suggestion") and "callback_id" in body
                                                                                            +
                                                                                            def is_event(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_event(body: Dict[str, Any]) -> bool:
                                                                                            +    return body is not None and _is_expected_type(body, "event_callback") and "event" in body and "type" in body["event"]
                                                                                            +
                                                                                            def is_function(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_function(body: Dict[str, Any]) -> bool:
                                                                                            +    return is_event(body) and "function_executed" == body["event"]["type"] and "function_execution_id" in body["event"]
                                                                                            +
                                                                                            def is_global_shortcut(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_global_shortcut(body: Dict[str, Any]) -> bool:
                                                                                            +    return body is not None and _is_expected_type(body, "shortcut") and "callback_id" in body
                                                                                            +
                                                                                            def is_message_event_in_assistant_thread(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_message_event_in_assistant_thread(body: Dict[str, Any]) -> bool:
                                                                                            +    if is_event(body):
                                                                                            +        return body["event"]["type"] == "message" and body["event"].get("channel_type") == "im"
                                                                                            +    return False
                                                                                            +
                                                                                            def is_message_shortcut(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_message_shortcut(body: Dict[str, Any]) -> bool:
                                                                                            +    return body is not None and _is_expected_type(body, "message_action") and "callback_id" in body
                                                                                            +
                                                                                            def is_options(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_options(body: Dict[str, Any]) -> bool:
                                                                                            +    return is_block_suggestion(body) or is_dialog_suggestion(body)
                                                                                            +
                                                                                            def is_other_message_sub_event_in_assistant_thread(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_other_message_sub_event_in_assistant_thread(body: Dict[str, Any]) -> bool:
                                                                                            +    # message_changed, message_deleted etc.
                                                                                            +    if is_event(body):
                                                                                            +        return (
                                                                                            +            is_message_event_in_assistant_thread(body)
                                                                                            +            and not is_user_message_event_in_assistant_thread(body)
                                                                                            +            and (
                                                                                            +                _is_other_message_sub_event(body["event"].get("message"))
                                                                                            +                or _is_other_message_sub_event(body["event"].get("previous_message"))
                                                                                            +            )
                                                                                            +        )
                                                                                            +    return False
                                                                                            +
                                                                                            def is_shortcut(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_shortcut(body: Dict[str, Any]) -> bool:
                                                                                            +    return is_global_shortcut(body) or is_message_shortcut(body)
                                                                                            +
                                                                                            def is_slash_command(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_slash_command(body: Dict[str, Any]) -> bool:
                                                                                            +    return body is not None and "command" in body
                                                                                            +
                                                                                            def is_user_message_event_in_assistant_thread(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_user_message_event_in_assistant_thread(body: Dict[str, Any]) -> bool:
                                                                                            +    if is_event(body):
                                                                                            +        return (
                                                                                            +            is_message_event_in_assistant_thread(body)
                                                                                            +            and body["event"].get("subtype") in (None, "file_share")
                                                                                            +            and body["event"].get("thread_ts") is not None
                                                                                            +            and body["event"].get("bot_id") is None
                                                                                            +        )
                                                                                            +    return False
                                                                                            +
                                                                                            def is_view(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_view(body: Dict[str, Any]) -> bool:
                                                                                            +    return is_view_submission(body) or is_view_closed(body)
                                                                                            +
                                                                                            def is_view_closed(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_view_closed(body: Dict[str, Any]) -> bool:
                                                                                            +    return body is not None and _is_expected_type(body, "view_closed") and "view" in body and "callback_id" in body["view"]
                                                                                            +
                                                                                            def is_view_submission(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_view_submission(body: Dict[str, Any]) -> bool:
                                                                                            +    return (
                                                                                            +        body is not None and _is_expected_type(body, "view_submission") and "view" in body and "callback_id" in body["view"]
                                                                                            +    )
                                                                                            +
                                                                                            def is_workflow_step_edit(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_workflow_step_edit(body: Dict[str, Any]) -> bool:
                                                                                            +    return body is not None and _is_expected_type(body, "workflow_step_edit") and "callback_id" in body
                                                                                            +
                                                                                            def is_workflow_step_execute(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_workflow_step_execute(body: Dict[str, Any]) -> bool:
                                                                                            +    return is_event(body) and body["event"]["type"] == "workflow_step_execute" and "workflow_step" in body["event"]
                                                                                            +
                                                                                            def is_workflow_step_save(body: Dict[str, Any]) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_workflow_step_save(body: Dict[str, Any]) -> bool:
                                                                                            +    return is_view_submission(body) and body["view"]["type"] == "workflow_step"
                                                                                            +
                                                                                            def to_action(body: Dict[str, Any]) ‑> Dict[str, Any] | None
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def to_action(body: Dict[str, Any]) -> Optional[Dict[str, Any]]:
                                                                                            +    if is_action(body):
                                                                                            +        if is_block_actions(body) or is_attachment_action(body):
                                                                                            +            return body["actions"][0]
                                                                                            +        else:
                                                                                            +            return body
                                                                                            +    return None
                                                                                            +
                                                                                            def to_command(body: Dict[str, Any]) ‑> Dict[str, Any] | None
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def to_command(body: Dict[str, Any]) -> Optional[Dict[str, Any]]:
                                                                                            +    return body if is_slash_command(body) else None
                                                                                            +
                                                                                            def to_event(body: Dict[str, Any]) ‑> Dict[str, Any] | None
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def to_event(body: Dict[str, Any]) -> Optional[Dict[str, Any]]:
                                                                                            +    return body["event"] if is_event(body) else None
                                                                                            +
                                                                                            def to_message(body: Dict[str, Any]) ‑> Dict[str, Any] | None
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def to_message(body: Dict[str, Any]) -> Optional[Dict[str, Any]]:
                                                                                            +    if is_event(body) and body["event"]["type"] == "message":
                                                                                            +        return to_event(body)
                                                                                            +    return None
                                                                                            +
                                                                                            def to_options(body: Dict[str, Any]) ‑> Dict[str, Any] | None
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def to_options(body: Dict[str, Any]) -> Optional[Dict[str, Any]]:
                                                                                            +    if is_options(body):
                                                                                            +        return body
                                                                                            +    return None
                                                                                            +
                                                                                            def to_shortcut(body: Dict[str, Any]) ‑> Dict[str, Any] | None
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def to_shortcut(body: Dict[str, Any]) -> Optional[Dict[str, Any]]:
                                                                                            +    if is_shortcut(body):
                                                                                            +        return body
                                                                                            +    return None
                                                                                            +
                                                                                            def to_step(body: Dict[str, Any]) ‑> Dict[str, Any] | None
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def to_step(body: Dict[str, Any]) -> Optional[Dict[str, Any]]:
                                                                                            +    # edit
                                                                                            +    if is_workflow_step_edit(body):
                                                                                            +        return body["workflow_step"]
                                                                                            +    # save
                                                                                            +    if is_workflow_step_save(body):
                                                                                            +        return body["workflow_step"]
                                                                                            +    # execute
                                                                                            +    if is_workflow_step_execute(body):
                                                                                            +        return body["event"]["workflow_step"]
                                                                                            +    return None
                                                                                            +
                                                                                            def to_view(body: Dict[str, Any]) ‑> Dict[str, Any] | None
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def to_view(body: Dict[str, Any]) -> Optional[Dict[str, Any]]:
                                                                                            +    if is_view(body):
                                                                                            +        return body["view"]
                                                                                            +    return None
                                                                                            +
                                                                                            @@ -301,7 +622,7 @@

                                                                                            Functions

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/request/request.html b/docs/static/api-docs/slack_bolt/request/request.html index e3c4fd4f..dfd0fa3f 100644 --- a/docs/static/api-docs/slack_bolt/request/request.html +++ b/docs/static/api-docs/slack_bolt/request/request.html @@ -3,19 +3,30 @@ - + slack_bolt.request.request API documentation - + @@ -40,20 +51,6 @@

                                                                                            Classes

                                                                                            (*,
                                                                                            body: str | dict,
                                                                                            query: str | Dict[str, str] | Dict[str, Sequence[str]] | None = None,
                                                                                            headers: Dict[str, str | Sequence[str]] | None = None,
                                                                                            context: Dict[str, Any] | None = None,
                                                                                            mode: str = 'http')
                                                                                            -

                                                                                            Request to a Bolt app.

                                                                                            -

                                                                                            Args

                                                                                            -
                                                                                            -
                                                                                            body
                                                                                            -
                                                                                            The raw request body (only plain text is supported for "http" mode)
                                                                                            -
                                                                                            query
                                                                                            -
                                                                                            The query string data in any data format.
                                                                                            -
                                                                                            headers
                                                                                            -
                                                                                            The request headers.
                                                                                            -
                                                                                            context
                                                                                            -
                                                                                            The context in this request.
                                                                                            -
                                                                                            mode
                                                                                            -
                                                                                            The mode used for this request. (either "http" or "socket_mode")
                                                                                            -
                                                                                            Expand source code @@ -127,43 +124,57 @@

                                                                                            Args

                                                                                            mode=self.mode, )
                                                                                            +

                                                                                            Request to a Bolt app.

                                                                                            +

                                                                                            Args

                                                                                            +
                                                                                            +
                                                                                            body
                                                                                            +
                                                                                            The raw request body (only plain text is supported for "http" mode)
                                                                                            +
                                                                                            query
                                                                                            +
                                                                                            The query string data in any data format.
                                                                                            +
                                                                                            headers
                                                                                            +
                                                                                            The request headers.
                                                                                            +
                                                                                            context
                                                                                            +
                                                                                            The context in this request.
                                                                                            +
                                                                                            mode
                                                                                            +
                                                                                            The mode used for this request. (either "http" or "socket_mode")
                                                                                            +

                                                                                            Class variables

                                                                                            var body : Dict[str, Any]
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var content_type : str | None
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var contextBoltContext
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var headers : Dict[str, Sequence[str]]
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var lazy_function_name : str | None
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var lazy_only : bool
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var mode : str
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var query : Dict[str, Sequence[str]]
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var raw_body : str
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            Methods

                                                                                            @@ -172,6 +183,20 @@

                                                                                            Methods

                                                                                            def to_copyable(self) ‑> BoltRequest
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def to_copyable(self) -> "BoltRequest":
                                                                                            +    body: Union[str, dict] = self.raw_body if self.mode == "http" else self.body
                                                                                            +    return BoltRequest(
                                                                                            +        body=body,
                                                                                            +        query=self.query,
                                                                                            +        headers=self.headers,
                                                                                            +        context=self.context.to_copyable(),
                                                                                            +        mode=self.mode,
                                                                                            +    )
                                                                                            +
                                                                                            @@ -212,7 +237,7 @@

                                                                                            -

                                                                                            Generated by pdoc 0.11.3.

                                                                                            +

                                                                                            Generated by pdoc 0.11.5.

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/response/index.html b/docs/static/api-docs/slack_bolt/response/index.html index 31a5bdfd..01c05fc0 100644 --- a/docs/static/api-docs/slack_bolt/response/index.html +++ b/docs/static/api-docs/slack_bolt/response/index.html @@ -3,19 +3,30 @@ - + slack_bolt.response API documentation - + @@ -51,16 +62,6 @@

                                                                                            Classes

                                                                                            (*,
                                                                                            status: int,
                                                                                            body: str | dict = '',
                                                                                            headers: Dict[str, str | Sequence[str]] | None = None)
                                                                                            -

                                                                                            The response from a Bolt app.

                                                                                            -

                                                                                            Args

                                                                                            -
                                                                                            -
                                                                                            status
                                                                                            -
                                                                                            HTTP status code
                                                                                            -
                                                                                            body
                                                                                            -
                                                                                            The response body (dict and str are supported)
                                                                                            -
                                                                                            headers
                                                                                            -
                                                                                            The response headers.
                                                                                            -
                                                                                            Expand source code @@ -120,19 +121,29 @@

                                                                                            Args

                                                                                            c.load(header_value) return c
                                                                                            +

                                                                                            The response from a Bolt app.

                                                                                            +

                                                                                            Args

                                                                                            +
                                                                                            +
                                                                                            status
                                                                                            +
                                                                                            HTTP status code
                                                                                            +
                                                                                            body
                                                                                            +
                                                                                            The response body (dict and str are supported)
                                                                                            +
                                                                                            headers
                                                                                            +
                                                                                            The response headers.
                                                                                            +

                                                                                            Class variables

                                                                                            var body : str
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var headers : Dict[str, Sequence[str]]
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var status : int
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            Methods

                                                                                            @@ -141,18 +152,40 @@

                                                                                            Methods

                                                                                            def cookies(self) ‑> Sequence[http.cookies.SimpleCookie]
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def cookies(self) -> Sequence[SimpleCookie]:
                                                                                            +    header_values = self.headers.get("set-cookie", [])
                                                                                            +    return [self._to_simple_cookie(v) for v in header_values]
                                                                                            +
                                                                                            def first_headers(self) ‑> Dict[str, str]
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def first_headers(self) -> Dict[str, str]:
                                                                                            +    return {k: list(v)[0] for k, v in self.headers.items()}
                                                                                            +
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def first_headers_without_set_cookie(self) -> Dict[str, str]:
                                                                                            +    return {k: list(v)[0] for k, v in self.headers.items() if k != "set-cookie"}
                                                                                            +
                                                                                            @@ -194,7 +227,7 @@

                                                                                            -

                                                                                            Generated by pdoc 0.11.3.

                                                                                            +

                                                                                            Generated by pdoc 0.11.5.

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/response/response.html b/docs/static/api-docs/slack_bolt/response/response.html index 6af223f7..65151cf6 100644 --- a/docs/static/api-docs/slack_bolt/response/response.html +++ b/docs/static/api-docs/slack_bolt/response/response.html @@ -3,19 +3,30 @@ - + slack_bolt.response.response API documentation - + @@ -40,16 +51,6 @@

                                                                                            Classes

                                                                                            (*,
                                                                                            status: int,
                                                                                            body: str | dict = '',
                                                                                            headers: Dict[str, str | Sequence[str]] | None = None)
                                                                                            -

                                                                                            The response from a Bolt app.

                                                                                            -

                                                                                            Args

                                                                                            -
                                                                                            -
                                                                                            status
                                                                                            -
                                                                                            HTTP status code
                                                                                            -
                                                                                            body
                                                                                            -
                                                                                            The response body (dict and str are supported)
                                                                                            -
                                                                                            headers
                                                                                            -
                                                                                            The response headers.
                                                                                            -
                                                                                            Expand source code @@ -109,19 +110,29 @@

                                                                                            Args

                                                                                            c.load(header_value) return c
                                                                                            +

                                                                                            The response from a Bolt app.

                                                                                            +

                                                                                            Args

                                                                                            +
                                                                                            +
                                                                                            status
                                                                                            +
                                                                                            HTTP status code
                                                                                            +
                                                                                            body
                                                                                            +
                                                                                            The response body (dict and str are supported)
                                                                                            +
                                                                                            headers
                                                                                            +
                                                                                            The response headers.
                                                                                            +

                                                                                            Class variables

                                                                                            var body : str
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var headers : Dict[str, Sequence[str]]
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            var status : int
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            Methods

                                                                                            @@ -130,18 +141,40 @@

                                                                                            Methods

                                                                                            def cookies(self) ‑> Sequence[http.cookies.SimpleCookie]
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def cookies(self) -> Sequence[SimpleCookie]:
                                                                                            +    header_values = self.headers.get("set-cookie", [])
                                                                                            +    return [self._to_simple_cookie(v) for v in header_values]
                                                                                            +
                                                                                            def first_headers(self) ‑> Dict[str, str]
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def first_headers(self) -> Dict[str, str]:
                                                                                            +    return {k: list(v)[0] for k, v in self.headers.items()}
                                                                                            +
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def first_headers_without_set_cookie(self) -> Dict[str, str]:
                                                                                            +    return {k: list(v)[0] for k, v in self.headers.items() if k != "set-cookie"}
                                                                                            +
                                                                                            @@ -178,7 +211,7 @@

                                                                                            -

                                                                                            Generated by pdoc 0.11.3.

                                                                                            +

                                                                                            Generated by pdoc 0.11.5.

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/util/async_utils.html b/docs/static/api-docs/slack_bolt/util/async_utils.html index e46f7626..f7ce7748 100644 --- a/docs/static/api-docs/slack_bolt/util/async_utils.html +++ b/docs/static/api-docs/slack_bolt/util/async_utils.html @@ -3,19 +3,30 @@ - + slack_bolt.util.async_utils API documentation - + @@ -37,6 +48,17 @@

                                                                                            Functions

                                                                                            def create_async_web_client(token: str | None = None, logger: logging.Logger | None = None) ‑> slack_sdk.web.async_client.AsyncWebClient
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def create_async_web_client(token: Optional[str] = None, logger: Optional[Logger] = None) -> AsyncWebClient:
                                                                                            +    return AsyncWebClient(
                                                                                            +        token=token,
                                                                                            +        logger=logger,
                                                                                            +        user_agent_prefix=f"Bolt-Async/{bolt_version}",
                                                                                            +    )
                                                                                            +
                                                                                            @@ -63,7 +85,7 @@

                                                                                            Functions

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/util/index.html b/docs/static/api-docs/slack_bolt/util/index.html index 858208d2..54f1dbd8 100644 --- a/docs/static/api-docs/slack_bolt/util/index.html +++ b/docs/static/api-docs/slack_bolt/util/index.html @@ -3,19 +3,30 @@ - + slack_bolt.util API documentation - + @@ -67,7 +78,7 @@

                                                                                            Sub-modules

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/util/utils.html b/docs/static/api-docs/slack_bolt/util/utils.html index cf0db001..d22c1f58 100644 --- a/docs/static/api-docs/slack_bolt/util/utils.html +++ b/docs/static/api-docs/slack_bolt/util/utils.html @@ -3,19 +3,30 @@ - + slack_bolt.util.utils API documentation - + @@ -37,42 +48,142 @@

                                                                                            Functions

                                                                                            def convert_to_dict(obj: Dict | slack_sdk.models.basic_objects.JsonObject) ‑> Dict
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def convert_to_dict(obj: Union[Dict, JsonObject]) -> Dict:
                                                                                            +    if isinstance(obj, dict):
                                                                                            +        return obj
                                                                                            +    if isinstance(obj, JsonObject) or hasattr(obj, "to_dict"):
                                                                                            +        return obj.to_dict()
                                                                                            +    raise BoltError(f"{obj} (type: {type(obj)}) is unsupported")
                                                                                            +
                                                                                            def convert_to_dict_list(objects: Sequence[Dict | slack_sdk.models.basic_objects.JsonObject]) ‑> Sequence[Dict]
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def convert_to_dict_list(objects: Sequence[Union[Dict, JsonObject]]) -> Sequence[Dict]:
                                                                                            +    return [convert_to_dict(elm) for elm in objects]
                                                                                            +
                                                                                            def create_copy(original: Any) ‑> Any
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def create_copy(original: Any) -> Any:
                                                                                            +    if sys.version_info.major == 3 and sys.version_info.minor <= 6:
                                                                                            +        # NOTE: Unfortunately, copy.deepcopy doesn't work in Python 3.6.5.
                                                                                            +        # --------------------
                                                                                            +        # >     rv = reductor(4)
                                                                                            +        # E     TypeError: can't pickle _thread.RLock objects
                                                                                            +        # ../../.pyenv/versions/3.6.10/lib/python3.6/copy.py:169: TypeError
                                                                                            +        # --------------------
                                                                                            +        # As a workaround, this operation uses shallow copies in Python 3.6.
                                                                                            +        # If your code modifies the shared data in threads / async functions, race conditions may arise.
                                                                                            +        # Please consider upgrading Python major version to 3.7+ if you encounter some issues due to this.
                                                                                            +        return copy.copy(original)
                                                                                            +    else:
                                                                                            +        return copy.deepcopy(original)
                                                                                            +
                                                                                            def create_web_client(token: str | None = None, logger: logging.Logger | None = None) ‑> slack_sdk.web.client.WebClient
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def create_web_client(token: Optional[str] = None, logger: Optional[Logger] = None) -> WebClient:
                                                                                            +    return WebClient(
                                                                                            +        token=token,
                                                                                            +        logger=logger,
                                                                                            +        user_agent_prefix=f"Bolt/{bolt_version}",
                                                                                            +    )
                                                                                            +
                                                                                            def get_arg_names_of_callable(func: Callable) ‑> List[str]
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def get_arg_names_of_callable(func: Callable) -> List[str]:
                                                                                            +    return inspect.getfullargspec(inspect.unwrap(func)).args
                                                                                            +
                                                                                            def get_boot_message(development_server: bool = False) ‑> str
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def get_boot_message(development_server: bool = False) -> str:
                                                                                            +    if sys.platform == "win32":
                                                                                            +        # Some Windows environments may fail to parse this str value
                                                                                            +        # and result in UnicodeEncodeError
                                                                                            +        if development_server:
                                                                                            +            return "Bolt app is running! (development server)"
                                                                                            +        else:
                                                                                            +            return "Bolt app is running!"
                                                                                            +
                                                                                            +    try:
                                                                                            +        if development_server:
                                                                                            +            return "⚡️ Bolt app is running! (development server)"
                                                                                            +        else:
                                                                                            +            return "⚡️ Bolt app is running!"
                                                                                            +    except ValueError:
                                                                                            +        # ValueError is a runtime exception for a given value
                                                                                            +        # It's a super class of UnicodeEncodeError, which may be raised in the scenario
                                                                                            +        # see also: https://github.com/slackapi/bolt-python/issues/170
                                                                                            +        if development_server:
                                                                                            +            return "Bolt app is running! (development server)"
                                                                                            +        else:
                                                                                            +            return "Bolt app is running!"
                                                                                            +
                                                                                            def get_name_for_callable(func: Callable) ‑> str
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def get_name_for_callable(func: Callable) -> str:
                                                                                            +    """Returns the name for the given Callable function object.
                                                                                            +
                                                                                            +    Args:
                                                                                            +        func: Either a `Callable` instance or a function, which as `__name__`
                                                                                            +
                                                                                            +    Returns:
                                                                                            +        The name of the given Callable object
                                                                                            +    """
                                                                                            +    if hasattr(func, "__name__"):
                                                                                            +        return func.__name__
                                                                                            +    else:
                                                                                            +        return f"{func.__class__.__module__}.{func.__class__.__name__}"
                                                                                            +

                                                                                            Returns the name for the given Callable function object.

                                                                                            Args

                                                                                            @@ -86,12 +197,36 @@

                                                                                            Returns

                                                                                            def is_callable_coroutine(func: Any | None) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_callable_coroutine(func: Optional[Any]) -> bool:
                                                                                            +    return func is not None and (
                                                                                            +        inspect.iscoroutinefunction(func) or (hasattr(func, "__call__") and inspect.iscoroutinefunction(func.__call__))
                                                                                            +    )
                                                                                            +
                                                                                            def is_used_without_argument(args) ‑> bool
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def is_used_without_argument(args) -> bool:
                                                                                            +    """Tests if a decorator invocation is without () or (args).
                                                                                            +
                                                                                            +    Args:
                                                                                            +        args: arguments
                                                                                            +
                                                                                            +    Returns:
                                                                                            +        True if it's an invocation without args
                                                                                            +    """
                                                                                            +    return len(args) == 1
                                                                                            +

                                                                                            Tests if a decorator invocation is without () or (args).

                                                                                            Args

                                                                                            @@ -133,7 +268,7 @@

                                                                                            Returns

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/version.html b/docs/static/api-docs/slack_bolt/version.html index 06e8b967..404f38d7 100644 --- a/docs/static/api-docs/slack_bolt/version.html +++ b/docs/static/api-docs/slack_bolt/version.html @@ -3,19 +3,30 @@ - + slack_bolt.version API documentation - + @@ -50,7 +61,7 @@

                                                                                            Module slack_bolt.version

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/workflows/index.html b/docs/static/api-docs/slack_bolt/workflows/index.html index 88942a3f..5c2e3f91 100644 --- a/docs/static/api-docs/slack_bolt/workflows/index.html +++ b/docs/static/api-docs/slack_bolt/workflows/index.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows API documentation - + @@ -69,7 +80,7 @@

                                                                                            Sub-modules

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/workflows/step/async_step.html b/docs/static/api-docs/slack_bolt/workflows/step/async_step.html index 14f26c1c..d0b91fb5 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/async_step.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/async_step.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.async_step API documentation - + @@ -40,27 +51,6 @@

                                                                                            Classes

                                                                                            (*,
                                                                                            callback_id: str | Pattern,
                                                                                            edit: Callable[..., Awaitable[BoltResponse]] | AsyncListener | Sequence[Callable],
                                                                                            save: Callable[..., Awaitable[BoltResponse]] | AsyncListener | Sequence[Callable],
                                                                                            execute: Callable[..., Awaitable[BoltResponse]] | AsyncListener | Sequence[Callable],
                                                                                            app_name: str | None = None,
                                                                                            base_logger: logging.Logger | None = None)
                                                                                            -

                                                                                            Deprecated

                                                                                            -

                                                                                            Steps from apps for legacy workflows are now deprecated. -Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                            -

                                                                                            Args

                                                                                            -
                                                                                            -
                                                                                            callback_id
                                                                                            -
                                                                                            The callback_id for this step from app
                                                                                            -
                                                                                            edit
                                                                                            -
                                                                                            Either a single function or a list of functions for opening a modal in the builder UI -When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                            -
                                                                                            save
                                                                                            -
                                                                                            Either a single function or a list of functions for handling modal interactions in the builder UI -When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                            -
                                                                                            execute
                                                                                            -
                                                                                            Either a single function or a list of functions for handling steps from apps executions -When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                            -
                                                                                            app_name
                                                                                            -
                                                                                            The app name that can be mainly used for logging
                                                                                            -
                                                                                            base_logger
                                                                                            -
                                                                                            The logger instance that can be used as a template when creating this step's logger
                                                                                            -
                                                                                            Expand source code @@ -208,6 +198,27 @@

                                                                                            Args

                                                                                            else: raise ValueError(f"Invalid name {name}")
                                                                                            +

                                                                                            Deprecated

                                                                                            +

                                                                                            Steps from apps for legacy workflows are now deprecated. +Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                            +

                                                                                            Args

                                                                                            +
                                                                                            +
                                                                                            callback_id
                                                                                            +
                                                                                            The callback_id for this step from app
                                                                                            +
                                                                                            edit
                                                                                            +
                                                                                            Either a single function or a list of functions for opening a modal in the builder UI +When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                            +
                                                                                            save
                                                                                            +
                                                                                            Either a single function or a list of functions for handling modal interactions in the builder UI +When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                            +
                                                                                            execute
                                                                                            +
                                                                                            Either a single function or a list of functions for handling steps from apps executions +When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                            +
                                                                                            app_name
                                                                                            +
                                                                                            The app name that can be mainly used for logging
                                                                                            +
                                                                                            base_logger
                                                                                            +
                                                                                            The logger instance that can be used as a template when creating this step's logger
                                                                                            +

                                                                                            Class variables

                                                                                            var callback_id : str | Pattern
                                                                                            @@ -250,36 +261,6 @@

                                                                                            Static methods

                                                                                            (callback_id: str | Pattern,
                                                                                            app_name: str | None = None,
                                                                                            base_logger: logging.Logger | None = None)
                                                                                            -

                                                                                            Steps from apps -Refer to https://api.slack.com/workflows/steps for details.

                                                                                            -

                                                                                            Deprecated

                                                                                            -

                                                                                            Steps from apps for legacy workflows are now deprecated. -Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                            -

                                                                                            This builder is supposed to be used as decorator.

                                                                                            -
                                                                                            my_step = AsyncWorkflowStep.builder("my_step")
                                                                                            -@my_step.edit
                                                                                            -async def edit_my_step(ack, configure):
                                                                                            -    pass
                                                                                            -@my_step.save
                                                                                            -async def save_my_step(ack, step, update):
                                                                                            -    pass
                                                                                            -@my_step.execute
                                                                                            -async def execute_my_step(step, complete, fail):
                                                                                            -    pass
                                                                                            -app.step(my_step)
                                                                                            -
                                                                                            -

                                                                                            For further information about AsyncWorkflowStep specific function arguments -such as configure, update, complete, and fail, -refer to the async prefixed ones in slack_bolt.workflows.step.utilities API documents.

                                                                                            -

                                                                                            Args

                                                                                            -
                                                                                            -
                                                                                            callback_id
                                                                                            -
                                                                                            The callback_id for the workflow
                                                                                            -
                                                                                            app_name
                                                                                            -
                                                                                            The application name mainly for logging
                                                                                            -
                                                                                            base_logger
                                                                                            -
                                                                                            The base logger
                                                                                            -
                                                                                            Expand source code @@ -573,11 +554,41 @@

                                                                                            Args

                                                                                            raise ValueError(f"Invalid middleware: {type(m)}") return _middleware
                                                                                            +

                                                                                            Steps from apps +Refer to https://api.slack.com/workflows/steps for details.

                                                                                            +

                                                                                            Deprecated

                                                                                            +

                                                                                            Steps from apps for legacy workflows are now deprecated. +Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                            +

                                                                                            This builder is supposed to be used as decorator.

                                                                                            +
                                                                                            my_step = AsyncWorkflowStep.builder("my_step")
                                                                                            +@my_step.edit
                                                                                            +async def edit_my_step(ack, configure):
                                                                                            +    pass
                                                                                            +@my_step.save
                                                                                            +async def save_my_step(ack, step, update):
                                                                                            +    pass
                                                                                            +@my_step.execute
                                                                                            +async def execute_my_step(step, complete, fail):
                                                                                            +    pass
                                                                                            +app.step(my_step)
                                                                                            +
                                                                                            +

                                                                                            For further information about AsyncWorkflowStep specific function arguments +such as configure, update, complete, and fail, +refer to the async prefixed ones in slack_bolt.workflows.step.utilities API documents.

                                                                                            +

                                                                                            Args

                                                                                            +
                                                                                            +
                                                                                            callback_id
                                                                                            +
                                                                                            The callback_id for the workflow
                                                                                            +
                                                                                            app_name
                                                                                            +
                                                                                            The application name mainly for logging
                                                                                            +
                                                                                            base_logger
                                                                                            +
                                                                                            The base logger
                                                                                            +

                                                                                            Class variables

                                                                                            var callback_id : str | Pattern
                                                                                            -
                                                                                            +

                                                                                            The type of the None singleton.

                                                                                            Static methods

                                                                                            @@ -586,12 +597,51 @@

                                                                                            Static methods

                                                                                            def to_listener_matchers(app_name: str,
                                                                                            matchers: List[AsyncListenerMatcher | Callable[..., Awaitable[bool]]] | None) ‑> List[AsyncListenerMatcher]
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            @staticmethod
                                                                                            +def to_listener_matchers(
                                                                                            +    app_name: str,
                                                                                            +    matchers: Optional[List[Union[Callable[..., Awaitable[bool]], AsyncListenerMatcher]]],
                                                                                            +) -> List[AsyncListenerMatcher]:
                                                                                            +    _matchers = []
                                                                                            +    if matchers is not None:
                                                                                            +        for m in matchers:
                                                                                            +            if isinstance(m, AsyncListenerMatcher):
                                                                                            +                _matchers.append(m)
                                                                                            +            elif isinstance(m, Callable):
                                                                                            +                _matchers.append(AsyncCustomListenerMatcher(app_name=app_name, func=m))
                                                                                            +            else:
                                                                                            +                raise ValueError(f"Invalid matcher: {type(m)}")
                                                                                            +    return _matchers
                                                                                            +
                                                                                            def to_listener_middleware(app_name: str,
                                                                                            middleware: List[Callable | AsyncMiddleware] | None) ‑> List[AsyncMiddleware]
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            @staticmethod
                                                                                            +def to_listener_middleware(
                                                                                            +    app_name: str, middleware: Optional[List[Union[Callable, AsyncMiddleware]]]
                                                                                            +) -> List[AsyncMiddleware]:
                                                                                            +    _middleware = []
                                                                                            +    if middleware is not None:
                                                                                            +        for m in middleware:
                                                                                            +            if isinstance(m, AsyncMiddleware):
                                                                                            +                _middleware.append(m)
                                                                                            +            elif isinstance(m, Callable):
                                                                                            +                _middleware.append(AsyncCustomMiddleware(app_name=app_name, func=m))
                                                                                            +            else:
                                                                                            +                raise ValueError(f"Invalid middleware: {type(m)}")
                                                                                            +    return _middleware
                                                                                            +
                                                                                            @@ -601,6 +651,38 @@

                                                                                            Methods

                                                                                            def build(self, base_logger: logging.Logger | None = None) ‑> AsyncWorkflowStep
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def build(self, base_logger: Optional[Logger] = None) -> "AsyncWorkflowStep":
                                                                                            +    """
                                                                                            +    Deprecated:
                                                                                            +        Steps from apps for legacy workflows are now deprecated.
                                                                                            +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                                                            +
                                                                                            +    Constructs a WorkflowStep object. This method may raise an exception
                                                                                            +    if the builder doesn't have enough configurations to build the object.
                                                                                            +
                                                                                            +    Returns:
                                                                                            +        An `AsyncWorkflowStep` object
                                                                                            +    """
                                                                                            +    if self._edit is None:
                                                                                            +        raise BoltError("edit listener is not registered")
                                                                                            +    if self._save is None:
                                                                                            +        raise BoltError("save listener is not registered")
                                                                                            +    if self._execute is None:
                                                                                            +        raise BoltError("execute listener is not registered")
                                                                                            +
                                                                                            +    return AsyncWorkflowStep(
                                                                                            +        callback_id=self.callback_id,
                                                                                            +        edit=self._edit,
                                                                                            +        save=self._save,
                                                                                            +        execute=self._execute,
                                                                                            +        app_name=self.app_name,
                                                                                            +        base_logger=base_logger,
                                                                                            +    )
                                                                                            +

                                                                                            Deprecated

                                                                                            Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                            @@ -613,6 +695,63 @@

                                                                                            Returns

                                                                                            def edit(self,
                                                                                            *args,
                                                                                            matchers: Callable[..., Awaitable[bool]] | AsyncListenerMatcher | None = None,
                                                                                            middleware: Callable | AsyncMiddleware | None = None,
                                                                                            lazy: List[Callable[..., Awaitable[None]]] | None = None)
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def edit(
                                                                                            +    self,
                                                                                            +    *args,
                                                                                            +    matchers: Optional[Union[Callable[..., Awaitable[bool]], AsyncListenerMatcher]] = None,
                                                                                            +    middleware: Optional[Union[Callable, AsyncMiddleware]] = None,
                                                                                            +    lazy: Optional[List[Callable[..., Awaitable[None]]]] = None,
                                                                                            +):
                                                                                            +    """
                                                                                            +    Deprecated:
                                                                                            +        Steps from apps for legacy workflows are now deprecated.
                                                                                            +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                                                            +
                                                                                            +    Registers a new edit listener with details.
                                                                                            +
                                                                                            +    You can use this method as decorator as well.
                                                                                            +
                                                                                            +        @my_step.edit
                                                                                            +        def edit_my_step(ack, configure):
                                                                                            +            pass
                                                                                            +
                                                                                            +    It's also possible to add additional listener matchers and/or middleware
                                                                                            +
                                                                                            +        @my_step.edit(matchers=[is_valid], middleware=[update_context])
                                                                                            +        def edit_my_step(ack, configure):
                                                                                            +            pass
                                                                                            +
                                                                                            +    For further information about AsyncWorkflowStep specific function arguments
                                                                                            +    such as `configure`, `update`, `complete`, and `fail`,
                                                                                            +    refer to the `async` prefixed ones in `slack_bolt.workflows.step.utilities` API documents.
                                                                                            +
                                                                                            +    Args:
                                                                                            +        *args: This method can behave as either decorator or a method
                                                                                            +        matchers: Listener matchers
                                                                                            +        middleware: Listener middleware
                                                                                            +        lazy: Lazy listeners
                                                                                            +    """
                                                                                            +    if _is_used_without_argument(args):
                                                                                            +        func = args[0]
                                                                                            +        self._edit = self._to_listener("edit", func, matchers, middleware)
                                                                                            +        return func
                                                                                            +
                                                                                            +    def _inner(func):
                                                                                            +        functions = [func] + (lazy if lazy is not None else [])
                                                                                            +        self._edit = self._to_listener("edit", functions, matchers, middleware)
                                                                                            +
                                                                                            +        @wraps(func)
                                                                                            +        async def _wrapper(*args, **kwargs):
                                                                                            +            return await func(*args, **kwargs)
                                                                                            +
                                                                                            +        return _wrapper
                                                                                            +
                                                                                            +    return _inner
                                                                                            +

                                                                                            Deprecated

                                                                                            Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                            @@ -646,6 +785,63 @@

                                                                                            Args

                                                                                            def execute(self,
                                                                                            *args,
                                                                                            matchers: Callable[..., Awaitable[bool]] | AsyncListenerMatcher | None = None,
                                                                                            middleware: Callable | AsyncMiddleware | None = None,
                                                                                            lazy: List[Callable[..., Awaitable[None]]] | None = None)
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def execute(
                                                                                            +    self,
                                                                                            +    *args,
                                                                                            +    matchers: Optional[Union[Callable[..., Awaitable[bool]], AsyncListenerMatcher]] = None,
                                                                                            +    middleware: Optional[Union[Callable, AsyncMiddleware]] = None,
                                                                                            +    lazy: Optional[List[Callable[..., Awaitable[None]]]] = None,
                                                                                            +):
                                                                                            +    """
                                                                                            +    Deprecated:
                                                                                            +        Steps from apps for legacy workflows are now deprecated.
                                                                                            +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                                                            +
                                                                                            +    Registers a new execute listener with details.
                                                                                            +
                                                                                            +    You can use this method as decorator as well.
                                                                                            +
                                                                                            +        @my_step.execute
                                                                                            +        def execute_my_step(step, complete, fail):
                                                                                            +            pass
                                                                                            +
                                                                                            +    It's also possible to add additional listener matchers and/or middleware
                                                                                            +
                                                                                            +        @my_step.save(matchers=[is_valid], middleware=[update_context])
                                                                                            +        def execute_my_step(step, complete, fail):
                                                                                            +            pass
                                                                                            +
                                                                                            +    For further information about AsyncWorkflowStep specific function arguments
                                                                                            +    such as `configure`, `update`, `complete`, and `fail`,
                                                                                            +    refer to the `async` prefixed ones in `slack_bolt.workflows.step.utilities` API documents.
                                                                                            +
                                                                                            +    Args:
                                                                                            +        *args: This method can behave as either decorator or a method
                                                                                            +        matchers: Listener matchers
                                                                                            +        middleware: Listener middleware
                                                                                            +        lazy: Lazy listeners
                                                                                            +    """
                                                                                            +    if _is_used_without_argument(args):
                                                                                            +        func = args[0]
                                                                                            +        self._execute = self._to_listener("execute", func, matchers, middleware)
                                                                                            +        return func
                                                                                            +
                                                                                            +    def _inner(func):
                                                                                            +        functions = [func] + (lazy if lazy is not None else [])
                                                                                            +        self._execute = self._to_listener("execute", functions, matchers, middleware)
                                                                                            +
                                                                                            +        @wraps(func)
                                                                                            +        async def _wrapper(*args, **kwargs):
                                                                                            +            return await func(*args, **kwargs)
                                                                                            +
                                                                                            +        return _wrapper
                                                                                            +
                                                                                            +    return _inner
                                                                                            +

                                                                                            Deprecated

                                                                                            Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                            @@ -679,6 +875,63 @@

                                                                                            Args

                                                                                            def save(self,
                                                                                            *args,
                                                                                            matchers: Callable[..., Awaitable[bool]] | AsyncListenerMatcher | None = None,
                                                                                            middleware: Callable | AsyncMiddleware | None = None,
                                                                                            lazy: List[Callable[..., Awaitable[None]]] | None = None)
                                                                                            +
                                                                                            + +Expand source code + +
                                                                                            def save(
                                                                                            +    self,
                                                                                            +    *args,
                                                                                            +    matchers: Optional[Union[Callable[..., Awaitable[bool]], AsyncListenerMatcher]] = None,
                                                                                            +    middleware: Optional[Union[Callable, AsyncMiddleware]] = None,
                                                                                            +    lazy: Optional[List[Callable[..., Awaitable[None]]]] = None,
                                                                                            +):
                                                                                            +    """
                                                                                            +    Deprecated:
                                                                                            +        Steps from apps for legacy workflows are now deprecated.
                                                                                            +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                                                            +
                                                                                            +    Registers a new save listener with details.
                                                                                            +
                                                                                            +    You can use this method as decorator as well.
                                                                                            +
                                                                                            +        @my_step.save
                                                                                            +        def save_my_step(ack, step, update):
                                                                                            +            pass
                                                                                            +
                                                                                            +    It's also possible to add additional listener matchers and/or middleware
                                                                                            +
                                                                                            +        @my_step.save(matchers=[is_valid], middleware=[update_context])
                                                                                            +        def save_my_step(ack, step, update):
                                                                                            +            pass
                                                                                            +
                                                                                            +    For further information about AsyncWorkflowStep specific function arguments
                                                                                            +    such as `configure`, `update`, `complete`, and `fail`,
                                                                                            +    refer to the `async` prefixed ones in `slack_bolt.workflows.step.utilities` API documents.
                                                                                            +
                                                                                            +    Args:
                                                                                            +        *args: This method can behave as either decorator or a method
                                                                                            +        matchers: Listener matchers
                                                                                            +        middleware: Listener middleware
                                                                                            +        lazy: Lazy listeners
                                                                                            +    """
                                                                                            +    if _is_used_without_argument(args):
                                                                                            +        func = args[0]
                                                                                            +        self._save = self._to_listener("save", func, matchers, middleware)
                                                                                            +        return func
                                                                                            +
                                                                                            +    def _inner(func):
                                                                                            +        functions = [func] + (lazy if lazy is not None else [])
                                                                                            +        self._save = self._to_listener("save", functions, matchers, middleware)
                                                                                            +
                                                                                            +        @wraps(func)
                                                                                            +        async def _wrapper(*args, **kwargs):
                                                                                            +            return await func(*args, **kwargs)
                                                                                            +
                                                                                            +        return _wrapper
                                                                                            +
                                                                                            +    return _inner
                                                                                            +

                                                                                            Deprecated

                                                                                            Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                            @@ -754,7 +1007,7 @@

                                                                                            -

                                                                                            Generated by pdoc 0.11.3.

                                                                                            +

                                                                                            Generated by pdoc 0.11.5.

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/workflows/step/async_step_middleware.html b/docs/static/api-docs/slack_bolt/workflows/step/async_step_middleware.html index 02f06eed..fff1cda5 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/async_step_middleware.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/async_step_middleware.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.async_step_middleware API documentation - + @@ -40,7 +51,6 @@

                                                                                            Classes

                                                                                            (step: AsyncWorkflowStep)
                                                                                            -

                                                                                            Base middleware for step from app specific ones

                                                                                            Expand source code @@ -91,6 +101,7 @@

                                                                                            Classes

                                                                                            listener=listener, )
                                                                                            +

                                                                                            Base middleware for step from app specific ones

                                                                                            Ancestors

                                                                                            • AsyncMiddleware
                                                                                            • @@ -129,7 +140,7 @@

                                                                                              -

                                                                                              Generated by pdoc 0.11.3.

                                                                                              +

                                                                                              Generated by pdoc 0.11.5.

                                                                                              diff --git a/docs/static/api-docs/slack_bolt/workflows/step/index.html b/docs/static/api-docs/slack_bolt/workflows/step/index.html index 2ddde44b..bc15d5a1 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/index.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/index.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step API documentation - + @@ -67,26 +78,6 @@

                                                                                              Classes

                                                                                              (*, client: slack_sdk.web.client.WebClient, body: dict)
                                                                                              -

                                                                                              complete() utility to tell Slack the completion of a step from app execution.

                                                                                              -
                                                                                              def execute(step, complete, fail):
                                                                                              -    inputs = step["inputs"]
                                                                                              -    # if everything was successful
                                                                                              -    outputs = {
                                                                                              -        "task_name": inputs["task_name"]["value"],
                                                                                              -        "task_description": inputs["task_description"]["value"],
                                                                                              -    }
                                                                                              -    complete(outputs=outputs)
                                                                                              -
                                                                                              -ws = WorkflowStep(
                                                                                              -    callback_id="add_task",
                                                                                              -    edit=edit,
                                                                                              -    save=save,
                                                                                              -    execute=execute,
                                                                                              -)
                                                                                              -app.step(ws)
                                                                                              -
                                                                                              -

                                                                                              This utility is a thin wrapper of workflows.stepCompleted API method. -Refer to https://api.slack.com/methods/workflows.stepCompleted for details.

                                                                                              Expand source code @@ -125,29 +116,15 @@

                                                                                              Classes

                                                                                              **kwargs, )
                                                                                              -
                                                                                              -
                                                                                              -class Configure -(*, callback_id: str, client: slack_sdk.web.client.WebClient, body: dict) -
                                                                                              -
                                                                                              -

                                                                                              configure() utility to send the modal view in Workflow Builder.

                                                                                              -
                                                                                              def edit(ack, step, configure):
                                                                                              -    ack()
                                                                                              -
                                                                                              -    blocks = [
                                                                                              -        {
                                                                                              -            "type": "input",
                                                                                              -            "block_id": "task_name_input",
                                                                                              -            "element": {
                                                                                              -                "type": "plain_text_input",
                                                                                              -                "action_id": "name",
                                                                                              -                "placeholder": {"type": "plain_text", "text": "Add a task name"},
                                                                                              -            },
                                                                                              -            "label": {"type": "plain_text", "text": "Task name"},
                                                                                              -        },
                                                                                              -    ]
                                                                                              -    configure(blocks=blocks)
                                                                                              +

                                                                                              complete() utility to tell Slack the completion of a step from app execution.

                                                                                              +
                                                                                              def execute(step, complete, fail):
                                                                                              +    inputs = step["inputs"]
                                                                                              +    # if everything was successful
                                                                                              +    outputs = {
                                                                                              +        "task_name": inputs["task_name"]["value"],
                                                                                              +        "task_description": inputs["task_description"]["value"],
                                                                                              +    }
                                                                                              +    complete(outputs=outputs)
                                                                                               
                                                                                               ws = WorkflowStep(
                                                                                                   callback_id="add_task",
                                                                                              @@ -157,7 +134,14 @@ 

                                                                                              Classes

                                                                                              ) app.step(ws)
                                                                                              -

                                                                                              Refer to https://api.slack.com/workflows/steps for details.

                                                                                              +

                                                                                              This utility is a thin wrapper of workflows.stepCompleted API method. +Refer to https://api.slack.com/methods/workflows.stepCompleted for details.

                                                                                              +
                                                                                              +
                                                                                              +class Configure +(*, callback_id: str, client: slack_sdk.web.client.WebClient, body: dict) +
                                                                                              +
                                                                                              Expand source code @@ -209,18 +193,23 @@

                                                                                              Classes

                                                                                              }, )
                                                                                              -
                                                                                              -
                                                                                              -class Fail -(*, client: slack_sdk.web.client.WebClient, body: dict) -
                                                                                              -
                                                                                              -

                                                                                              fail() utility to tell Slack the execution failure of a step from app.

                                                                                              -
                                                                                              def execute(step, complete, fail):
                                                                                              -    inputs = step["inputs"]
                                                                                              -    # if something went wrong
                                                                                              -    error = {"message": "Just testing step failure!"}
                                                                                              -    fail(error=error)
                                                                                              +

                                                                                              configure() utility to send the modal view in Workflow Builder.

                                                                                              +
                                                                                              def edit(ack, step, configure):
                                                                                              +    ack()
                                                                                              +
                                                                                              +    blocks = [
                                                                                              +        {
                                                                                              +            "type": "input",
                                                                                              +            "block_id": "task_name_input",
                                                                                              +            "element": {
                                                                                              +                "type": "plain_text_input",
                                                                                              +                "action_id": "name",
                                                                                              +                "placeholder": {"type": "plain_text", "text": "Add a task name"},
                                                                                              +            },
                                                                                              +            "label": {"type": "plain_text", "text": "Task name"},
                                                                                              +        },
                                                                                              +    ]
                                                                                              +    configure(blocks=blocks)
                                                                                               
                                                                                               ws = WorkflowStep(
                                                                                                   callback_id="add_task",
                                                                                              @@ -230,8 +219,13 @@ 

                                                                                              Classes

                                                                                              ) app.step(ws)
                                                                                              -

                                                                                              This utility is a thin wrapper of workflows.stepFailed API method. -Refer to https://api.slack.com/methods/workflows.stepFailed for details.

                                                                                              +

                                                                                              Refer to https://api.slack.com/workflows/steps for details.

                                                                                              +
                                                                                              +
                                                                                              +class Fail +(*, client: slack_sdk.web.client.WebClient, body: dict) +
                                                                                              +
                                                                                              Expand source code @@ -271,37 +265,12 @@

                                                                                              Classes

                                                                                              error=error, )
                                                                                              -
                                                                                              -
                                                                                              -class Update -(*, client: slack_sdk.web.client.WebClient, body: dict) -
                                                                                              -
                                                                                              -

                                                                                              update() utility to tell Slack the processing results of a save listener.

                                                                                              -
                                                                                              def save(ack, view, update):
                                                                                              -    ack()
                                                                                              -
                                                                                              -    values = view["state"]["values"]
                                                                                              -    task_name = values["task_name_input"]["name"]
                                                                                              -    task_description = values["task_description_input"]["description"]
                                                                                              -
                                                                                              -    inputs = {
                                                                                              -        "task_name": {"value": task_name["value"]},
                                                                                              -        "task_description": {"value": task_description["value"]}
                                                                                              -    }
                                                                                              -    outputs = [
                                                                                              -        {
                                                                                              -            "type": "text",
                                                                                              -            "name": "task_name",
                                                                                              -            "label": "Task name",
                                                                                              -        },
                                                                                              -        {
                                                                                              -            "type": "text",
                                                                                              -            "name": "task_description",
                                                                                              -            "label": "Task description",
                                                                                              -        }
                                                                                              -    ]
                                                                                              -    update(inputs=inputs, outputs=outputs)
                                                                                              +

                                                                                              fail() utility to tell Slack the execution failure of a step from app.

                                                                                              +
                                                                                              def execute(step, complete, fail):
                                                                                              +    inputs = step["inputs"]
                                                                                              +    # if something went wrong
                                                                                              +    error = {"message": "Just testing step failure!"}
                                                                                              +    fail(error=error)
                                                                                               
                                                                                               ws = WorkflowStep(
                                                                                                   callback_id="add_task",
                                                                                              @@ -312,7 +281,13 @@ 

                                                                                              Classes

                                                                                              app.step(ws)

                                                                                              This utility is a thin wrapper of workflows.stepFailed API method. -Refer to https://api.slack.com/methods/workflows.updateStep for details.

                                                                                              +Refer to https://api.slack.com/methods/workflows.stepFailed for details.

                                                                                              +
                                                                                              +
                                                                                              +class Update +(*, client: slack_sdk.web.client.WebClient, body: dict) +
                                                                                              +
                                                                                              Expand source code @@ -367,33 +342,48 @@

                                                                                              Classes

                                                                                              **kwargs, )
                                                                                              +

                                                                                              update() utility to tell Slack the processing results of a save listener.

                                                                                              +
                                                                                              def save(ack, view, update):
                                                                                              +    ack()
                                                                                              +
                                                                                              +    values = view["state"]["values"]
                                                                                              +    task_name = values["task_name_input"]["name"]
                                                                                              +    task_description = values["task_description_input"]["description"]
                                                                                              +
                                                                                              +    inputs = {
                                                                                              +        "task_name": {"value": task_name["value"]},
                                                                                              +        "task_description": {"value": task_description["value"]}
                                                                                              +    }
                                                                                              +    outputs = [
                                                                                              +        {
                                                                                              +            "type": "text",
                                                                                              +            "name": "task_name",
                                                                                              +            "label": "Task name",
                                                                                              +        },
                                                                                              +        {
                                                                                              +            "type": "text",
                                                                                              +            "name": "task_description",
                                                                                              +            "label": "Task description",
                                                                                              +        }
                                                                                              +    ]
                                                                                              +    update(inputs=inputs, outputs=outputs)
                                                                                              +
                                                                                              +ws = WorkflowStep(
                                                                                              +    callback_id="add_task",
                                                                                              +    edit=edit,
                                                                                              +    save=save,
                                                                                              +    execute=execute,
                                                                                              +)
                                                                                              +app.step(ws)
                                                                                              +
                                                                                              +

                                                                                              This utility is a thin wrapper of workflows.stepFailed API method. +Refer to https://api.slack.com/methods/workflows.updateStep for details.

                                                                                              class WorkflowStep (*,
                                                                                              callback_id: str | Pattern,
                                                                                              edit: Callable[..., BoltResponse | None] | Listener | Sequence[Callable],
                                                                                              save: Callable[..., BoltResponse | None] | Listener | Sequence[Callable],
                                                                                              execute: Callable[..., BoltResponse | None] | Listener | Sequence[Callable],
                                                                                              app_name: str | None = None,
                                                                                              base_logger: logging.Logger | None = None)
                                                                                              -

                                                                                              Deprecated

                                                                                              -

                                                                                              Steps from apps for legacy workflows are now deprecated. -Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                              -

                                                                                              Args

                                                                                              -
                                                                                              -
                                                                                              callback_id
                                                                                              -
                                                                                              The callback_id for this step from app
                                                                                              -
                                                                                              edit
                                                                                              -
                                                                                              Either a single function or a list of functions for opening a modal in the builder UI -When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                              -
                                                                                              save
                                                                                              -
                                                                                              Either a single function or a list of functions for handling modal interactions in the builder UI -When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                              -
                                                                                              execute
                                                                                              -
                                                                                              Either a single function or a list of functions for handling step from app executions -When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                              -
                                                                                              app_name
                                                                                              -
                                                                                              The app name that can be mainly used for logging
                                                                                              -
                                                                                              base_logger
                                                                                              -
                                                                                              The logger instance that can be used as a template when creating this step's logger
                                                                                              -
                                                                                              Expand source code @@ -554,6 +544,27 @@

                                                                                              Args

                                                                                              else: raise ValueError(f"Invalid name {name}")
                                                                                              +

                                                                                              Deprecated

                                                                                              +

                                                                                              Steps from apps for legacy workflows are now deprecated. +Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                              +

                                                                                              Args

                                                                                              +
                                                                                              +
                                                                                              callback_id
                                                                                              +
                                                                                              The callback_id for this step from app
                                                                                              +
                                                                                              edit
                                                                                              +
                                                                                              Either a single function or a list of functions for opening a modal in the builder UI +When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                              +
                                                                                              save
                                                                                              +
                                                                                              Either a single function or a list of functions for handling modal interactions in the builder UI +When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                              +
                                                                                              execute
                                                                                              +
                                                                                              Either a single function or a list of functions for handling step from app executions +When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                              +
                                                                                              app_name
                                                                                              +
                                                                                              The app name that can be mainly used for logging
                                                                                              +
                                                                                              base_logger
                                                                                              +
                                                                                              The logger instance that can be used as a template when creating this step's logger
                                                                                              +

                                                                                              Class variables

                                                                                              var callback_id : str | Pattern
                                                                                              @@ -596,7 +607,6 @@

                                                                                              Static methods

                                                                                              (step: WorkflowStep)
                                                                                              -

                                                                                              Base middleware for step from app specific ones

                                                                                              Expand source code @@ -650,6 +660,7 @@

                                                                                              Static methods

                                                                                              listener=listener, )
                                                                                              +

                                                                                              Base middleware for step from app specific ones

                                                                                              Ancestors

                                                                                              • Middleware
                                                                                              • @@ -721,7 +732,7 @@

                                                                                                -

                                                                                                Generated by pdoc 0.11.3.

                                                                                                +

                                                                                                Generated by pdoc 0.11.5.

                                                                                                diff --git a/docs/static/api-docs/slack_bolt/workflows/step/internals.html b/docs/static/api-docs/slack_bolt/workflows/step/internals.html index 5b6300d0..f2067677 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/internals.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/internals.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.internals API documentation - + @@ -49,7 +60,7 @@

                                                                                                Module slack_bolt.workflows.step.internals

                                                                                                diff --git a/docs/static/api-docs/slack_bolt/workflows/step/step.html b/docs/static/api-docs/slack_bolt/workflows/step/step.html index 6030a2dd..c1500bea 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/step.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/step.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.step API documentation - + @@ -40,27 +51,6 @@

                                                                                                Classes

                                                                                                (*,
                                                                                                callback_id: str | Pattern,
                                                                                                edit: Callable[..., BoltResponse | None] | Listener | Sequence[Callable],
                                                                                                save: Callable[..., BoltResponse | None] | Listener | Sequence[Callable],
                                                                                                execute: Callable[..., BoltResponse | None] | Listener | Sequence[Callable],
                                                                                                app_name: str | None = None,
                                                                                                base_logger: logging.Logger | None = None)
                                                                                                -

                                                                                                Deprecated

                                                                                                -

                                                                                                Steps from apps for legacy workflows are now deprecated. -Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                                -

                                                                                                Args

                                                                                                -
                                                                                                -
                                                                                                callback_id
                                                                                                -
                                                                                                The callback_id for this step from app
                                                                                                -
                                                                                                edit
                                                                                                -
                                                                                                Either a single function or a list of functions for opening a modal in the builder UI -When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                                -
                                                                                                save
                                                                                                -
                                                                                                Either a single function or a list of functions for handling modal interactions in the builder UI -When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                                -
                                                                                                execute
                                                                                                -
                                                                                                Either a single function or a list of functions for handling step from app executions -When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                                -
                                                                                                app_name
                                                                                                -
                                                                                                The app name that can be mainly used for logging
                                                                                                -
                                                                                                base_logger
                                                                                                -
                                                                                                The logger instance that can be used as a template when creating this step's logger
                                                                                                -
                                                                                                Expand source code @@ -221,6 +211,27 @@

                                                                                                Args

                                                                                                else: raise ValueError(f"Invalid name {name}")
                                                                                                +

                                                                                                Deprecated

                                                                                                +

                                                                                                Steps from apps for legacy workflows are now deprecated. +Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                                +

                                                                                                Args

                                                                                                +
                                                                                                +
                                                                                                callback_id
                                                                                                +
                                                                                                The callback_id for this step from app
                                                                                                +
                                                                                                edit
                                                                                                +
                                                                                                Either a single function or a list of functions for opening a modal in the builder UI +When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                                +
                                                                                                save
                                                                                                +
                                                                                                Either a single function or a list of functions for handling modal interactions in the builder UI +When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                                +
                                                                                                execute
                                                                                                +
                                                                                                Either a single function or a list of functions for handling step from app executions +When it's a list, the first one is responsible for ack() while the rest are lazy listeners.
                                                                                                +
                                                                                                app_name
                                                                                                +
                                                                                                The app name that can be mainly used for logging
                                                                                                +
                                                                                                base_logger
                                                                                                +
                                                                                                The logger instance that can be used as a template when creating this step's logger
                                                                                                +

                                                                                                Class variables

                                                                                                var callback_id : str | Pattern
                                                                                                @@ -263,36 +274,6 @@

                                                                                                Static methods

                                                                                                (callback_id: str | Pattern,
                                                                                                app_name: str | None = None,
                                                                                                base_logger: logging.Logger | None = None)
                                                                                                -

                                                                                                Steps from apps -Refer to https://api.slack.com/workflows/steps for details.

                                                                                                -

                                                                                                Deprecated

                                                                                                -

                                                                                                Steps from apps for legacy workflows are now deprecated. -Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                                -

                                                                                                This builder is supposed to be used as decorator.

                                                                                                -
                                                                                                my_step = WorkflowStep.builder("my_step")
                                                                                                -@my_step.edit
                                                                                                -def edit_my_step(ack, configure):
                                                                                                -    pass
                                                                                                -@my_step.save
                                                                                                -def save_my_step(ack, step, update):
                                                                                                -    pass
                                                                                                -@my_step.execute
                                                                                                -def execute_my_step(step, complete, fail):
                                                                                                -    pass
                                                                                                -app.step(my_step)
                                                                                                -
                                                                                                -

                                                                                                For further information about WorkflowStep specific function arguments -such as configure, update, complete, and fail, -refer to slack_bolt.workflows.step.utilities API documents.

                                                                                                -

                                                                                                Args

                                                                                                -
                                                                                                -
                                                                                                callback_id
                                                                                                -
                                                                                                The callback_id for the workflow
                                                                                                -
                                                                                                app_name
                                                                                                -
                                                                                                The application name mainly for logging
                                                                                                -
                                                                                                base_logger
                                                                                                -
                                                                                                The base logger
                                                                                                -
                                                                                                Expand source code @@ -602,11 +583,41 @@

                                                                                                Args

                                                                                                raise ValueError(f"Invalid middleware: {type(m)}") return _middleware
                                                                                                +

                                                                                                Steps from apps +Refer to https://api.slack.com/workflows/steps for details.

                                                                                                +

                                                                                                Deprecated

                                                                                                +

                                                                                                Steps from apps for legacy workflows are now deprecated. +Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                                +

                                                                                                This builder is supposed to be used as decorator.

                                                                                                +
                                                                                                my_step = WorkflowStep.builder("my_step")
                                                                                                +@my_step.edit
                                                                                                +def edit_my_step(ack, configure):
                                                                                                +    pass
                                                                                                +@my_step.save
                                                                                                +def save_my_step(ack, step, update):
                                                                                                +    pass
                                                                                                +@my_step.execute
                                                                                                +def execute_my_step(step, complete, fail):
                                                                                                +    pass
                                                                                                +app.step(my_step)
                                                                                                +
                                                                                                +

                                                                                                For further information about WorkflowStep specific function arguments +such as configure, update, complete, and fail, +refer to slack_bolt.workflows.step.utilities API documents.

                                                                                                +

                                                                                                Args

                                                                                                +
                                                                                                +
                                                                                                callback_id
                                                                                                +
                                                                                                The callback_id for the workflow
                                                                                                +
                                                                                                app_name
                                                                                                +
                                                                                                The application name mainly for logging
                                                                                                +
                                                                                                base_logger
                                                                                                +
                                                                                                The base logger
                                                                                                +

                                                                                                Class variables

                                                                                                var callback_id : str | Pattern
                                                                                                -
                                                                                                +

                                                                                                The type of the None singleton.

                                                                                                Static methods

                                                                                                @@ -615,12 +626,66 @@

                                                                                                Static methods

                                                                                                def to_listener_matchers(app_name: str,
                                                                                                matchers: List[ListenerMatcher | Callable[..., bool]] | None,
                                                                                                base_logger: logging.Logger | None = None) ‑> List[ListenerMatcher]
                                                                                                +
                                                                                                + +Expand source code + +
                                                                                                @staticmethod
                                                                                                +def to_listener_matchers(
                                                                                                +    app_name: str,
                                                                                                +    matchers: Optional[List[Union[Callable[..., bool], ListenerMatcher]]],
                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                +) -> List[ListenerMatcher]:
                                                                                                +    _matchers = []
                                                                                                +    if matchers is not None:
                                                                                                +        for m in matchers:
                                                                                                +            if isinstance(m, ListenerMatcher):
                                                                                                +                _matchers.append(m)
                                                                                                +            elif isinstance(m, Callable):
                                                                                                +                _matchers.append(
                                                                                                +                    CustomListenerMatcher(
                                                                                                +                        app_name=app_name,
                                                                                                +                        func=m,
                                                                                                +                        base_logger=base_logger,
                                                                                                +                    )
                                                                                                +                )
                                                                                                +            else:
                                                                                                +                raise ValueError(f"Invalid matcher: {type(m)}")
                                                                                                +    return _matchers
                                                                                                +
                                                                                                def to_listener_middleware(app_name: str,
                                                                                                middleware: List[Callable | Middleware] | None,
                                                                                                base_logger: logging.Logger | None = None) ‑> List[Middleware]
                                                                                                +
                                                                                                + +Expand source code + +
                                                                                                @staticmethod
                                                                                                +def to_listener_middleware(
                                                                                                +    app_name: str,
                                                                                                +    middleware: Optional[List[Union[Callable, Middleware]]],
                                                                                                +    base_logger: Optional[Logger] = None,
                                                                                                +) -> List[Middleware]:
                                                                                                +    _middleware = []
                                                                                                +    if middleware is not None:
                                                                                                +        for m in middleware:
                                                                                                +            if isinstance(m, Middleware):
                                                                                                +                _middleware.append(m)
                                                                                                +            elif isinstance(m, Callable):
                                                                                                +                _middleware.append(
                                                                                                +                    CustomMiddleware(
                                                                                                +                        app_name=app_name,
                                                                                                +                        func=m,
                                                                                                +                        base_logger=base_logger,
                                                                                                +                    )
                                                                                                +                )
                                                                                                +            else:
                                                                                                +                raise ValueError(f"Invalid middleware: {type(m)}")
                                                                                                +    return _middleware
                                                                                                +
                                                                                                @@ -630,6 +695,38 @@

                                                                                                Methods

                                                                                                def build(self, base_logger: logging.Logger | None = None) ‑> WorkflowStep
                                                                                                +
                                                                                                + +Expand source code + +
                                                                                                def build(self, base_logger: Optional[Logger] = None) -> "WorkflowStep":
                                                                                                +    """
                                                                                                +    Deprecated:
                                                                                                +        Steps from apps for legacy workflows are now deprecated.
                                                                                                +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                                                                +
                                                                                                +    Constructs a WorkflowStep object. This method may raise an exception
                                                                                                +    if the builder doesn't have enough configurations to build the object.
                                                                                                +
                                                                                                +    Returns:
                                                                                                +        WorkflowStep object
                                                                                                +    """
                                                                                                +    if self._edit is None:
                                                                                                +        raise BoltError("edit listener is not registered")
                                                                                                +    if self._save is None:
                                                                                                +        raise BoltError("save listener is not registered")
                                                                                                +    if self._execute is None:
                                                                                                +        raise BoltError("execute listener is not registered")
                                                                                                +
                                                                                                +    return WorkflowStep(
                                                                                                +        callback_id=self.callback_id,
                                                                                                +        edit=self._edit,
                                                                                                +        save=self._save,
                                                                                                +        execute=self._execute,
                                                                                                +        app_name=self.app_name,
                                                                                                +        base_logger=base_logger,
                                                                                                +    )
                                                                                                +

                                                                                                Deprecated

                                                                                                Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                                @@ -642,6 +739,64 @@

                                                                                                Returns

                                                                                                def edit(self,
                                                                                                *args,
                                                                                                matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                                middleware: Callable | Middleware | None = None,
                                                                                                lazy: List[Callable[..., None]] | None = None)
                                                                                                +
                                                                                                + +Expand source code + +
                                                                                                def edit(
                                                                                                +    self,
                                                                                                +    *args,
                                                                                                +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                                +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                                +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                +):
                                                                                                +    """
                                                                                                +    Deprecated:
                                                                                                +        Steps from apps for legacy workflows are now deprecated.
                                                                                                +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                                                                +
                                                                                                +    Registers a new edit listener with details.
                                                                                                +
                                                                                                +    You can use this method as decorator as well.
                                                                                                +
                                                                                                +        @my_step.edit
                                                                                                +        def edit_my_step(ack, configure):
                                                                                                +            pass
                                                                                                +
                                                                                                +    It's also possible to add additional listener matchers and/or middleware
                                                                                                +
                                                                                                +        @my_step.edit(matchers=[is_valid], middleware=[update_context])
                                                                                                +        def edit_my_step(ack, configure):
                                                                                                +            pass
                                                                                                +
                                                                                                +    For further information about WorkflowStep specific function arguments
                                                                                                +    such as `configure`, `update`, `complete`, and `fail`,
                                                                                                +    refer to `slack_bolt.workflows.step.utilities` API documents.
                                                                                                +
                                                                                                +    Args:
                                                                                                +        *args: This method can behave as either decorator or a method
                                                                                                +        matchers: Listener matchers
                                                                                                +        middleware: Listener middleware
                                                                                                +        lazy: Lazy listeners
                                                                                                +    """
                                                                                                +
                                                                                                +    if _is_used_without_argument(args):
                                                                                                +        func = args[0]
                                                                                                +        self._edit = self._to_listener("edit", func, matchers, middleware)
                                                                                                +        return func
                                                                                                +
                                                                                                +    def _inner(func):
                                                                                                +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                +        self._edit = self._to_listener("edit", functions, matchers, middleware)
                                                                                                +
                                                                                                +        @wraps(func)
                                                                                                +        def _wrapper(*args, **kwargs):
                                                                                                +            return func(*args, **kwargs)
                                                                                                +
                                                                                                +        return _wrapper
                                                                                                +
                                                                                                +    return _inner
                                                                                                +

                                                                                                Deprecated

                                                                                                Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                                @@ -675,6 +830,63 @@

                                                                                                Args

                                                                                                def execute(self,
                                                                                                *args,
                                                                                                matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                                middleware: Callable | Middleware | None = None,
                                                                                                lazy: List[Callable[..., None]] | None = None)
                                                                                                +
                                                                                                + +Expand source code + +
                                                                                                def execute(
                                                                                                +    self,
                                                                                                +    *args,
                                                                                                +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                                +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                                +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                +):
                                                                                                +    """
                                                                                                +    Deprecated:
                                                                                                +        Steps from apps for legacy workflows are now deprecated.
                                                                                                +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                                                                +
                                                                                                +    Registers a new execute listener with details.
                                                                                                +
                                                                                                +    You can use this method as decorator as well.
                                                                                                +
                                                                                                +        @my_step.execute
                                                                                                +        def execute_my_step(step, complete, fail):
                                                                                                +            pass
                                                                                                +
                                                                                                +    It's also possible to add additional listener matchers and/or middleware
                                                                                                +
                                                                                                +        @my_step.save(matchers=[is_valid], middleware=[update_context])
                                                                                                +        def execute_my_step(step, complete, fail):
                                                                                                +            pass
                                                                                                +
                                                                                                +    For further information about WorkflowStep specific function arguments
                                                                                                +    such as `configure`, `update`, `complete`, and `fail`,
                                                                                                +    refer to `slack_bolt.workflows.step.utilities` API documents.
                                                                                                +
                                                                                                +    Args:
                                                                                                +        *args: This method can behave as either decorator or a method
                                                                                                +        matchers: Listener matchers
                                                                                                +        middleware: Listener middleware
                                                                                                +        lazy: Lazy listeners
                                                                                                +    """
                                                                                                +    if _is_used_without_argument(args):
                                                                                                +        func = args[0]
                                                                                                +        self._execute = self._to_listener("execute", func, matchers, middleware)
                                                                                                +        return func
                                                                                                +
                                                                                                +    def _inner(func):
                                                                                                +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                +        self._execute = self._to_listener("execute", functions, matchers, middleware)
                                                                                                +
                                                                                                +        @wraps(func)
                                                                                                +        def _wrapper(*args, **kwargs):
                                                                                                +            return func(*args, **kwargs)
                                                                                                +
                                                                                                +        return _wrapper
                                                                                                +
                                                                                                +    return _inner
                                                                                                +

                                                                                                Deprecated

                                                                                                Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                                @@ -708,6 +920,63 @@

                                                                                                Args

                                                                                                def save(self,
                                                                                                *args,
                                                                                                matchers: Callable[..., bool] | ListenerMatcher | None = None,
                                                                                                middleware: Callable | Middleware | None = None,
                                                                                                lazy: List[Callable[..., None]] | None = None)
                                                                                                +
                                                                                                + +Expand source code + +
                                                                                                def save(
                                                                                                +    self,
                                                                                                +    *args,
                                                                                                +    matchers: Optional[Union[Callable[..., bool], ListenerMatcher]] = None,
                                                                                                +    middleware: Optional[Union[Callable, Middleware]] = None,
                                                                                                +    lazy: Optional[List[Callable[..., None]]] = None,
                                                                                                +):
                                                                                                +    """
                                                                                                +    Deprecated:
                                                                                                +        Steps from apps for legacy workflows are now deprecated.
                                                                                                +        Use new custom steps: https://api.slack.com/automation/functions/custom-bolt
                                                                                                +
                                                                                                +    Registers a new save listener with details.
                                                                                                +
                                                                                                +    You can use this method as decorator as well.
                                                                                                +
                                                                                                +        @my_step.save
                                                                                                +        def save_my_step(ack, step, update):
                                                                                                +            pass
                                                                                                +
                                                                                                +    It's also possible to add additional listener matchers and/or middleware
                                                                                                +
                                                                                                +        @my_step.save(matchers=[is_valid], middleware=[update_context])
                                                                                                +        def save_my_step(ack, step, update):
                                                                                                +            pass
                                                                                                +
                                                                                                +    For further information about WorkflowStep specific function arguments
                                                                                                +    such as `configure`, `update`, `complete`, and `fail`,
                                                                                                +    refer to `slack_bolt.workflows.step.utilities` API documents.
                                                                                                +
                                                                                                +    Args:
                                                                                                +        *args: This method can behave as either decorator or a method
                                                                                                +        matchers: Listener matchers
                                                                                                +        middleware: Listener middleware
                                                                                                +        lazy: Lazy listeners
                                                                                                +    """
                                                                                                +    if _is_used_without_argument(args):
                                                                                                +        func = args[0]
                                                                                                +        self._save = self._to_listener("save", func, matchers, middleware)
                                                                                                +        return func
                                                                                                +
                                                                                                +    def _inner(func):
                                                                                                +        functions = [func] + (lazy if lazy is not None else [])
                                                                                                +        self._save = self._to_listener("save", functions, matchers, middleware)
                                                                                                +
                                                                                                +        @wraps(func)
                                                                                                +        def _wrapper(*args, **kwargs):
                                                                                                +            return func(*args, **kwargs)
                                                                                                +
                                                                                                +        return _wrapper
                                                                                                +
                                                                                                +    return _inner
                                                                                                +

                                                                                                Deprecated

                                                                                                Steps from apps for legacy workflows are now deprecated. Use new custom steps: https://api.slack.com/automation/functions/custom-bolt

                                                                                                @@ -783,7 +1052,7 @@

                                                                                                -

                                                                                                Generated by pdoc 0.11.3.

                                                                                                +

                                                                                                Generated by pdoc 0.11.5.

                                                                                                diff --git a/docs/static/api-docs/slack_bolt/workflows/step/step_middleware.html b/docs/static/api-docs/slack_bolt/workflows/step/step_middleware.html index 62e00b9e..58a1c619 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/step_middleware.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/step_middleware.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.step_middleware API documentation - + @@ -40,7 +51,6 @@

                                                                                                Classes

                                                                                                (step: WorkflowStep)
                                                                                                -

                                                                                                Base middleware for step from app specific ones

                                                                                                Expand source code @@ -94,6 +104,7 @@

                                                                                                Classes

                                                                                                listener=listener, )
                                                                                                +

                                                                                                Base middleware for step from app specific ones

                                                                                                Ancestors

                                                                                                • Middleware
                                                                                                • @@ -132,7 +143,7 @@

                                                                                                  -

                                                                                                  Generated by pdoc 0.11.3.

                                                                                                  +

                                                                                                  Generated by pdoc 0.11.5.

                                                                                                  diff --git a/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_complete.html b/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_complete.html index 629ceff2..7dc7744a 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_complete.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_complete.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.utilities.async_complete API documentation - + @@ -40,26 +51,6 @@

                                                                                                  Classes

                                                                                                  (*, client: slack_sdk.web.async_client.AsyncWebClient, body: dict)
                                                                                                  -

                                                                                                  complete() utility to tell Slack the completion of a step from app execution.

                                                                                                  -
                                                                                                  async def execute(step, complete, fail):
                                                                                                  -    inputs = step["inputs"]
                                                                                                  -    # if everything was successful
                                                                                                  -    outputs = {
                                                                                                  -        "task_name": inputs["task_name"]["value"],
                                                                                                  -        "task_description": inputs["task_description"]["value"],
                                                                                                  -    }
                                                                                                  -    await complete(outputs=outputs)
                                                                                                  -
                                                                                                  -ws = AsyncWorkflowStep(
                                                                                                  -    callback_id="add_task",
                                                                                                  -    edit=edit,
                                                                                                  -    save=save,
                                                                                                  -    execute=execute,
                                                                                                  -)
                                                                                                  -app.step(ws)
                                                                                                  -
                                                                                                  -

                                                                                                  This utility is a thin wrapper of workflows.stepCompleted API method. -Refer to https://api.slack.com/methods/workflows.stepCompleted for details.

                                                                                                  Expand source code @@ -98,6 +89,26 @@

                                                                                                  Classes

                                                                                                  **kwargs, )
                                                                                                  +

                                                                                                  complete() utility to tell Slack the completion of a step from app execution.

                                                                                                  +
                                                                                                  async def execute(step, complete, fail):
                                                                                                  +    inputs = step["inputs"]
                                                                                                  +    # if everything was successful
                                                                                                  +    outputs = {
                                                                                                  +        "task_name": inputs["task_name"]["value"],
                                                                                                  +        "task_description": inputs["task_description"]["value"],
                                                                                                  +    }
                                                                                                  +    await complete(outputs=outputs)
                                                                                                  +
                                                                                                  +ws = AsyncWorkflowStep(
                                                                                                  +    callback_id="add_task",
                                                                                                  +    edit=edit,
                                                                                                  +    save=save,
                                                                                                  +    execute=execute,
                                                                                                  +)
                                                                                                  +app.step(ws)
                                                                                                  +
                                                                                                  +

                                                                                                  This utility is a thin wrapper of workflows.stepCompleted API method. +Refer to https://api.slack.com/methods/workflows.stepCompleted for details.

                                                                                              @@ -123,7 +134,7 @@

                                                                                              -

                                                                                              Generated by pdoc 0.11.3.

                                                                                              +

                                                                                              Generated by pdoc 0.11.5.

                                                                                              diff --git a/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_configure.html b/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_configure.html index 0e89e178..1e0395e9 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_configure.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_configure.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.utilities.async_configure API documentation - + @@ -40,33 +51,6 @@

                                                                                              Classes

                                                                                              (*,
                                                                                              callback_id: str,
                                                                                              client: slack_sdk.web.async_client.AsyncWebClient,
                                                                                              body: dict)
                                                                                              -

                                                                                              configure() utility to send the modal view in Workflow Builder.

                                                                                              -
                                                                                              async def edit(ack, step, configure):
                                                                                              -    await ack()
                                                                                              -
                                                                                              -    blocks = [
                                                                                              -        {
                                                                                              -            "type": "input",
                                                                                              -            "block_id": "task_name_input",
                                                                                              -            "element": {
                                                                                              -                "type": "plain_text_input",
                                                                                              -                "action_id": "name",
                                                                                              -                "placeholder": {"type": "plain_text", "text": "Add a task name"},
                                                                                              -            },
                                                                                              -            "label": {"type": "plain_text", "text": "Task name"},
                                                                                              -        },
                                                                                              -    ]
                                                                                              -    await configure(blocks=blocks)
                                                                                              -
                                                                                              -ws = AsyncWorkflowStep(
                                                                                              -    callback_id="add_task",
                                                                                              -    edit=edit,
                                                                                              -    save=save,
                                                                                              -    execute=execute,
                                                                                              -)
                                                                                              -app.step(ws)
                                                                                              -
                                                                                              -

                                                                                              Refer to https://api.slack.com/workflows/steps for details.

                                                                                              Expand source code @@ -121,6 +105,33 @@

                                                                                              Classes

                                                                                              }, )
                                                                                              +

                                                                                              configure() utility to send the modal view in Workflow Builder.

                                                                                              +
                                                                                              async def edit(ack, step, configure):
                                                                                              +    await ack()
                                                                                              +
                                                                                              +    blocks = [
                                                                                              +        {
                                                                                              +            "type": "input",
                                                                                              +            "block_id": "task_name_input",
                                                                                              +            "element": {
                                                                                              +                "type": "plain_text_input",
                                                                                              +                "action_id": "name",
                                                                                              +                "placeholder": {"type": "plain_text", "text": "Add a task name"},
                                                                                              +            },
                                                                                              +            "label": {"type": "plain_text", "text": "Task name"},
                                                                                              +        },
                                                                                              +    ]
                                                                                              +    await configure(blocks=blocks)
                                                                                              +
                                                                                              +ws = AsyncWorkflowStep(
                                                                                              +    callback_id="add_task",
                                                                                              +    edit=edit,
                                                                                              +    save=save,
                                                                                              +    execute=execute,
                                                                                              +)
                                                                                              +app.step(ws)
                                                                                              +
                                                                                              +

                                                                                              Refer to https://api.slack.com/workflows/steps for details.

                                                                                            @@ -146,7 +157,7 @@

                                                                                            -

                                                                                            Generated by pdoc 0.11.3.

                                                                                            +

                                                                                            Generated by pdoc 0.11.5.

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_fail.html b/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_fail.html index 220a5025..68317468 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_fail.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_fail.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.utilities.async_fail API documentation - + @@ -40,23 +51,6 @@

                                                                                            Classes

                                                                                            (*, client: slack_sdk.web.async_client.AsyncWebClient, body: dict)
                                                                                            -

                                                                                            fail() utility to tell Slack the execution failure of a step from app.

                                                                                            -
                                                                                            async def execute(step, complete, fail):
                                                                                            -    inputs = step["inputs"]
                                                                                            -    # if something went wrong
                                                                                            -    error = {"message": "Just testing step failure!"}
                                                                                            -    await fail(error=error)
                                                                                            -
                                                                                            -ws = AsyncWorkflowStep(
                                                                                            -    callback_id="add_task",
                                                                                            -    edit=edit,
                                                                                            -    save=save,
                                                                                            -    execute=execute,
                                                                                            -)
                                                                                            -app.step(ws)
                                                                                            -
                                                                                            -

                                                                                            This utility is a thin wrapper of workflows.stepFailed API method. -Refer to https://api.slack.com/methods/workflows.stepFailed for details.

                                                                                            Expand source code @@ -96,6 +90,23 @@

                                                                                            Classes

                                                                                            error=error, )
                                                                                            +

                                                                                            fail() utility to tell Slack the execution failure of a step from app.

                                                                                            +
                                                                                            async def execute(step, complete, fail):
                                                                                            +    inputs = step["inputs"]
                                                                                            +    # if something went wrong
                                                                                            +    error = {"message": "Just testing step failure!"}
                                                                                            +    await fail(error=error)
                                                                                            +
                                                                                            +ws = AsyncWorkflowStep(
                                                                                            +    callback_id="add_task",
                                                                                            +    edit=edit,
                                                                                            +    save=save,
                                                                                            +    execute=execute,
                                                                                            +)
                                                                                            +app.step(ws)
                                                                                            +
                                                                                            +

                                                                                            This utility is a thin wrapper of workflows.stepFailed API method. +Refer to https://api.slack.com/methods/workflows.stepFailed for details.

                                                                                            @@ -121,7 +132,7 @@

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_update.html b/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_update.html index 45692da2..8b8282fa 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_update.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/utilities/async_update.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.utilities.async_update API documentation - + @@ -40,42 +51,6 @@

                                                                                            Classes

                                                                                            (*, client: slack_sdk.web.async_client.AsyncWebClient, body: dict)
                                                                                            -

                                                                                            update() utility to tell Slack the processing results of a save listener.

                                                                                            -
                                                                                            async def save(ack, view, update):
                                                                                            -    await ack()
                                                                                            -
                                                                                            -    values = view["state"]["values"]
                                                                                            -    task_name = values["task_name_input"]["name"]
                                                                                            -    task_description = values["task_description_input"]["description"]
                                                                                            -
                                                                                            -    inputs = {
                                                                                            -        "task_name": {"value": task_name["value"]},
                                                                                            -        "task_description": {"value": task_description["value"]}
                                                                                            -    }
                                                                                            -    outputs = [
                                                                                            -        {
                                                                                            -            "type": "text",
                                                                                            -            "name": "task_name",
                                                                                            -            "label": "Task name",
                                                                                            -        },
                                                                                            -        {
                                                                                            -            "type": "text",
                                                                                            -            "name": "task_description",
                                                                                            -            "label": "Task description",
                                                                                            -        }
                                                                                            -    ]
                                                                                            -    await update(inputs=inputs, outputs=outputs)
                                                                                            -
                                                                                            -ws = AsyncWorkflowStep(
                                                                                            -    callback_id="add_task",
                                                                                            -    edit=edit,
                                                                                            -    save=save,
                                                                                            -    execute=execute,
                                                                                            -)
                                                                                            -app.step(ws)
                                                                                            -
                                                                                            -

                                                                                            This utility is a thin wrapper of workflows.stepFailed API method. -Refer to https://api.slack.com/methods/workflows.updateStep for details.

                                                                                            Expand source code @@ -130,6 +105,42 @@

                                                                                            Classes

                                                                                            **kwargs, )
                                                                                            +

                                                                                            update() utility to tell Slack the processing results of a save listener.

                                                                                            +
                                                                                            async def save(ack, view, update):
                                                                                            +    await ack()
                                                                                            +
                                                                                            +    values = view["state"]["values"]
                                                                                            +    task_name = values["task_name_input"]["name"]
                                                                                            +    task_description = values["task_description_input"]["description"]
                                                                                            +
                                                                                            +    inputs = {
                                                                                            +        "task_name": {"value": task_name["value"]},
                                                                                            +        "task_description": {"value": task_description["value"]}
                                                                                            +    }
                                                                                            +    outputs = [
                                                                                            +        {
                                                                                            +            "type": "text",
                                                                                            +            "name": "task_name",
                                                                                            +            "label": "Task name",
                                                                                            +        },
                                                                                            +        {
                                                                                            +            "type": "text",
                                                                                            +            "name": "task_description",
                                                                                            +            "label": "Task description",
                                                                                            +        }
                                                                                            +    ]
                                                                                            +    await update(inputs=inputs, outputs=outputs)
                                                                                            +
                                                                                            +ws = AsyncWorkflowStep(
                                                                                            +    callback_id="add_task",
                                                                                            +    edit=edit,
                                                                                            +    save=save,
                                                                                            +    execute=execute,
                                                                                            +)
                                                                                            +app.step(ws)
                                                                                            +
                                                                                            +

                                                                                            This utility is a thin wrapper of workflows.stepFailed API method. +Refer to https://api.slack.com/methods/workflows.updateStep for details.

                                                                                            @@ -155,7 +166,7 @@

                                                                                            -

                                                                                            Generated by pdoc 0.11.3.

                                                                                            +

                                                                                            Generated by pdoc 0.11.5.

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/workflows/step/utilities/complete.html b/docs/static/api-docs/slack_bolt/workflows/step/utilities/complete.html index 0243a8e1..685a3bd6 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/utilities/complete.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/utilities/complete.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.utilities.complete API documentation - + @@ -40,26 +51,6 @@

                                                                                            Classes

                                                                                            (*, client: slack_sdk.web.client.WebClient, body: dict)
                                                                                            -

                                                                                            complete() utility to tell Slack the completion of a step from app execution.

                                                                                            -
                                                                                            def execute(step, complete, fail):
                                                                                            -    inputs = step["inputs"]
                                                                                            -    # if everything was successful
                                                                                            -    outputs = {
                                                                                            -        "task_name": inputs["task_name"]["value"],
                                                                                            -        "task_description": inputs["task_description"]["value"],
                                                                                            -    }
                                                                                            -    complete(outputs=outputs)
                                                                                            -
                                                                                            -ws = WorkflowStep(
                                                                                            -    callback_id="add_task",
                                                                                            -    edit=edit,
                                                                                            -    save=save,
                                                                                            -    execute=execute,
                                                                                            -)
                                                                                            -app.step(ws)
                                                                                            -
                                                                                            -

                                                                                            This utility is a thin wrapper of workflows.stepCompleted API method. -Refer to https://api.slack.com/methods/workflows.stepCompleted for details.

                                                                                            Expand source code @@ -98,6 +89,26 @@

                                                                                            Classes

                                                                                            **kwargs, )
                                                                                            +

                                                                                            complete() utility to tell Slack the completion of a step from app execution.

                                                                                            +
                                                                                            def execute(step, complete, fail):
                                                                                            +    inputs = step["inputs"]
                                                                                            +    # if everything was successful
                                                                                            +    outputs = {
                                                                                            +        "task_name": inputs["task_name"]["value"],
                                                                                            +        "task_description": inputs["task_description"]["value"],
                                                                                            +    }
                                                                                            +    complete(outputs=outputs)
                                                                                            +
                                                                                            +ws = WorkflowStep(
                                                                                            +    callback_id="add_task",
                                                                                            +    edit=edit,
                                                                                            +    save=save,
                                                                                            +    execute=execute,
                                                                                            +)
                                                                                            +app.step(ws)
                                                                                            +
                                                                                            +

                                                                                            This utility is a thin wrapper of workflows.stepCompleted API method. +Refer to https://api.slack.com/methods/workflows.stepCompleted for details.

                                                                                            @@ -123,7 +134,7 @@

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/workflows/step/utilities/configure.html b/docs/static/api-docs/slack_bolt/workflows/step/utilities/configure.html index eabf41e6..8199f9ea 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/utilities/configure.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/utilities/configure.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.utilities.configure API documentation - + @@ -40,33 +51,6 @@

                                                                                            Classes

                                                                                            (*, callback_id: str, client: slack_sdk.web.client.WebClient, body: dict)
                                                                                            -

                                                                                            configure() utility to send the modal view in Workflow Builder.

                                                                                            -
                                                                                            def edit(ack, step, configure):
                                                                                            -    ack()
                                                                                            -
                                                                                            -    blocks = [
                                                                                            -        {
                                                                                            -            "type": "input",
                                                                                            -            "block_id": "task_name_input",
                                                                                            -            "element": {
                                                                                            -                "type": "plain_text_input",
                                                                                            -                "action_id": "name",
                                                                                            -                "placeholder": {"type": "plain_text", "text": "Add a task name"},
                                                                                            -            },
                                                                                            -            "label": {"type": "plain_text", "text": "Task name"},
                                                                                            -        },
                                                                                            -    ]
                                                                                            -    configure(blocks=blocks)
                                                                                            -
                                                                                            -ws = WorkflowStep(
                                                                                            -    callback_id="add_task",
                                                                                            -    edit=edit,
                                                                                            -    save=save,
                                                                                            -    execute=execute,
                                                                                            -)
                                                                                            -app.step(ws)
                                                                                            -
                                                                                            -

                                                                                            Refer to https://api.slack.com/workflows/steps for details.

                                                                                            Expand source code @@ -118,6 +102,33 @@

                                                                                            Classes

                                                                                            }, )
                                                                                            +

                                                                                            configure() utility to send the modal view in Workflow Builder.

                                                                                            +
                                                                                            def edit(ack, step, configure):
                                                                                            +    ack()
                                                                                            +
                                                                                            +    blocks = [
                                                                                            +        {
                                                                                            +            "type": "input",
                                                                                            +            "block_id": "task_name_input",
                                                                                            +            "element": {
                                                                                            +                "type": "plain_text_input",
                                                                                            +                "action_id": "name",
                                                                                            +                "placeholder": {"type": "plain_text", "text": "Add a task name"},
                                                                                            +            },
                                                                                            +            "label": {"type": "plain_text", "text": "Task name"},
                                                                                            +        },
                                                                                            +    ]
                                                                                            +    configure(blocks=blocks)
                                                                                            +
                                                                                            +ws = WorkflowStep(
                                                                                            +    callback_id="add_task",
                                                                                            +    edit=edit,
                                                                                            +    save=save,
                                                                                            +    execute=execute,
                                                                                            +)
                                                                                            +app.step(ws)
                                                                                            +
                                                                                            +

                                                                                            Refer to https://api.slack.com/workflows/steps for details.

                                                                                            @@ -143,7 +154,7 @@

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/workflows/step/utilities/fail.html b/docs/static/api-docs/slack_bolt/workflows/step/utilities/fail.html index 9a878c2c..071bbbfe 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/utilities/fail.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/utilities/fail.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.utilities.fail API documentation - + @@ -40,23 +51,6 @@

                                                                                            Classes

                                                                                            (*, client: slack_sdk.web.client.WebClient, body: dict)
                                                                                            -

                                                                                            fail() utility to tell Slack the execution failure of a step from app.

                                                                                            -
                                                                                            def execute(step, complete, fail):
                                                                                            -    inputs = step["inputs"]
                                                                                            -    # if something went wrong
                                                                                            -    error = {"message": "Just testing step failure!"}
                                                                                            -    fail(error=error)
                                                                                            -
                                                                                            -ws = WorkflowStep(
                                                                                            -    callback_id="add_task",
                                                                                            -    edit=edit,
                                                                                            -    save=save,
                                                                                            -    execute=execute,
                                                                                            -)
                                                                                            -app.step(ws)
                                                                                            -
                                                                                            -

                                                                                            This utility is a thin wrapper of workflows.stepFailed API method. -Refer to https://api.slack.com/methods/workflows.stepFailed for details.

                                                                                            Expand source code @@ -96,6 +90,23 @@

                                                                                            Classes

                                                                                            error=error, )
                                                                                            +

                                                                                            fail() utility to tell Slack the execution failure of a step from app.

                                                                                            +
                                                                                            def execute(step, complete, fail):
                                                                                            +    inputs = step["inputs"]
                                                                                            +    # if something went wrong
                                                                                            +    error = {"message": "Just testing step failure!"}
                                                                                            +    fail(error=error)
                                                                                            +
                                                                                            +ws = WorkflowStep(
                                                                                            +    callback_id="add_task",
                                                                                            +    edit=edit,
                                                                                            +    save=save,
                                                                                            +    execute=execute,
                                                                                            +)
                                                                                            +app.step(ws)
                                                                                            +
                                                                                            +

                                                                                            This utility is a thin wrapper of workflows.stepFailed API method. +Refer to https://api.slack.com/methods/workflows.stepFailed for details.

                                                                                            @@ -121,7 +132,7 @@

                                                                                            -

                                                                                            Generated by pdoc 0.11.3.

                                                                                            +

                                                                                            Generated by pdoc 0.11.5.

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/workflows/step/utilities/index.html b/docs/static/api-docs/slack_bolt/workflows/step/utilities/index.html index 3e816520..1594bacb 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/utilities/index.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/utilities/index.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.utilities API documentation - + @@ -116,7 +127,7 @@

                                                                                            Sub-modules

                                                                                            diff --git a/docs/static/api-docs/slack_bolt/workflows/step/utilities/update.html b/docs/static/api-docs/slack_bolt/workflows/step/utilities/update.html index 8f95aa1e..f24c0783 100644 --- a/docs/static/api-docs/slack_bolt/workflows/step/utilities/update.html +++ b/docs/static/api-docs/slack_bolt/workflows/step/utilities/update.html @@ -3,19 +3,30 @@ - + slack_bolt.workflows.step.utilities.update API documentation - + @@ -40,42 +51,6 @@

                                                                                            Classes

                                                                                            (*, client: slack_sdk.web.client.WebClient, body: dict)
                                                                                            -

                                                                                            update() utility to tell Slack the processing results of a save listener.

                                                                                            -
                                                                                            def save(ack, view, update):
                                                                                            -    ack()
                                                                                            -
                                                                                            -    values = view["state"]["values"]
                                                                                            -    task_name = values["task_name_input"]["name"]
                                                                                            -    task_description = values["task_description_input"]["description"]
                                                                                            -
                                                                                            -    inputs = {
                                                                                            -        "task_name": {"value": task_name["value"]},
                                                                                            -        "task_description": {"value": task_description["value"]}
                                                                                            -    }
                                                                                            -    outputs = [
                                                                                            -        {
                                                                                            -            "type": "text",
                                                                                            -            "name": "task_name",
                                                                                            -            "label": "Task name",
                                                                                            -        },
                                                                                            -        {
                                                                                            -            "type": "text",
                                                                                            -            "name": "task_description",
                                                                                            -            "label": "Task description",
                                                                                            -        }
                                                                                            -    ]
                                                                                            -    update(inputs=inputs, outputs=outputs)
                                                                                            -
                                                                                            -ws = WorkflowStep(
                                                                                            -    callback_id="add_task",
                                                                                            -    edit=edit,
                                                                                            -    save=save,
                                                                                            -    execute=execute,
                                                                                            -)
                                                                                            -app.step(ws)
                                                                                            -
                                                                                            -

                                                                                            This utility is a thin wrapper of workflows.stepFailed API method. -Refer to https://api.slack.com/methods/workflows.updateStep for details.

                                                                                            Expand source code @@ -130,6 +105,42 @@

                                                                                            Classes

                                                                                            **kwargs, )
                                                                                            +

                                                                                            update() utility to tell Slack the processing results of a save listener.

                                                                                            +
                                                                                            def save(ack, view, update):
                                                                                            +    ack()
                                                                                            +
                                                                                            +    values = view["state"]["values"]
                                                                                            +    task_name = values["task_name_input"]["name"]
                                                                                            +    task_description = values["task_description_input"]["description"]
                                                                                            +
                                                                                            +    inputs = {
                                                                                            +        "task_name": {"value": task_name["value"]},
                                                                                            +        "task_description": {"value": task_description["value"]}
                                                                                            +    }
                                                                                            +    outputs = [
                                                                                            +        {
                                                                                            +            "type": "text",
                                                                                            +            "name": "task_name",
                                                                                            +            "label": "Task name",
                                                                                            +        },
                                                                                            +        {
                                                                                            +            "type": "text",
                                                                                            +            "name": "task_description",
                                                                                            +            "label": "Task description",
                                                                                            +        }
                                                                                            +    ]
                                                                                            +    update(inputs=inputs, outputs=outputs)
                                                                                            +
                                                                                            +ws = WorkflowStep(
                                                                                            +    callback_id="add_task",
                                                                                            +    edit=edit,
                                                                                            +    save=save,
                                                                                            +    execute=execute,
                                                                                            +)
                                                                                            +app.step(ws)
                                                                                            +
                                                                                            +

                                                                                            This utility is a thin wrapper of workflows.stepFailed API method. +Refer to https://api.slack.com/methods/workflows.updateStep for details.

                                                                                            @@ -155,7 +166,7 @@

                                                                                            -

                                                                                            Generated by pdoc 0.11.3.

                                                                                            +

                                                                                            Generated by pdoc 0.11.5.

                                                                                            diff --git a/slack_bolt/version.py b/slack_bolt/version.py index faea892a..531baf7b 100644 --- a/slack_bolt/version.py +++ b/slack_bolt/version.py @@ -1,3 +1,3 @@ """Check the latest version at https://pypi.org/project/slack-bolt/""" -__version__ = "1.21.3" +__version__ = "1.22.0"