From c17327bd6529224bcc7fcc36c643513af93f329e Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 26 Aug 2026 23:48:28 -0700 Subject: [PATCH] chore(release): version 3.44.0 --- docs/reference/audit_logs/async_client.html | 27 +- docs/reference/audit_logs/index.html | 27 +- .../reference/audit_logs/v1/async_client.html | 27 +- docs/reference/audit_logs/v1/client.html | 27 +- docs/reference/errors/index.html | 8 +- docs/reference/http_retry/async_handler.html | 11 +- .../http_retry/builtin_async_handlers.html | 9 +- .../http_retry/builtin_handlers.html | 9 +- .../builtin_interval_calculators.html | 6 +- docs/reference/http_retry/handler.html | 3 +- docs/reference/http_retry/index.html | 31 +- .../http_retry/interval_calculator.html | 8 +- docs/reference/http_retry/jitter.html | 8 +- docs/reference/index.html | 242 +++++++++++- docs/reference/models/attachments/index.html | 27 +- docs/reference/models/basic_objects.html | 20 +- .../models/blocks/basic_components.html | 126 +++++- .../models/blocks/block_elements.html | 110 ++++-- docs/reference/models/blocks/blocks.html | 82 ++-- docs/reference/models/blocks/index.html | 307 +++++++++++---- docs/reference/models/dialoags.html | 51 ++- docs/reference/models/dialogs/index.html | 51 ++- docs/reference/models/index.html | 23 +- docs/reference/models/messages/chunk.html | 2 +- docs/reference/models/messages/message.html | 3 +- docs/reference/models/views/index.html | 4 +- docs/reference/oauth/index.html | 1 + .../async_cacheable_installation_store.html | 3 +- .../cacheable_installation_store.html | 3 +- .../installation_store/sqlite3/index.html | 18 +- .../oauth/sqlalchemy_utils/index.html | 11 +- .../oauth/state_store/async_state_store.html | 1 + docs/reference/oauth/state_store/index.html | 295 ++++++++++++++ .../oauth/state_store/state_store.html | 1 + .../oauth/state_store/stateless/index.html | 362 ++++++++++++++++++ .../oauth/token_rotation/async_rotator.html | 24 +- .../reference/oauth/token_rotation/index.html | 24 +- .../oauth/token_rotation/rotator.html | 24 +- docs/reference/rtm/index.html | 46 ++- docs/reference/rtm/v2/index.html | 3 +- docs/reference/rtm_v2/index.html | 3 +- docs/reference/scim/async_client.html | 3 +- docs/reference/scim/index.html | 3 +- docs/reference/scim/v1/async_client.html | 3 +- docs/reference/scim/v1/client.html | 3 +- docs/reference/socket_mode/aiohttp/index.html | 7 +- docs/reference/socket_mode/async_client.html | 30 +- .../reference/socket_mode/builtin/client.html | 3 +- docs/reference/socket_mode/builtin/index.html | 3 +- docs/reference/socket_mode/index.html | 3 +- .../socket_mode/websocket_client/index.html | 5 +- .../socket_mode/websockets/index.html | 3 +- docs/reference/web/async_base_client.html | 11 +- docs/reference/web/async_chat_stream.html | 41 +- docs/reference/web/async_client.html | 223 ++++++++++- docs/reference/web/async_slack_response.html | 31 +- docs/reference/web/base_client.html | 19 +- docs/reference/web/chat_stream.html | 41 +- docs/reference/web/client.html | 223 ++++++++++- docs/reference/web/index.html | 254 ++++++++++-- docs/reference/web/internal_utils.html | 13 +- docs/reference/web/legacy_base_client.html | 19 +- docs/reference/web/legacy_client.html | 212 +++++++++- docs/reference/web/legacy_slack_response.html | 31 +- docs/reference/web/slack_response.html | 31 +- docs/reference/webhook/async_client.html | 19 +- docs/reference/webhook/client.html | 19 +- docs/reference/webhook/index.html | 19 +- slack_sdk/version.py | 2 +- 69 files changed, 2801 insertions(+), 541 deletions(-) create mode 100644 docs/reference/oauth/state_store/stateless/index.html diff --git a/docs/reference/audit_logs/async_client.html b/docs/reference/audit_logs/async_client.html index 600bb9c35..a6761dd56 100644 --- a/docs/reference/audit_logs/async_client.html +++ b/docs/reference/audit_logs/async_client.html @@ -390,8 +390,9 @@

Classes

API client for Audit Logs API See https://docs.slack.dev/admins/audit-logs-api/ for more details

-

Args

+
Args
+
-----=
token
An admin user's token, which starts with xoxp-
timeout
@@ -506,15 +507,17 @@

Methods

Returns information about the kind of actions that the Audit Logs API returns as a list of all actions and a short description of each. Authentication not required.

-

Args

+
Args
+
-----=
query_params
Set any values if you want to add query params
headers
Additional request headers
-

Returns

-

API response

+

Returns +-----= +API response

async def api_call(self,
*,
http_verb: str = 'GET',
path: str,
query_params: Dict[str, Any] | None = None,
body_params: Dict[str, Any] | None = None,
headers: Dict[str, str] | None = None) ‑> AuditLogsResponse
@@ -618,8 +621,9 @@

Returns

Filters are added as query string parameters and can be combined together. Multiple filter parameters are additive (a boolean AND) and are separated with an ampersand (&) in the query string. Filtering is entirely optional.

-

Args

+
Args
+
-----=
latest
Unix timestamp of the most recent audit event to include (inclusive).
oldest
@@ -640,8 +644,9 @@

Args

headers
Additional request headers
-

Returns

-

API response

+

Returns +-----= +API response

async def schemas(self,
*,
query_params: Dict[str, Any] | None = None,
headers: Dict[str, str] | None = None) ‑> AuditLogsResponse
@@ -676,15 +681,17 @@

Returns

Returns information about the kind of objects which the Audit Logs API returns as a list of all objects and a short description. Authentication not required.

-

Args

+
Args
+
-----=
query_params
Set any values if you want to add query params
headers
Additional request headers
-

Returns

-

API response

+

Returns +-----= +API response

diff --git a/docs/reference/audit_logs/index.html b/docs/reference/audit_logs/index.html index 940d34e1c..1eb38c190 100644 --- a/docs/reference/audit_logs/index.html +++ b/docs/reference/audit_logs/index.html @@ -403,8 +403,9 @@

Classes

API client for Audit Logs API See https://docs.slack.dev/admins/audit-logs-api/ for more details

-

Args

+
Args
+
-----=
token
An admin user's token, which starts with xoxp-
timeout
@@ -501,15 +502,17 @@

Methods

Returns information about the kind of actions that the Audit Logs API returns as a list of all actions and a short description of each. Authentication not required.

-

Args

+
Args
+
-----=
query_params
Set any values if you want to add query params
headers
Additional request headers
-

Returns

-

API response

+

Returns +-----= +API response

def api_call(self,
*,
http_verb: str = 'GET',
path: str,
query_params: Dict[str, Any] | None = None,
body_params: Dict[str, Any] | None = None,
headers: Dict[str, str] | None = None) ‑> AuditLogsResponse
@@ -617,8 +620,9 @@

Returns

Filters are added as query string parameters and can be combined together. Multiple filter parameters are additive (a boolean AND) and are separated with an ampersand (&) in the query string. Filtering is entirely optional.

-

Args

+
Args
+
-----=
latest
Unix timestamp of the most recent audit event to include (inclusive).
oldest
@@ -639,8 +643,9 @@

Args

headers
Additional request headers
-

Returns

-

API response

+

Returns +-----= +API response

def schemas(self,
*,
query_params: Dict[str, Any] | None = None,
headers: Dict[str, str] | None = None) ‑> AuditLogsResponse
@@ -675,15 +680,17 @@

Returns

Returns information about the kind of objects which the Audit Logs API returns as a list of all objects and a short description. Authentication not required.

-

Args

+
Args
+
-----=
query_params
Set any values if you want to add query params
headers
Additional request headers
-

Returns

-

API response

+

Returns +-----= +API response

diff --git a/docs/reference/audit_logs/v1/async_client.html b/docs/reference/audit_logs/v1/async_client.html index e3f01fafc..699a6c38d 100644 --- a/docs/reference/audit_logs/v1/async_client.html +++ b/docs/reference/audit_logs/v1/async_client.html @@ -392,8 +392,9 @@

Classes

API client for Audit Logs API See https://docs.slack.dev/admins/audit-logs-api/ for more details

-

Args

+
Args
+
-----=
token
An admin user's token, which starts with xoxp-
timeout
@@ -508,15 +509,17 @@

Methods

Returns information about the kind of actions that the Audit Logs API returns as a list of all actions and a short description of each. Authentication not required.

-

Args

+
Args
+
-----=
query_params
Set any values if you want to add query params
headers
Additional request headers
-

Returns

-

API response

+

Returns +-----= +API response

async def api_call(self,
*,
http_verb: str = 'GET',
path: str,
query_params: Dict[str, Any] | None = None,
body_params: Dict[str, Any] | None = None,
headers: Dict[str, str] | None = None) ‑> AuditLogsResponse
@@ -620,8 +623,9 @@

Returns

Filters are added as query string parameters and can be combined together. Multiple filter parameters are additive (a boolean AND) and are separated with an ampersand (&) in the query string. Filtering is entirely optional.

-

Args

+
Args
+
-----=
latest
Unix timestamp of the most recent audit event to include (inclusive).
oldest
@@ -642,8 +646,9 @@

Args

headers
Additional request headers
-

Returns

-

API response

+

Returns +-----= +API response

async def schemas(self,
*,
query_params: Dict[str, Any] | None = None,
headers: Dict[str, str] | None = None) ‑> AuditLogsResponse
@@ -678,15 +683,17 @@

Returns

Returns information about the kind of objects which the Audit Logs API returns as a list of all objects and a short description. Authentication not required.

-

Args

+
Args
+
-----=
query_params
Set any values if you want to add query params
headers
Additional request headers
-

Returns

-

API response

+

Returns +-----= +API response

diff --git a/docs/reference/audit_logs/v1/client.html b/docs/reference/audit_logs/v1/client.html index fb3939178..0c5dcf0c9 100644 --- a/docs/reference/audit_logs/v1/client.html +++ b/docs/reference/audit_logs/v1/client.html @@ -392,8 +392,9 @@

Classes

API client for Audit Logs API See https://docs.slack.dev/admins/audit-logs-api/ for more details

-

Args

+
Args
+
-----=
token
An admin user's token, which starts with xoxp-
timeout
@@ -490,15 +491,17 @@

Methods

Returns information about the kind of actions that the Audit Logs API returns as a list of all actions and a short description of each. Authentication not required.

-

Args

+
Args
+
-----=
query_params
Set any values if you want to add query params
headers
Additional request headers
-

Returns

-

API response

+

Returns +-----= +API response

def api_call(self,
*,
http_verb: str = 'GET',
path: str,
query_params: Dict[str, Any] | None = None,
body_params: Dict[str, Any] | None = None,
headers: Dict[str, str] | None = None) ‑> AuditLogsResponse
@@ -606,8 +609,9 @@

Returns

Filters are added as query string parameters and can be combined together. Multiple filter parameters are additive (a boolean AND) and are separated with an ampersand (&) in the query string. Filtering is entirely optional.

-

Args

+
Args
+
-----=
latest
Unix timestamp of the most recent audit event to include (inclusive).
oldest
@@ -628,8 +632,9 @@

Args

headers
Additional request headers
-

Returns

-

API response

+

Returns +-----= +API response

def schemas(self,
*,
query_params: Dict[str, Any] | None = None,
headers: Dict[str, str] | None = None) ‑> AuditLogsResponse
@@ -664,15 +669,17 @@

Returns

Returns information about the kind of objects which the Audit Logs API returns as a list of all objects and a short description. Authentication not required.

-

Args

+
Args
+
-----=
query_params
Set any values if you want to add query params
headers
Additional request headers
-

Returns

-

API response

+

Returns +-----= +API response

diff --git a/docs/reference/errors/index.html b/docs/reference/errors/index.html index 569a2608e..6188fa894 100644 --- a/docs/reference/errors/index.html +++ b/docs/reference/errors/index.html @@ -97,13 +97,15 @@

Ancestors

super(SlackApiError, self).__init__(msg)

Error raised when Slack does not send the expected response.

-

Attributes

+
Attributes
+
-----=
response : SlackResponse
The SlackResponse object containing all of the data sent back from the API.
-

Note

-

The message (str) passed into the exception is used when +

Note +-----= +The message (str) passed into the exception is used when a user converts the exception to a str. i.e. str(SlackApiError("This text will be sent as a string."))

Ancestors

diff --git a/docs/reference/http_retry/async_handler.html b/docs/reference/http_retry/async_handler.html index 4f3889fcc..30cdf00c0 100644 --- a/docs/reference/http_retry/async_handler.html +++ b/docs/reference/http_retry/async_handler.html @@ -84,8 +84,9 @@

Classes

Retry interval calculator that calculates in the manner of Exponential Backoff And Jitter see also: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

Retry interval calculator that calculates in the manner of Exponential Backoff And Jitter

-

Args

+
Args
+
-----=
backoff_factor
The factor for the backoff interval calculation
jitter
@@ -290,13 +291,15 @@

Methods

raise NotImplementedError()

Calculates an interval duration in seconds.

-

Args

+
Args
+
-----=
current_attempt
the number of the current attempt (zero-origin; 0 means no retries are done so far)
-

Returns

-

calculated interval duration in seconds

+

Returns +-----= +calculated interval duration in seconds

diff --git a/docs/reference/http_retry/builtin_async_handlers.html b/docs/reference/http_retry/builtin_async_handlers.html index 206b27f53..c192c130b 100644 --- a/docs/reference/http_retry/builtin_async_handlers.html +++ b/docs/reference/http_retry/builtin_async_handlers.html @@ -106,8 +106,9 @@

Classes

RetryHandler that does retries for connectivity issues.

RetryHandler interface.

-

Args

+
Args
+
-----=
max_retry_count
The maximum times to do retries
interval_calculator
@@ -168,8 +169,9 @@

Ancestors

RetryHandler that does retries for rate limited errors.

RetryHandler interface.

-

Args

+
Args
+
-----=
max_retry_count
The maximum times to do retries
interval_calculator
@@ -250,8 +252,9 @@

Methods

RetryHandler that does retries for server errors.

RetryHandler interface.

-

Args

+
Args
+
-----=
max_retry_count
The maximum times to do retries
interval_calculator
diff --git a/docs/reference/http_retry/builtin_handlers.html b/docs/reference/http_retry/builtin_handlers.html index 0f36601ed..e8ef34f1a 100644 --- a/docs/reference/http_retry/builtin_handlers.html +++ b/docs/reference/http_retry/builtin_handlers.html @@ -94,8 +94,9 @@

Classes

RetryHandler that does retries for connectivity issues.

RetryHandler interface.

-

Args

+
Args
+
-----=
max_retry_count
The maximum times to do retries
interval_calculator
@@ -165,8 +166,9 @@

Inherited members

RetryHandler that does retries for rate limited errors.

RetryHandler interface.

-

Args

+
Args
+
-----=
max_retry_count
The maximum times to do retries
interval_calculator
@@ -256,8 +258,9 @@

Inherited members

RetryHandler that does retries for server errors.

RetryHandler interface.

-

Args

+
Args
+
-----=
max_retry_count
The maximum times to do retries
interval_calculator
diff --git a/docs/reference/http_retry/builtin_interval_calculators.html b/docs/reference/http_retry/builtin_interval_calculators.html index cfa90cc7c..77431f01f 100644 --- a/docs/reference/http_retry/builtin_interval_calculators.html +++ b/docs/reference/http_retry/builtin_interval_calculators.html @@ -81,8 +81,9 @@

Classes

Retry interval calculator that calculates in the manner of Exponential Backoff And Jitter see also: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

Retry interval calculator that calculates in the manner of Exponential Backoff And Jitter

-

Args

+
Args
+
-----=
backoff_factor
The factor for the backoff interval calculation
jitter
@@ -139,8 +140,9 @@

Inherited members

Retry interval calculator that uses a fixed value.

Retry interval calculator that uses a fixed value.

-

Args

+
Args
+
-----=
fixed_internal
The fixed interval seconds
diff --git a/docs/reference/http_retry/handler.html b/docs/reference/http_retry/handler.html index 8f4cb0f08..09501c493 100644 --- a/docs/reference/http_retry/handler.html +++ b/docs/reference/http_retry/handler.html @@ -123,8 +123,9 @@

Classes

RetryHandler interface. You can pass an array of handlers to customize retry logics in supported API clients.

RetryHandler interface.

-

Args

+
Args
+
-----=
max_retry_count
The maximum times to do retries
interval_calculator
diff --git a/docs/reference/http_retry/index.html b/docs/reference/http_retry/index.html index 501a62c9e..d6c6428ab 100644 --- a/docs/reference/http_retry/index.html +++ b/docs/reference/http_retry/index.html @@ -158,8 +158,9 @@

Classes

Retry interval calculator that calculates in the manner of Exponential Backoff And Jitter see also: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

Retry interval calculator that calculates in the manner of Exponential Backoff And Jitter

-

Args

+
Args
+
-----=
backoff_factor
The factor for the backoff interval calculation
jitter
@@ -237,8 +238,9 @@

Inherited members

RetryHandler that does retries for connectivity issues.

RetryHandler interface.

-

Args

+
Args
+
-----=
max_retry_count
The maximum times to do retries
interval_calculator
@@ -285,8 +287,9 @@

Inherited members

Retry interval calculator that uses a fixed value.

Retry interval calculator that uses a fixed value.

-

Args

+
Args
+
-----=
fixed_internal
The fixed interval seconds
@@ -489,13 +492,15 @@

Methods

Recalculate the given duration. see also: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

-

Args

+
Args
+
-----=
duration
the duration in seconds
-

Returns

-

A new duration that the jitter amount is added

+

Returns +-----= +A new duration that the jitter amount is added

@@ -549,8 +554,9 @@

Returns

RetryHandler that does retries for rate limited errors.

RetryHandler interface.

-

Args

+
Args
+
-----=
max_retry_count
The maximum times to do retries
interval_calculator
@@ -683,8 +689,9 @@

Inherited members

RetryHandler interface. You can pass an array of handlers to customize retry logics in supported API clients.

RetryHandler interface.

-

Args

+
Args
+
-----=
max_retry_count
The maximum times to do retries
interval_calculator
@@ -809,13 +816,15 @@

Methods

raise NotImplementedError()

Calculates an interval duration in seconds.

-

Args

+
Args
+
-----=
current_attempt
the number of the current attempt (zero-origin; 0 means no retries are done so far)
-

Returns

-

calculated interval duration in seconds

+

Returns +-----= +calculated interval duration in seconds

diff --git a/docs/reference/http_retry/interval_calculator.html b/docs/reference/http_retry/interval_calculator.html index 938799629..37ddc6958 100644 --- a/docs/reference/http_retry/interval_calculator.html +++ b/docs/reference/http_retry/interval_calculator.html @@ -94,13 +94,15 @@

Methods

raise NotImplementedError()

Calculates an interval duration in seconds.

-

Args

+
Args
+
-----=
current_attempt
the number of the current attempt (zero-origin; 0 means no retries are done so far)
-

Returns

-

calculated interval duration in seconds

+

Returns +-----= +calculated interval duration in seconds

diff --git a/docs/reference/http_retry/jitter.html b/docs/reference/http_retry/jitter.html index 0268d2cce..8fb121a76 100644 --- a/docs/reference/http_retry/jitter.html +++ b/docs/reference/http_retry/jitter.html @@ -98,13 +98,15 @@

Methods

Recalculate the given duration. see also: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

-

Args

+
Args
+
-----=
duration
the duration in seconds
-

Returns

-

A new duration that the jitter amount is added

+

Returns +-----= +A new duration that the jitter amount is added

diff --git a/docs/reference/index.html b/docs/reference/index.html index 54aaa03f9..0d790e1aa 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -2057,6 +2057,58 @@

Classes

kwargs.update({"workflow_ids": workflow_ids}) return self.api_call("admin.workflows.unpublish", params=kwargs) + def agents_sessions_rename( + self, + *, + channel_id: str, + title: str, + thread_ts: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Rename an agent session. + https://docs.slack.dev/reference/methods/agents.sessions.rename + """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "thread_ts": thread_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.rename", json=kwargs) + + def agents_sessions_setStatus( + self, + *, + channel_id: str, + status: str, + thread_ts: Optional[str] = None, + title: Optional[str] = None, + initiator_user_id: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Set an agent session's lifecycle status, creating the session if needed. + https://docs.slack.dev/reference/methods/agents.sessions.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "status": status, + "thread_ts": thread_ts, + "title": title, + "initiator_user_id": initiator_user_id, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.setStatus", json=kwargs) + def api_test( self, *, @@ -2304,6 +2356,32 @@

Classes

kwargs.update({"cursor": cursor, "limit": limit, "include_icon": include_icon}) return self.api_call("auth.teams.list", params=kwargs) + def blocks_validate( + self, + *, + blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, + message: Optional[Union[str, Dict]] = None, + view: Optional[Union[str, Dict, View]] = None, + **kwargs, + ) -> SlackResponse: + """Validates an array of blocks, or a message or view payload. + Provide exactly one of ``blocks``, ``message``, or ``view``. + https://docs.slack.dev/reference/methods/blocks.validate + """ + if blocks is not None: + if isinstance(blocks, str): + kwargs.update({"blocks": blocks}) + else: + kwargs.update({"blocks": json.dumps([b.to_dict() if isinstance(b, Block) else b for b in blocks])}) + if message is not None: + kwargs.update({"message": message if isinstance(message, str) else json.dumps(message)}) + if view is not None: + if isinstance(view, View): + kwargs.update({"view": json.dumps(view.to_dict())}) + else: + kwargs.update({"view": view if isinstance(view, str) else json.dumps(view)}) + return self.api_call("blocks.validate", params=kwargs) + def bookmarks_add( self, *, @@ -3075,6 +3153,7 @@

Classes

blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> SlackResponse: """Stops a streaming conversation. @@ -3088,6 +3167,7 @@

Classes

"blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) @@ -6144,8 +6224,9 @@

Classes

and enacting change in a Slack workspace.

This client handles constructing and sending HTTP requests to Slack as well as parsing any responses received into a SlackResponse.

-

Attributes

+
Attributes
+
-----=
token : str
A string specifying an xoxp-* or xoxb-* token.
base_url : str
@@ -6167,8 +6248,9 @@

Attributes

headers : dict
Additional request headers to attach to all requests.
-

Methods

-

api_call: Constructs a request and executes the API call to Slack.

+

Methods +-----= +api_call: Constructs a request and executes the API call to Slack.

Example of recommended usage:

    import os
     from slack_sdk import WebClient
@@ -6192,8 +6274,9 @@ 

Methods

assert response["ok"] assert response["message"]["text"] == "Hello world!"
-

Note

-

Any attributes or methods prefixed with _underscores are +

Note +-----= +Any attributes or methods prefixed with _underscores are intended to be "private" internal use only. They may be changed or removed at anytime.

Ancestors

@@ -9127,6 +9210,80 @@

Methods

Unpublish workflows within the team or enterprise https://docs.slack.dev/reference/methods/admin.workflows.unpublish

+
+def agents_sessions_rename(self, *, channel_id: str, title: str, thread_ts: str | None = None, **kwargs) ‑> SlackResponse +
+
+
+ +Expand source code + +
def agents_sessions_rename(
+    self,
+    *,
+    channel_id: str,
+    title: str,
+    thread_ts: Optional[str] = None,
+    **kwargs,
+) -> SlackResponse:
+    """Rename an agent session.
+    https://docs.slack.dev/reference/methods/agents.sessions.rename
+    """
+    kwargs.update(
+        {
+            "channel_id": channel_id,
+            "title": title,
+            "thread_ts": thread_ts,
+        }
+    )
+    kwargs = _remove_none_values(kwargs)
+    return self.api_call("agents.sessions.rename", json=kwargs)
+
+ +
+
+def agents_sessions_setStatus(self,
*,
channel_id: str,
status: str,
thread_ts: str | None = None,
title: str | None = None,
initiator_user_id: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> SlackResponse
+
+
+
+ +Expand source code + +
def agents_sessions_setStatus(
+    self,
+    *,
+    channel_id: str,
+    status: str,
+    thread_ts: Optional[str] = None,
+    title: Optional[str] = None,
+    initiator_user_id: Optional[str] = None,
+    icon_emoji: Optional[str] = None,
+    icon_url: Optional[str] = None,
+    username: Optional[str] = None,
+    **kwargs,
+) -> SlackResponse:
+    """Set an agent session's lifecycle status, creating the session if needed.
+    https://docs.slack.dev/reference/methods/agents.sessions.setStatus
+    """
+    kwargs.update(
+        {
+            "channel_id": channel_id,
+            "status": status,
+            "thread_ts": thread_ts,
+            "title": title,
+            "initiator_user_id": initiator_user_id,
+            "icon_emoji": icon_emoji,
+            "icon_url": icon_url,
+            "username": username,
+        }
+    )
+    kwargs = _remove_none_values(kwargs)
+    return self.api_call("agents.sessions.setStatus", json=kwargs)
+
+

Set an agent session's lifecycle status, creating the session if needed. +https://docs.slack.dev/reference/methods/agents.sessions.setStatus

+
def api_test(self, *, error: str | None = None, **kwargs) ‑> SlackResponse
@@ -9540,6 +9697,44 @@

Methods

Checks authentication & identity. https://docs.slack.dev/reference/methods/auth.test

+
+def blocks_validate(self,
*,
blocks: str | Sequence[Dict | Block] | None = None,
message: str | Dict | None = None,
view: str | Dict | View | None = None,
**kwargs) ‑> SlackResponse
+
+
+
+ +Expand source code + +
def blocks_validate(
+    self,
+    *,
+    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None,
+    message: Optional[Union[str, Dict]] = None,
+    view: Optional[Union[str, Dict, View]] = None,
+    **kwargs,
+) -> SlackResponse:
+    """Validates an array of blocks, or a message or view payload.
+    Provide exactly one of ``blocks``, ``message``, or ``view``.
+    https://docs.slack.dev/reference/methods/blocks.validate
+    """
+    if blocks is not None:
+        if isinstance(blocks, str):
+            kwargs.update({"blocks": blocks})
+        else:
+            kwargs.update({"blocks": json.dumps([b.to_dict() if isinstance(b, Block) else b for b in blocks])})
+    if message is not None:
+        kwargs.update({"message": message if isinstance(message, str) else json.dumps(message)})
+    if view is not None:
+        if isinstance(view, View):
+            kwargs.update({"view": json.dumps(view.to_dict())})
+        else:
+            kwargs.update({"view": view if isinstance(view, str) else json.dumps(view)})
+    return self.api_call("blocks.validate", params=kwargs)
+
+

Validates an array of blocks, or a message or view payload. +Provide exactly one of blocks, message, or view. +https://docs.slack.dev/reference/methods/blocks.validate

+
def bookmarks_add(self,
*,
channel_id: str,
title: str,
type: str,
emoji: str | None = None,
entity_id: str | None = None,
link: str | None = None,
parent_id: str | None = None,
**kwargs) ‑> SlackResponse
@@ -10742,7 +10937,7 @@

Methods

https://docs.slack.dev/reference/methods/chat.startStream

-def chat_stopStream(self,
*,
channel: str,
ts: str,
markdown_text: str | None = None,
blocks: str | Sequence[Dict | Block] | None = None,
metadata: Dict | Metadata | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
**kwargs) ‑> SlackResponse
+def chat_stopStream(self,
*,
channel: str,
ts: str,
markdown_text: str | None = None,
blocks: str | Sequence[Dict | Block] | None = None,
metadata: Dict | Metadata | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
session_status: str | None = None,
**kwargs) ‑> SlackResponse
@@ -10758,6 +10953,7 @@

Methods

blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> SlackResponse: """Stops a streaming conversation. @@ -10771,6 +10967,7 @@

Methods

"blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) @@ -10876,8 +11073,9 @@

Methods

  • chat.stopStream: Stops a streaming conversation. Reference.
  • -

    Args

    +
    Args
    +
    -----=
    buffer_size
    The length of markdown_text to buffer in-memory before calling a stream method. Increasing this value decreases the number of method calls made for the same amount of text, which is useful to avoid rate @@ -10904,9 +11102,11 @@

    Args

    **kwargs
    Additional arguments passed to the underlying API calls.
    -

    Returns

    -

    ChatStream instance for managing the stream

    -

    Example

    +

    Returns +-----= +ChatStream instance for managing the stream

    +

    Example +-----=

    streamer = client.chat_stream(
         channel="C0123456789",
         thread_ts="1700000001.123456",
    @@ -15938,8 +16138,9 @@ 

    Inherited members

    API client for Incoming Webhooks and response_url

    https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks/

    -

    Args

    +
    Args
    +
    -----=
    url
    Complete URL to send data (e.g., https://hooks.slack.com/XXX)
    timeout
    @@ -16050,8 +16251,9 @@

    Methods

    )

    Performs a Slack API request and returns the result.

    -

    Args

    +
    Args
    +
    -----=
    text
    The text message (even when having blocks, setting this as well is recommended as it works as fallback)
    @@ -16074,8 +16276,9 @@

    Args

    headers
    Request headers to append only for this request
    -

    Returns

    -

    Webhook response

    +

    Returns +-----= +Webhook response

    def send_dict(self, body: Dict[str, Any], headers: Dict[str, str] | None = None) ‑> WebhookResponse @@ -16101,16 +16304,18 @@

    Returns

    )

    Performs a Slack API request and returns the result.

    -

    Args

    +
    Args
    +
    -----=
    body
    JSON data structure (it's still a dict at this point), if you give this argument, body_params and files will be skipped
    headers
    Request headers to append only for this request
    -

    Returns

    -

    Webhook response

    +

    Returns +-----= +Webhook response

    @@ -16251,6 +16456,8 @@

    WebClientadmin_workflows_permissions_lookup
  • admin_workflows_search
  • admin_workflows_unpublish
  • +
  • agents_sessions_rename
  • +
  • agents_sessions_setStatus
  • api_test
  • apps_connections_open
  • apps_event_authorizations_list
  • @@ -16267,6 +16474,7 @@

    WebClientauth_revoke
  • auth_teams_list
  • auth_test
  • +
  • blocks_validate
  • bookmarks_add
  • bookmarks_edit
  • bookmarks_list
  • diff --git a/docs/reference/models/attachments/index.html b/docs/reference/models/attachments/index.html index 5a7d10c20..d7b16214f 100644 --- a/docs/reference/models/attachments/index.html +++ b/docs/reference/models/attachments/index.html @@ -307,8 +307,9 @@

    Inherited members

    https://docs.slack.dev/legacy/legacy-messaging/legacy-interactive-message-field-guide/#message_action_fields

    Simple button for use inside attachments

    https://docs.slack.dev/legacy/legacy-messaging/legacy-message-buttons/

    -

    Args

    +
    Args
    +
    -----=
    name
    Name this specific action. The name will be returned to your Action URL along with the message's callback_id when this action is @@ -435,8 +436,9 @@

    Inherited members

    Automatically populate the selector with a list of public channels in the workspace.

    https://docs.slack.dev/legacy/legacy-messaging/legacy-adding-menus-to-messages/#menu_channels

    -

    Args

    +
    Args
    +
    -----=
    name
    Name this specific action. The name will be returned to your Action URL along with the message's callback_id when this action is @@ -511,8 +513,9 @@

    Inherited members

    Automatically populate the selector with a list of conversations they have in the workspace.

    https://docs.slack.dev/legacy/legacy-messaging/legacy-adding-menus-to-messages/#menu_conversations

    -

    Args

    +
    Args
    +
    -----=
    name
    Name this specific action. The name will be returned to your Action URL along with the message's callback_id when this action is @@ -599,8 +602,9 @@

    Inherited members

    https://docs.slack.dev/legacy/legacy-messaging/legacy-interactive-message-field-guide/#message_action_fields

    Populate a message select menu from your own application dynamically.

    https://docs.slack.dev/legacy/legacy-messaging/legacy-adding-menus-to-messages/#menu_dynamic

    -

    Args

    +
    Args
    +
    -----=
    name
    Name this specific action. The name will be returned to your Action URL along with the message's callback_id when this action is @@ -682,8 +686,9 @@

    Inherited members

    https://docs.slack.dev/legacy/legacy-messaging/legacy-interactive-message-field-guide/#message_action_fields

    A simple interactive button that just opens a URL

    https://docs.slack.dev/messaging/formatting-message-text/#rich-layouts

    -

    Args

    +
    Args
    +
    -----=
    text
    text to display on the button, eg 'Click Me!"
    url
    @@ -740,8 +745,9 @@

    Inherited members

    https://docs.slack.dev/legacy/legacy-messaging/legacy-interactive-message-field-guide/#message_action_fields

    Automatically populate the selector with a list of users in the workspace.

    https://docs.slack.dev/legacy/legacy-messaging/legacy-adding-menus-to-messages/#menu_team_members

    -

    Args

    +
    Args
    +
    -----=
    name
    Name this specific action. The name will be returned to your Action URL along with the message's callback_id when this action is @@ -957,8 +963,9 @@

    Inherited members

    A supplemental object that will display after the rest of the message. Considered legacy - recommended replacement is to use message blocks instead.

    https://docs.slack.dev/legacy/legacy-messaging/legacy-secondary-message-attachments#fields

    -

    Args

    +
    Args
    +
    -----=
    text
    The main body text of the attachment. It can be formatted as plain text, or with markdown by including it in the markdown_in @@ -1273,8 +1280,9 @@

    Inherited members

    A bridge between legacy attachments and Block Kit formatting - pass a list of Block objects directly to this attachment.

    https://docs.slack.dev/legacy/legacy-messaging/legacy-secondary-message-attachments#fields

    -

    Args

    +
    Args
    +
    -----=
    blocks
    a sequence of Block objects
    color
    @@ -1483,8 +1491,9 @@

    Inherited members

    Considered legacy - recommended replacement is to use message blocks instead.

    https://docs.slack.dev/legacy/legacy-messaging/legacy-interactive-message-field-guide/#attachment_fields https://docs.slack.dev/legacy/legacy-messaging/legacy-secondary-message-attachments#fields

    -

    Args

    +
    Args
    +
    -----=
    actions
    A collection of Action objects to include in the attachment. Cannot exceed 5 elements.
    diff --git a/docs/reference/models/basic_objects.html b/docs/reference/models/basic_objects.html index cda8d9c95..6c6c3b670 100644 --- a/docs/reference/models/basic_objects.html +++ b/docs/reference/models/basic_objects.html @@ -82,8 +82,9 @@

    Subclasses

    Decorate a method on a class to mark it as a JSON validator. Validation functions should return true if valid, false if not.

    -

    Args

    +
    Args
    +
    -----=
    message
    Message to be attached to the thrown SlackObjectFormationError
    @@ -203,6 +204,7 @@

    Subclasses

  • Option
  • OptionGroup
  • SlackFile
  • +
  • TableBlockColumnSettings
  • TextObject
  • Workflow
  • WorkflowTrigger
  • @@ -357,13 +359,15 @@

    Methods

    return self.get_non_null_attributes()

    Extract this object as a JSON-compatible, Slack-API-valid dictionary

    -

    Args

    +
    Args
    +
    -----=
    *args
    Any specific formatting args (rare; generally not required)
    -

    Raises

    -

    SlackObjectFormationError if the object was not valid

    +

    Raises +-----= +SlackObjectFormationError if the object was not valid

    def validate_json(self) ‑> None @@ -383,8 +387,9 @@

    Raises

    if callable(method) and hasattr(method, "validator"): method()
    -

    Raises

    -

    SlackObjectFormationError if the object was not valid

    +

    Raises +-----= +SlackObjectFormationError if the object was not valid

    @@ -419,8 +424,9 @@

    Raises

    Decorate a method on a class to mark it as a JSON validator. Validation functions should return true if valid, false if not.

    -

    Args

    +
    Args
    +
    -----=
    message
    Message to be attached to the thrown SlackObjectFormationError
    diff --git a/docs/reference/models/blocks/basic_components.html b/docs/reference/models/blocks/basic_components.html index 2821b6a4b..e0514a512 100644 --- a/docs/reference/models/blocks/basic_components.html +++ b/docs/reference/models/blocks/basic_components.html @@ -188,7 +188,7 @@

    Class variables

    Static methods

    -def parse(confirm: ForwardRef('ConfirmObject') | Dict[str, Any]) +def parse(confirm: ConfirmObject | Dict[str, Any])
    @@ -324,7 +324,7 @@

    Class variables

    Static methods

    -def parse(config: ForwardRef('DispatchActionConfig') | Dict[str, Any]) +def parse(config: DispatchActionConfig | Dict[str, Any])
    @@ -413,8 +413,9 @@

    Inherited members

    The base class for JSON serializable class objects

    A feedback button element object for either positive or negative feedback. https://docs.slack.dev/reference/block-kit/block-elements/feedback-buttons-element#button-object-fields

    -

    Args

    +
    Args
    +
    -----=
    text : required
    An object containing some text. Maximum length for this field is 75 characters.
    accessibility_label
    @@ -446,7 +447,7 @@

    Class variables

    Static methods

    -def parse(feedback_button: ForwardRef('FeedbackButtonObject') | Dict[str, Any]) +def parse(feedback_button: FeedbackButtonObject | Dict[str, Any])
    @@ -560,8 +561,9 @@

    Inherited members

    A Markdown text object, meaning markdown characters will be parsed as formatting information. https://docs.slack.dev/reference/block-kit/composition-objects/text-object

    -

    Args

    +
    Args
    +
    -----=
    text : required
    The text for the block. This field accepts any of the standard text formatting markup when type is mrkdwn.
    @@ -851,8 +853,9 @@

    Inherited members

    https://docs.slack.dev/legacy/legacy-dialogs/#select_elements

    Legacy interactive attachments: https://docs.slack.dev/legacy/legacy-messaging/legacy-interactive-message-field-guide/#option_fields

    -

    Args

    +
    Args
    +
    -----=
    label
    A short, user-facing string to label this option to users. Cannot exceed 75 characters.
    @@ -907,7 +910,7 @@

    Static methods

    Creates a simple Option instance with the same value and label

    -def parse_all(options: Sequence[Dict[str, Any] | ForwardRef('Option')] | None) ‑> List[Option] | None +def parse_all(options: Sequence[Dict[str, Any] | Option] | None) ‑> List[Option] | None
    @@ -1071,8 +1074,9 @@

    Inherited members

    https://docs.slack.dev/legacy/legacy-dialogs/#select_elements

    Legacy interactive attachments: https://docs.slack.dev/legacy/legacy-messaging/legacy-interactive-message-field-guide/#option_groups

    -

    Args

    +
    Args
    +
    -----=
    label
    Text to display at the top of this group of options.
    options
    @@ -1105,7 +1109,7 @@

    Class variables

    Static methods

    -def parse_all(option_groups: Sequence[Dict[str, Any] | ForwardRef('OptionGroup')] | None) ‑> List[OptionGroup] | None +def parse_all(option_groups: Sequence[Dict[str, Any] | OptionGroup] | None) ‑> List[OptionGroup] | None
    @@ -1167,8 +1171,9 @@

    Inherited members

    A plain text object, meaning markdown characters will not be parsed as formatting information. https://docs.slack.dev/reference/block-kit/composition-objects/text-object

    -

    Args

    +
    Args
    +
    -----=
    text : required
    The text for the block. This field accepts any of the standard text formatting markup when type is mrkdwn.
    @@ -1294,8 +1299,9 @@

    Inherited members

    A raw text object used in table block cells. https://docs.slack.dev/reference/block-kit/composition-objects/text-object/ https://docs.slack.dev/reference/block-kit/blocks/table-block

    -

    Args

    +
    Args
    +
    -----=
    text : required
    The text content for the table block cell.
    @@ -1412,8 +1418,9 @@

    Inherited members

    The base class for JSON serializable class objects

    An object containing Slack file information to be used in an image block or image element. https://docs.slack.dev/reference/block-kit/composition-objects/slack-file-object

    -

    Args

    +
    Args
    +
    -----=
    id
    Slack ID of the file.
    url
    @@ -1442,6 +1449,93 @@

    Inherited members

    +
    +class TableBlockColumnSettings +(*, align: str | None = None, is_wrapped: bool | None = None, **others: dict) +
    +
    +
    + +Expand source code + +
    class TableBlockColumnSettings(JsonObject):
    +    """Column settings for TableBlock columns."""
    +
    +    @property
    +    def attributes(self) -> Set[str]:
    +        return {"align", "is_wrapped"}
    +
    +    def __init__(
    +        self,
    +        *,
    +        align: Optional[str] = None,
    +        is_wrapped: Optional[bool] = None,
    +        **others: dict,
    +    ):
    +        """Settings for a single column in a table block.
    +        https://docs.slack.dev/reference/block-kit/blocks/table-block
    +
    +        Args:
    +            align: The alignment for items in this column. Can be "left", "center", or "right".
    +                Defaults to "left" if not defined.
    +            is_wrapped: Whether the contents of this column should be wrapped or not.
    +                Defaults to false if not defined.
    +        """
    +        show_unknown_key_warning(self, others)
    +        self.align = align
    +        self.is_wrapped = is_wrapped
    +
    +    @classmethod
    +    def parse(
    +        cls, settings: Optional[Union[Dict[str, Any], "TableBlockColumnSettings"]]
    +    ) -> Optional["TableBlockColumnSettings"]:
    +        if settings is None:
    +            return None
    +        if isinstance(settings, TableBlockColumnSettings):
    +            return settings
    +        if isinstance(settings, dict):
    +            return TableBlockColumnSettings(**settings)
    +        return None
    +
    +

    Column settings for TableBlock columns.

    +

    Settings for a single column in a table block. +https://docs.slack.dev/reference/block-kit/blocks/table-block

    +
    +
    Args
    +
    -----=
    +
    align
    +
    The alignment for items in this column. Can be "left", "center", or "right". +Defaults to "left" if not defined.
    +
    is_wrapped
    +
    Whether the contents of this column should be wrapped or not. +Defaults to false if not defined.
    +
    +

    Ancestors

    + +

    Static methods

    +
    +
    +def parse(settings: Dict[str, Any] | TableBlockColumnSettings | None) ‑> TableBlockColumnSettings | None +
    +
    +
    +
    +
    +

    Inherited members

    + +
    class TextObject (text: str,
    type: str | None = None,
    subtype: str | None = None,
    emoji: bool | None = None,
    **kwargs)
    @@ -1536,7 +1630,7 @@

    Class variables

    Static methods

    -def parse(text: str | Dict[str, Any] | ForwardRef('TextObject'),
    default_type: str = 'mrkdwn') ‑> TextObject | None
    +def parse(text: str | Dict[str, Any] | TextObject,
    default_type: str = 'mrkdwn') ‑> TextObject | None
    @@ -1773,6 +1867,12 @@

    TableBlockColumnSettings

    + + +
  • TextObject

  • +
    +class TableBlockColumnSettings +(*, align: str | None = None, is_wrapped: bool | None = None, **others: dict) +
    +
    +
    + +Expand source code + +
    class TableBlockColumnSettings(JsonObject):
    +    """Column settings for TableBlock columns."""
    +
    +    @property
    +    def attributes(self) -> Set[str]:
    +        return {"align", "is_wrapped"}
    +
    +    def __init__(
    +        self,
    +        *,
    +        align: Optional[str] = None,
    +        is_wrapped: Optional[bool] = None,
    +        **others: dict,
    +    ):
    +        """Settings for a single column in a table block.
    +        https://docs.slack.dev/reference/block-kit/blocks/table-block
    +
    +        Args:
    +            align: The alignment for items in this column. Can be "left", "center", or "right".
    +                Defaults to "left" if not defined.
    +            is_wrapped: Whether the contents of this column should be wrapped or not.
    +                Defaults to false if not defined.
    +        """
    +        show_unknown_key_warning(self, others)
    +        self.align = align
    +        self.is_wrapped = is_wrapped
    +
    +    @classmethod
    +    def parse(
    +        cls, settings: Optional[Union[Dict[str, Any], "TableBlockColumnSettings"]]
    +    ) -> Optional["TableBlockColumnSettings"]:
    +        if settings is None:
    +            return None
    +        if isinstance(settings, TableBlockColumnSettings):
    +            return settings
    +        if isinstance(settings, dict):
    +            return TableBlockColumnSettings(**settings)
    +        return None
    +
    +

    Column settings for TableBlock columns.

    +

    Settings for a single column in a table block. +https://docs.slack.dev/reference/block-kit/blocks/table-block

    +
    +
    Args
    +
    -----=
    +
    align
    +
    The alignment for items in this column. Can be "left", "center", or "right". +Defaults to "left" if not defined.
    +
    is_wrapped
    +
    Whether the contents of this column should be wrapped or not. +Defaults to false if not defined.
    +
    +

    Ancestors

    + +

    Static methods

    +
    +
    +def parse(settings: Dict[str, Any] | TableBlockColumnSettings | None) ‑> TableBlockColumnSettings | None +
    +
    +
    +
    +
    +

    Inherited members

    + +
    class TaskCardBlock (*,
    task_id: str,
    title: str,
    details: RichTextBlock | dict | None = None,
    output: RichTextBlock | dict | None = None,
    sources: Sequence[UrlSourceElement | dict] | None = None,
    status: str,
    block_id: str | None = None,
    **others: dict)
    @@ -7769,8 +7913,9 @@

    Inherited members

    https://docs.slack.dev/reference/block-kit/blocks

    Displays a single task, representing a single action. https://docs.slack.dev/reference/block-kit/blocks/task-card-block/

    -

    Args

    +
    Args
    +
    -----=
    block_id
    A string acting as a unique identifier for a block. If not specified, one will be generated. Maximum length for this field is 255 characters. @@ -7933,7 +8078,7 @@

    Class variables

    Static methods

    -def parse(text: str | Dict[str, Any] | ForwardRef('TextObject'),
    default_type: str = 'mrkdwn') ‑> TextObject | None
    +def parse(text: str | Dict[str, Any] | TextObject,
    default_type: str = 'mrkdwn') ‑> TextObject | None
    @@ -8038,8 +8183,9 @@

    Inherited members

    with free-text entry for precise choices. On mobile clients, the time picker will use native time picker UIs. https://docs.slack.dev/reference/block-kit/block-elements/time-picker-element

    -

    Args

    +
    Args
    +
    -----=
    action_id : required
    An identifier for the action triggered when a time is selected. You can use this when you receive an interaction payload to identify the source of the action. @@ -8170,8 +8316,9 @@

    Inherited members

    A URL input element, similar to the Plain-text input element, creates a single line field where a user can enter URL-encoded data. https://docs.slack.dev/reference/block-kit/block-elements/url-input-element

    -

    Args

    +
    Args
    +
    -----=
    action_id : required
    An identifier for the input value when the parent modal is submitted. You can use this when you receive a view_submission payload to identify the value of the input element. @@ -8283,8 +8430,9 @@

    Inherited members

    https://docs.slack.dev/reference/block-kit/block-elements/

    A URL source element that displays a URL source for referencing within a task card block. https://docs.slack.dev/reference/block-kit/block-elements/url-source-element

    -

    Args

    +
    Args
    +
    -----=
    url : required
    The URL type source.
    text : required
    @@ -8399,8 +8547,9 @@

    Inherited members

    This select menu will populate its options with a list of Slack users visible to the current user in the active workspace. https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element#users_multi_select

    -

    Args

    +
    Args
    +
    -----=
    action_id : required
    An identifier for the action triggered when a menu option is selected. You can use this when you receive an interaction payload to identify the source of the action. @@ -8525,8 +8674,9 @@

    Inherited members

    This select menu will populate its options with a list of Slack users visible to the current user in the active workspace. https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element#users_select

    -

    Args

    +
    Args
    +
    -----=
    placeholder : required
    A plain_text only text object that defines the placeholder text shown on the menu. Maximum length for the text in this field is 150 characters.
    @@ -8701,8 +8851,9 @@

    Inherited members

    anywhere you can put blocks! To use the video block within your app, you must have the links.embed:write scope. https://docs.slack.dev/reference/block-kit/blocks/video-block

    -

    Args

    +
    Args
    +
    -----=
    block_id
    A string acting as a unique identifier for a block. If not specified, one will be generated. Maximum length for this field is 255 characters. @@ -9282,6 +9433,12 @@

    TableBlockColumnSettings

    + + +
  • TaskCardBlock

    • attributes
    • diff --git a/docs/reference/models/dialoags.html b/docs/reference/models/dialoags.html index cc2ff46a2..41e8927e1 100644 --- a/docs/reference/models/dialoags.html +++ b/docs/reference/models/dialoags.html @@ -731,8 +731,9 @@

      Methods

      Specify a callback ID for this dialog, which your application will then receive upon dialog submission

      -

      Args

      +
      Args
      +
      -----=
      callback_id
      a string identifying this particular dialog
      @@ -797,8 +798,9 @@

      Args

      You can also provide a select menu with a list of channels. Specify your data_source as channels to limit only to public channels

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_channels_conversations

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -861,8 +863,9 @@

      Args

      private channels, direct messages, MPIMs, and whatever else we consider a conversation-like thing.

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_channels_conversations

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -951,8 +954,9 @@

      Args

      A list of options can be loaded from an external URL and used in your dialog menus.

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_external

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -995,8 +999,9 @@

      Args

      Whether this dialog should send a request to your application even if the user cancels their interaction. Defaults to False.

      -

      Args

      +
      Args
      +
      -----=
      notify
      Set to True to indicate that your application should receive a request even if the user cancels interaction with the dialog.
      @@ -1027,8 +1032,9 @@

      Args

      Pass state into this dialog - dictionaries will be automatically formatted to JSON

      -

      Args

      +
      Args
      +
      -----=
      state
      Extra state information that you need to pass from this dialog back to your application on submission
      @@ -1105,8 +1111,9 @@

      Args

      A select element may contain up to 100 selections, provided as a list of Option or OptionGroup objects

      https://docs.slack.dev/legacy/legacy-dialogs/#attributes_select_elements

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1146,8 +1153,9 @@

      Args

      The label to use on the 'Submit' button on the dialog. Defaults to 'Submit' if not specified.

      -

      Args

      +
      Args
      +
      -----=
      label
      must not exceed 24 characters, and must be a single word (no spaces)
      @@ -1250,8 +1258,9 @@

      Args

      character count to the max_length you have set or the default, 3000.

      https://docs.slack.dev/legacy/legacy-dialogs/#attributes_textarea_elements

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1340,8 +1349,9 @@

      Args

      Text elements are single-line plain text fields.

      https://docs.slack.dev/legacy/legacy-dialogs/#attributes_text_elements

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1388,8 +1398,9 @@

      Args

      return self

      Specify a title for this dialog

      -

      Args

      +
      Args
      +
      -----=
      title
      must not exceed 24 characters
      @@ -1472,8 +1483,9 @@

      Args

      assignee. Slack pre-populates the user list in client-side, so your app doesn't need access to a related OAuth scope.

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_users

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1548,8 +1560,9 @@

      Inherited members

      You can also provide a select menu with a list of channels. Specify your data_source as channels to limit only to public channels

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_channels_conversations

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1642,8 +1655,9 @@

      Inherited members

      private channels, direct messages, MPIMs, and whatever else we consider a conversation-like thing.

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_channels_conversations

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1751,8 +1765,9 @@

      Inherited members

      A list of options can be loaded from an external URL and used in your dialog menus.

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_external

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1898,8 +1913,9 @@

      Inherited members

      A select element may contain up to 100 selections, provided as a list of Option or OptionGroup objects

      https://docs.slack.dev/legacy/legacy-dialogs/#attributes_select_elements

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -2468,8 +2484,9 @@

      Inherited members

      assignee. Slack pre-populates the user list in client-side, so your app doesn't need access to a related OAuth scope.

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_users

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      diff --git a/docs/reference/models/dialogs/index.html b/docs/reference/models/dialogs/index.html index e0c6fe457..f6d06c3f0 100644 --- a/docs/reference/models/dialogs/index.html +++ b/docs/reference/models/dialogs/index.html @@ -731,8 +731,9 @@

      Methods

      Specify a callback ID for this dialog, which your application will then receive upon dialog submission

      -

      Args

      +
      Args
      +
      -----=
      callback_id
      a string identifying this particular dialog
      @@ -797,8 +798,9 @@

      Args

      You can also provide a select menu with a list of channels. Specify your data_source as channels to limit only to public channels

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_channels_conversations

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -861,8 +863,9 @@

      Args

      private channels, direct messages, MPIMs, and whatever else we consider a conversation-like thing.

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_channels_conversations

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -951,8 +954,9 @@

      Args

      A list of options can be loaded from an external URL and used in your dialog menus.

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_external

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -995,8 +999,9 @@

      Args

      Whether this dialog should send a request to your application even if the user cancels their interaction. Defaults to False.

      -

      Args

      +
      Args
      +
      -----=
      notify
      Set to True to indicate that your application should receive a request even if the user cancels interaction with the dialog.
      @@ -1027,8 +1032,9 @@

      Args

      Pass state into this dialog - dictionaries will be automatically formatted to JSON

      -

      Args

      +
      Args
      +
      -----=
      state
      Extra state information that you need to pass from this dialog back to your application on submission
      @@ -1105,8 +1111,9 @@

      Args

      A select element may contain up to 100 selections, provided as a list of Option or OptionGroup objects

      https://docs.slack.dev/legacy/legacy-dialogs/#attributes_select_elements

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1146,8 +1153,9 @@

      Args

      The label to use on the 'Submit' button on the dialog. Defaults to 'Submit' if not specified.

      -

      Args

      +
      Args
      +
      -----=
      label
      must not exceed 24 characters, and must be a single word (no spaces)
      @@ -1250,8 +1258,9 @@

      Args

      character count to the max_length you have set or the default, 3000.

      https://docs.slack.dev/legacy/legacy-dialogs/#attributes_textarea_elements

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1340,8 +1349,9 @@

      Args

      Text elements are single-line plain text fields.

      https://docs.slack.dev/legacy/legacy-dialogs/#attributes_text_elements

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1388,8 +1398,9 @@

      Args

      return self

      Specify a title for this dialog

      -

      Args

      +
      Args
      +
      -----=
      title
      must not exceed 24 characters
      @@ -1472,8 +1483,9 @@

      Args

      assignee. Slack pre-populates the user list in client-side, so your app doesn't need access to a related OAuth scope.

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_users

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1548,8 +1560,9 @@

      Inherited members

      You can also provide a select menu with a list of channels. Specify your data_source as channels to limit only to public channels

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_channels_conversations

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1642,8 +1655,9 @@

      Inherited members

      private channels, direct messages, MPIMs, and whatever else we consider a conversation-like thing.

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_channels_conversations

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1751,8 +1765,9 @@

      Inherited members

      A list of options can be loaded from an external URL and used in your dialog menus.

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_external

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -1898,8 +1913,9 @@

      Inherited members

      A select element may contain up to 100 selections, provided as a list of Option or OptionGroup objects

      https://docs.slack.dev/legacy/legacy-dialogs/#attributes_select_elements

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      @@ -2468,8 +2484,9 @@

      Inherited members

      assignee. Slack pre-populates the user list in client-side, so your app doesn't need access to a related OAuth scope.

      https://docs.slack.dev/legacy/legacy-dialogs/#dynamic_select_elements_users

      -

      Args

      +
      Args
      +
      -----=
      name
      Name of form element. Required. No more than 300 characters.
      label
      diff --git a/docs/reference/models/index.html b/docs/reference/models/index.html index d18523ae7..dd6a05957 100644 --- a/docs/reference/models/index.html +++ b/docs/reference/models/index.html @@ -112,8 +112,9 @@

      Functions

      Given a sequence (or single item), attempt to call the to_dict() method on each item and return a plain list. If item is not the expected type, return it unmodified, in case it's already a plain dict or some other user created class.

      -

      Args

      +
      Args
      +
      -----=
      item_or_items
      item(s) to go through
      format_args
      @@ -186,8 +187,9 @@

      Subclasses

      Decorate a method on a class to mark it as a JSON validator. Validation functions should return true if valid, false if not.

      -

      Args

      +
      Args
      +
      -----=
      message
      Message to be attached to the thrown SlackObjectFormationError
      @@ -307,6 +309,7 @@

      Subclasses

    • Option
    • OptionGroup
    • SlackFile
    • +
    • TableBlockColumnSettings
    • TextObject
    • Workflow
    • WorkflowTrigger
    • @@ -461,13 +464,15 @@

      Methods

      return self.get_non_null_attributes()

      Extract this object as a JSON-compatible, Slack-API-valid dictionary

      -

      Args

      +
      Args
      +
      -----=
      *args
      Any specific formatting args (rare; generally not required)
      -

      Raises

      -

      SlackObjectFormationError if the object was not valid

      +

      Raises +-----= +SlackObjectFormationError if the object was not valid

  • def validate_json(self) ‑> None @@ -487,8 +492,9 @@

    Raises

    if callable(method) and hasattr(method, "validator"): method()
    -

    Raises

    -

    SlackObjectFormationError if the object was not valid

    +

    Raises +-----= +SlackObjectFormationError if the object was not valid

    @@ -523,8 +529,9 @@

    Raises

    Decorate a method on a class to mark it as a JSON validator. Validation functions should return true if valid, false if not.

    -

    Args

    +
    Args
    +
    -----=
    message
    Message to be attached to the thrown SlackObjectFormationError
    diff --git a/docs/reference/models/messages/chunk.html b/docs/reference/models/messages/chunk.html index 00c5d1e30..0d25a438b 100644 --- a/docs/reference/models/messages/chunk.html +++ b/docs/reference/models/messages/chunk.html @@ -199,7 +199,7 @@

    Class variables

    Static methods

    -def parse(chunk: Dict | ForwardRef('Chunk')) ‑> Chunk | None +def parse(chunk: Dict | Chunk) ‑> Chunk | None
    diff --git a/docs/reference/models/messages/message.html b/docs/reference/models/messages/message.html index 6a7e7a85a..4dcbc638a 100644 --- a/docs/reference/models/messages/message.html +++ b/docs/reference/models/messages/message.html @@ -115,8 +115,9 @@

    Classes

    The base class for JSON serializable class objects

    Create a message.

    https://docs.slack.dev/messaging/#message-structure

    -

    Args

    +
    Args
    +
    -----=
    text
    Plain or Slack Markdown-like text to display in the message.
    attachments
    diff --git a/docs/reference/models/views/index.html b/docs/reference/models/views/index.html index d9e60359b..b7bad66bc 100644 --- a/docs/reference/models/views/index.html +++ b/docs/reference/models/views/index.html @@ -48,7 +48,7 @@

    Classes

    class View -(type: str,
    id: str | None = None,
    callback_id: str | None = None,
    external_id: str | None = None,
    team_id: str | None = None,
    bot_id: str | None = None,
    app_id: str | None = None,
    root_view_id: str | None = None,
    previous_view_id: str | None = None,
    title: str | dict | PlainTextObject | None = None,
    submit: str | dict | PlainTextObject | None = None,
    close: str | dict | PlainTextObject | None = None,
    blocks: Sequence[dict | Block] | None = None,
    private_metadata: str | None = None,
    state: dict | ForwardRef('ViewState') | None = None,
    hash: str | None = None,
    clear_on_close: bool | None = None,
    notify_on_close: bool | None = None,
    **kwargs)
    +(type: str,
    id: str | None = None,
    callback_id: str | None = None,
    external_id: str | None = None,
    team_id: str | None = None,
    bot_id: str | None = None,
    app_id: str | None = None,
    root_view_id: str | None = None,
    previous_view_id: str | None = None,
    title: str | dict | PlainTextObject | None = None,
    submit: str | dict | PlainTextObject | None = None,
    close: str | dict | PlainTextObject | None = None,
    blocks: Sequence[dict | Block] | None = None,
    private_metadata: str | None = None,
    state: dict | ViewState | None = None,
    hash: str | None = None,
    clear_on_close: bool | None = None,
    notify_on_close: bool | None = None,
    **kwargs)
    @@ -229,7 +229,7 @@

    Inherited members

    class ViewState -(*,
    values: Dict[str, Dict[str, dict | ForwardRef('ViewStateValue')]])
    +(*,
    values: Dict[str, Dict[str, dict | ViewStateValue]])
    diff --git a/docs/reference/oauth/index.html b/docs/reference/oauth/index.html index a7a9199e2..59efdf88c 100644 --- a/docs/reference/oauth/index.html +++ b/docs/reference/oauth/index.html @@ -448,6 +448,7 @@

    Subclasses

  • FileOAuthStateStore
  • SQLAlchemyOAuthStateStore
  • SQLite3OAuthStateStore
  • +
  • StatelessOAuthStateStore
  • Instance variables

    diff --git a/docs/reference/oauth/installation_store/async_cacheable_installation_store.html b/docs/reference/oauth/installation_store/async_cacheable_installation_store.html index aba88128a..875d58bbb 100644 --- a/docs/reference/oauth/installation_store/async_cacheable_installation_store.html +++ b/docs/reference/oauth/installation_store/async_cacheable_installation_store.html @@ -204,8 +204,9 @@

    Classes

  • async_delete_all(enterprise_id, team_id)
  • A simple memory cache wrapper for any installation stores.

    -

    Args

    +
    Args
    +
    -----=
    installation_store
    The installation store to wrap
    diff --git a/docs/reference/oauth/installation_store/cacheable_installation_store.html b/docs/reference/oauth/installation_store/cacheable_installation_store.html index 54bb7662d..189094a31 100644 --- a/docs/reference/oauth/installation_store/cacheable_installation_store.html +++ b/docs/reference/oauth/installation_store/cacheable_installation_store.html @@ -205,8 +205,9 @@

    Classes

  • delete_all(enterprise_id, team_id)
  • A simple memory cache wrapper for any installation stores.

    -

    Args

    +
    Args
    +
    -----=
    installation_store
    The installation store to wrap
    diff --git a/docs/reference/oauth/installation_store/sqlite3/index.html b/docs/reference/oauth/installation_store/sqlite3/index.html index b5e1b9dab..8a830029a 100644 --- a/docs/reference/oauth/installation_store/sqlite3/index.html +++ b/docs/reference/oauth/installation_store/sqlite3/index.html @@ -529,7 +529,10 @@

    Classes

    installed_at=row[23], ) - if user_id is not None: + has_user_installation = user_id is not None and installation is not None + no_bot_token_installation = installation is not None and installation.bot_token is None + should_find_bot_installation = has_user_installation or no_bot_token_installation + if should_find_bot_installation: # Retrieve the latest bot token, just in case # See also: https://github.com/slackapi/bolt-python/issues/664 cur = conn.execute( @@ -557,12 +560,13 @@

    Classes

    [self.client_id, enterprise_id or "", team_id], ) row = cur.fetchone() - installation.bot_token = row[0] - installation.bot_id = row[1] - installation.bot_user_id = row[2] - installation.bot_scopes = row[3] - installation.bot_refresh_token = row[4] - installation.bot_token_expires_at = row[5] + if row is not None: + installation.bot_token = row[0] + installation.bot_id = row[1] + installation.bot_user_id = row[2] + installation.bot_scopes = row[3] + installation.bot_refresh_token = row[4] + installation.bot_token_expires_at = row[5] return installation return None diff --git a/docs/reference/oauth/sqlalchemy_utils/index.html b/docs/reference/oauth/sqlalchemy_utils/index.html index d82260a1d..f5763eb83 100644 --- a/docs/reference/oauth/sqlalchemy_utils/index.html +++ b/docs/reference/oauth/sqlalchemy_utils/index.html @@ -85,14 +85,17 @@

    Functions

    SQLAlchemy DateTime columns without timezone=True create naive timestamp columns in databases like PostgreSQL. This function strips timezone information from timezone-aware datetimes (which are already in UTC) to enable safe comparisons.

    -

    Args

    +
    Args
    +
    -----=
    dt
    A timezone-aware or naive datetime object, or None
    -

    Returns

    -

    A naive datetime in UTC, or None if input is None

    -

    Example

    +

    Returns +-----= +A naive datetime in UTC, or None if input is None

    +

    Example +-----=

    >>> from datetime import datetime, timezone
     >>> aware_dt = datetime(2024, 1, 1, 12, 0, 0, tzinfo=timezone.utc)
     >>> naive_dt = normalize_datetime_for_db(aware_dt)
    diff --git a/docs/reference/oauth/state_store/async_state_store.html b/docs/reference/oauth/state_store/async_state_store.html
    index 3f1fa969b..948288c84 100644
    --- a/docs/reference/oauth/state_store/async_state_store.html
    +++ b/docs/reference/oauth/state_store/async_state_store.html
    @@ -72,6 +72,7 @@ 

    Subclasses

  • FileOAuthStateStore
  • AsyncSQLAlchemyOAuthStateStore
  • SQLite3OAuthStateStore
  • +
  • StatelessOAuthStateStore
  • Instance variables

    diff --git a/docs/reference/oauth/state_store/index.html b/docs/reference/oauth/state_store/index.html index 38a016b32..a9f53e8ae 100644 --- a/docs/reference/oauth/state_store/index.html +++ b/docs/reference/oauth/state_store/index.html @@ -66,6 +66,10 @@

    Sub-modules

    +
    slack_sdk.oauth.state_store.stateless
    +
    +
    +
    @@ -268,6 +272,7 @@

    Subclasses

  • FileOAuthStateStore
  • SQLAlchemyOAuthStateStore
  • SQLite3OAuthStateStore
  • +
  • StatelessOAuthStateStore
  • Instance variables

    @@ -314,6 +319,285 @@

    Methods

    +
    +class StatelessOAuthStateStore +(*,
    expiration_seconds: int,
    signing_secret: str,
    logger: logging.Logger = <Logger slack_sdk.oauth.state_store.stateless (WARNING)>)
    +
    +
    +
    + +Expand source code + +
    class StatelessOAuthStateStore(OAuthStateStore, AsyncOAuthStateStore):
    +    """A stateless OAuth ``state`` store backed by a signed, self-contained token.
    +
    +    ``issue()`` creates an HMAC-SHA256 signed token in the JWT style. The token
    +    carries only an expiration claim. ``consume()`` re-verifies the signature and
    +    the expiry. Nothing is stored server-side. No storage backend is required.
    +
    +    .. warning::
    +        This store provides **no one-time-use / anti-replay guarantee**. It returns
    +        ``True`` for the same token every time until that token expires. This is
    +        inherent to a stateless token. The token can only be invalidated by expiry.
    +        It cannot be revoked early unless you add server-side state, and that would
    +        defeat the point of being stateless.
    +
    +        Consequences for integrators:
    +
    +        - **Keep the token lifetime short.** A token stays valid until it expires.
    +          Use a short ``expiration_seconds``. A value of ``300`` (5 minutes) is a
    +          good choice and matches the OAuth sample. This limits how long a captured
    +          ``state`` can be replayed.
    +        - **Make the callback idempotent.** A captured ``state`` can be replayed
    +          within its lifetime. Your callback may run more than once for a single
    +          authorization. The ``oauth.v2.access`` exchange and the installation
    +          persistence must tolerate this. Slack authorization codes are single-use.
    +          A sequential replay fails the token exchange. The real exposure is a
    +          concurrent duplicate callback.
    +        - **CSRF protection is unchanged.** CSRF defense comes from the
    +          ``Secure; HttpOnly`` state cookie. ``OAuthStateUtils`` validates that cookie
    +          before ``consume()`` runs in the callback. Compared to the stateful stores,
    +          this store only gives up anti-replay and defense-in-depth. It does not give
    +          up CSRF protection.
    +
    +    Args:
    +        expiration_seconds: Lifetime of an issued ``state`` token in seconds. After
    +            this window ``consume()`` returns ``False``. Keep this value short. A
    +            value of ``300`` (5 minutes) is a good default. Avoid long lifetimes.
    +        signing_secret: Secret used to sign and verify tokens with HMAC. Keep it
    +            secret. Keep it the same across every instance that must validate a
    +            shared token.
    +        logger: Logger for validation warnings.
    +    """
    +
    +    def __init__(
    +        self,
    +        *,
    +        expiration_seconds: int,
    +        signing_secret: str,
    +        logger: Logger = logging.getLogger(__name__),
    +    ):
    +        self.expiration_seconds = expiration_seconds
    +        self.signing_secret = signing_secret
    +        self._logger = logger
    +
    +    @property
    +    def logger(self) -> Logger:
    +        if self._logger is None:
    +            self._logger = logging.getLogger(__name__)
    +        return self._logger
    +
    +    @staticmethod
    +    def _b64url_encode(data: bytes) -> str:
    +        return base64.urlsafe_b64encode(data).rstrip(b"=").decode("utf-8")
    +
    +    @staticmethod
    +    def _b64url_decode(data: str) -> bytes:
    +        padded = data + "=" * (4 - len(data) % 4)
    +        return base64.urlsafe_b64decode(padded)
    +
    +    def _sign(self, message: str) -> str:
    +        return self._b64url_encode(
    +            hmac.new(
    +                self.signing_secret.encode("utf-8"),
    +                message.encode("utf-8"),
    +                hashlib.sha256,
    +            ).digest()
    +        )
    +
    +    def issue(self, *args, **kwargs) -> str:
    +        header = self._b64url_encode(json.dumps({"alg": "HS256", "typ": "JWT"}, separators=(",", ":")).encode())
    +        payload = self._b64url_encode(
    +            json.dumps({"exp": int(time.time()) + self.expiration_seconds}, separators=(",", ":")).encode()
    +        )
    +        signature = self._sign(f"{header}.{payload}")
    +        return f"{header}.{payload}.{signature}"
    +
    +    def consume(self, state: str) -> bool:
    +        """Validate a ``state`` token's signature and ``expiration`` claim.
    +
    +        Returns ``True`` for any correctly signed, unexpired token, **every time**.
    +        This store keeps no record of consumed tokens. It does not enforce
    +        one-time-use. See the class docstring for the anti-replay caveat.
    +        """
    +        try:
    +            parts = state.split(".")
    +            if len(parts) != 3:
    +                return False
    +            header, payload, signature = parts
    +            expected_signature = self._sign(f"{header}.{payload}")
    +            if not hmac.compare_digest(signature, expected_signature):
    +                self.logger.warning("Invalid JWT signature for state parameter")
    +                return False
    +            claims = json.loads(self._b64url_decode(payload))
    +            exp = claims.get("exp")
    +            if exp is None or time.time() > exp:
    +                self.logger.warning("Expired or missing exp claim in state JWT")
    +                return False
    +            return True
    +        except Exception as e:
    +            self.logger.warning(f"Failed to validate state JWT: {e}")
    +            return False
    +
    +    async def async_issue(self, *args, **kwargs) -> str:
    +        return self.issue(*args, **kwargs)
    +
    +    async def async_consume(self, state: str) -> bool:
    +        return self.consume(state)
    +
    +

    A stateless OAuth state store backed by a signed, self-contained token.

    +

    issue() creates an HMAC-SHA256 signed token in the JWT style. The token +carries only an expiration claim. consume() re-verifies the signature and +the expiry. Nothing is stored server-side. No storage backend is required.

    +
    +

    Warning

    +

    This store provides no one-time-use / anti-replay guarantee. It returns +True for the same token every time until that token expires. This is +inherent to a stateless token. The token can only be invalidated by expiry. +It cannot be revoked early unless you add server-side state, and that would +defeat the point of being stateless.

    +

    Consequences for integrators:

    +
      +
    • Keep the token lifetime short. A token stays valid until it expires. +Use a short expiration_seconds. A value of 300 (5 minutes) is a +good choice and matches the OAuth sample. This limits how long a captured +state can be replayed.
    • +
    • Make the callback idempotent. A captured state can be replayed +within its lifetime. Your callback may run more than once for a single +authorization. The oauth.v2.access exchange and the installation +persistence must tolerate this. Slack authorization codes are single-use. +A sequential replay fails the token exchange. The real exposure is a +concurrent duplicate callback.
    • +
    • CSRF protection is unchanged. CSRF defense comes from the +Secure; HttpOnly state cookie. OAuthStateUtils validates that cookie +before consume() runs in the callback. Compared to the stateful stores, +this store only gives up anti-replay and defense-in-depth. It does not give +up CSRF protection.
    • +
    +
    +
    +
    Args
    +
    -----=
    +
    expiration_seconds
    +
    Lifetime of an issued state token in seconds. After +this window consume() returns False. Keep this value short. A +value of 300 (5 minutes) is a good default. Avoid long lifetimes.
    +
    signing_secret
    +
    Secret used to sign and verify tokens with HMAC. Keep it +secret. Keep it the same across every instance that must validate a +shared token.
    +
    logger
    +
    Logger for validation warnings.
    +
    +

    Ancestors

    + +

    Instance variables

    +
    +
    prop logger : logging.Logger
    +
    +
    + +Expand source code + +
    @property
    +def logger(self) -> Logger:
    +    if self._logger is None:
    +        self._logger = logging.getLogger(__name__)
    +    return self._logger
    +
    +
    +
    +
    +

    Methods

    +
    +
    +async def async_consume(self, state: str) ‑> bool +
    +
    +
    + +Expand source code + +
    async def async_consume(self, state: str) -> bool:
    +    return self.consume(state)
    +
    +
    +
    +
    +async def async_issue(self, *args, **kwargs) ‑> str +
    +
    +
    + +Expand source code + +
    async def async_issue(self, *args, **kwargs) -> str:
    +    return self.issue(*args, **kwargs)
    +
    +
    +
    +
    +def consume(self, state: str) ‑> bool +
    +
    +
    + +Expand source code + +
    def consume(self, state: str) -> bool:
    +    """Validate a ``state`` token's signature and ``expiration`` claim.
    +
    +    Returns ``True`` for any correctly signed, unexpired token, **every time**.
    +    This store keeps no record of consumed tokens. It does not enforce
    +    one-time-use. See the class docstring for the anti-replay caveat.
    +    """
    +    try:
    +        parts = state.split(".")
    +        if len(parts) != 3:
    +            return False
    +        header, payload, signature = parts
    +        expected_signature = self._sign(f"{header}.{payload}")
    +        if not hmac.compare_digest(signature, expected_signature):
    +            self.logger.warning("Invalid JWT signature for state parameter")
    +            return False
    +        claims = json.loads(self._b64url_decode(payload))
    +        exp = claims.get("exp")
    +        if exp is None or time.time() > exp:
    +            self.logger.warning("Expired or missing exp claim in state JWT")
    +            return False
    +        return True
    +    except Exception as e:
    +        self.logger.warning(f"Failed to validate state JWT: {e}")
    +        return False
    +
    +

    Validate a state token's signature and expiration claim.

    +

    Returns True for any correctly signed, unexpired token, every time. +This store keeps no record of consumed tokens. It does not enforce +one-time-use. See the class docstring for the anti-replay caveat.

    +
    +
    +def issue(self, *args, **kwargs) ‑> str +
    +
    +
    + +Expand source code + +
    def issue(self, *args, **kwargs) -> str:
    +    header = self._b64url_encode(json.dumps({"alg": "HS256", "typ": "JWT"}, separators=(",", ":")).encode())
    +    payload = self._b64url_encode(
    +        json.dumps({"exp": int(time.time()) + self.expiration_seconds}, separators=(",", ":")).encode()
    +    )
    +    signature = self._sign(f"{header}.{payload}")
    +    return f"{header}.{payload}.{signature}"
    +
    +
    +
    +
    +
    @@ -335,6 +619,7 @@

    Methods

  • slack_sdk.oauth.state_store.sqlalchemy
  • slack_sdk.oauth.state_store.sqlite3
  • slack_sdk.oauth.state_store.state_store
  • +
  • slack_sdk.oauth.state_store.stateless
  • Classes

    @@ -357,6 +642,16 @@

    logger

  • +
  • +

    StatelessOAuthStateStore

    + +
  • diff --git a/docs/reference/oauth/state_store/state_store.html b/docs/reference/oauth/state_store/state_store.html index 9734a2bba..d9d876215 100644 --- a/docs/reference/oauth/state_store/state_store.html +++ b/docs/reference/oauth/state_store/state_store.html @@ -72,6 +72,7 @@

    Subclasses

  • FileOAuthStateStore
  • SQLAlchemyOAuthStateStore
  • SQLite3OAuthStateStore
  • +
  • StatelessOAuthStateStore
  • Instance variables

    diff --git a/docs/reference/oauth/state_store/stateless/index.html b/docs/reference/oauth/state_store/stateless/index.html new file mode 100644 index 000000000..d7aa7022e --- /dev/null +++ b/docs/reference/oauth/state_store/stateless/index.html @@ -0,0 +1,362 @@ + + + + + + +slack_sdk.oauth.state_store.stateless API documentation + + + + + + + + + + + +
    +
    +
    +

    Module slack_sdk.oauth.state_store.stateless

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Classes

    +
    +
    +class StatelessOAuthStateStore +(*,
    expiration_seconds: int,
    signing_secret: str,
    logger: logging.Logger = <Logger slack_sdk.oauth.state_store.stateless (WARNING)>)
    +
    +
    +
    + +Expand source code + +
    class StatelessOAuthStateStore(OAuthStateStore, AsyncOAuthStateStore):
    +    """A stateless OAuth ``state`` store backed by a signed, self-contained token.
    +
    +    ``issue()`` creates an HMAC-SHA256 signed token in the JWT style. The token
    +    carries only an expiration claim. ``consume()`` re-verifies the signature and
    +    the expiry. Nothing is stored server-side. No storage backend is required.
    +
    +    .. warning::
    +        This store provides **no one-time-use / anti-replay guarantee**. It returns
    +        ``True`` for the same token every time until that token expires. This is
    +        inherent to a stateless token. The token can only be invalidated by expiry.
    +        It cannot be revoked early unless you add server-side state, and that would
    +        defeat the point of being stateless.
    +
    +        Consequences for integrators:
    +
    +        - **Keep the token lifetime short.** A token stays valid until it expires.
    +          Use a short ``expiration_seconds``. A value of ``300`` (5 minutes) is a
    +          good choice and matches the OAuth sample. This limits how long a captured
    +          ``state`` can be replayed.
    +        - **Make the callback idempotent.** A captured ``state`` can be replayed
    +          within its lifetime. Your callback may run more than once for a single
    +          authorization. The ``oauth.v2.access`` exchange and the installation
    +          persistence must tolerate this. Slack authorization codes are single-use.
    +          A sequential replay fails the token exchange. The real exposure is a
    +          concurrent duplicate callback.
    +        - **CSRF protection is unchanged.** CSRF defense comes from the
    +          ``Secure; HttpOnly`` state cookie. ``OAuthStateUtils`` validates that cookie
    +          before ``consume()`` runs in the callback. Compared to the stateful stores,
    +          this store only gives up anti-replay and defense-in-depth. It does not give
    +          up CSRF protection.
    +
    +    Args:
    +        expiration_seconds: Lifetime of an issued ``state`` token in seconds. After
    +            this window ``consume()`` returns ``False``. Keep this value short. A
    +            value of ``300`` (5 minutes) is a good default. Avoid long lifetimes.
    +        signing_secret: Secret used to sign and verify tokens with HMAC. Keep it
    +            secret. Keep it the same across every instance that must validate a
    +            shared token.
    +        logger: Logger for validation warnings.
    +    """
    +
    +    def __init__(
    +        self,
    +        *,
    +        expiration_seconds: int,
    +        signing_secret: str,
    +        logger: Logger = logging.getLogger(__name__),
    +    ):
    +        self.expiration_seconds = expiration_seconds
    +        self.signing_secret = signing_secret
    +        self._logger = logger
    +
    +    @property
    +    def logger(self) -> Logger:
    +        if self._logger is None:
    +            self._logger = logging.getLogger(__name__)
    +        return self._logger
    +
    +    @staticmethod
    +    def _b64url_encode(data: bytes) -> str:
    +        return base64.urlsafe_b64encode(data).rstrip(b"=").decode("utf-8")
    +
    +    @staticmethod
    +    def _b64url_decode(data: str) -> bytes:
    +        padded = data + "=" * (4 - len(data) % 4)
    +        return base64.urlsafe_b64decode(padded)
    +
    +    def _sign(self, message: str) -> str:
    +        return self._b64url_encode(
    +            hmac.new(
    +                self.signing_secret.encode("utf-8"),
    +                message.encode("utf-8"),
    +                hashlib.sha256,
    +            ).digest()
    +        )
    +
    +    def issue(self, *args, **kwargs) -> str:
    +        header = self._b64url_encode(json.dumps({"alg": "HS256", "typ": "JWT"}, separators=(",", ":")).encode())
    +        payload = self._b64url_encode(
    +            json.dumps({"exp": int(time.time()) + self.expiration_seconds}, separators=(",", ":")).encode()
    +        )
    +        signature = self._sign(f"{header}.{payload}")
    +        return f"{header}.{payload}.{signature}"
    +
    +    def consume(self, state: str) -> bool:
    +        """Validate a ``state`` token's signature and ``expiration`` claim.
    +
    +        Returns ``True`` for any correctly signed, unexpired token, **every time**.
    +        This store keeps no record of consumed tokens. It does not enforce
    +        one-time-use. See the class docstring for the anti-replay caveat.
    +        """
    +        try:
    +            parts = state.split(".")
    +            if len(parts) != 3:
    +                return False
    +            header, payload, signature = parts
    +            expected_signature = self._sign(f"{header}.{payload}")
    +            if not hmac.compare_digest(signature, expected_signature):
    +                self.logger.warning("Invalid JWT signature for state parameter")
    +                return False
    +            claims = json.loads(self._b64url_decode(payload))
    +            exp = claims.get("exp")
    +            if exp is None or time.time() > exp:
    +                self.logger.warning("Expired or missing exp claim in state JWT")
    +                return False
    +            return True
    +        except Exception as e:
    +            self.logger.warning(f"Failed to validate state JWT: {e}")
    +            return False
    +
    +    async def async_issue(self, *args, **kwargs) -> str:
    +        return self.issue(*args, **kwargs)
    +
    +    async def async_consume(self, state: str) -> bool:
    +        return self.consume(state)
    +
    +

    A stateless OAuth state store backed by a signed, self-contained token.

    +

    issue() creates an HMAC-SHA256 signed token in the JWT style. The token +carries only an expiration claim. consume() re-verifies the signature and +the expiry. Nothing is stored server-side. No storage backend is required.

    +
    +

    Warning

    +

    This store provides no one-time-use / anti-replay guarantee. It returns +True for the same token every time until that token expires. This is +inherent to a stateless token. The token can only be invalidated by expiry. +It cannot be revoked early unless you add server-side state, and that would +defeat the point of being stateless.

    +

    Consequences for integrators:

    +
      +
    • Keep the token lifetime short. A token stays valid until it expires. +Use a short expiration_seconds. A value of 300 (5 minutes) is a +good choice and matches the OAuth sample. This limits how long a captured +state can be replayed.
    • +
    • Make the callback idempotent. A captured state can be replayed +within its lifetime. Your callback may run more than once for a single +authorization. The oauth.v2.access exchange and the installation +persistence must tolerate this. Slack authorization codes are single-use. +A sequential replay fails the token exchange. The real exposure is a +concurrent duplicate callback.
    • +
    • CSRF protection is unchanged. CSRF defense comes from the +Secure; HttpOnly state cookie. OAuthStateUtils validates that cookie +before consume() runs in the callback. Compared to the stateful stores, +this store only gives up anti-replay and defense-in-depth. It does not give +up CSRF protection.
    • +
    +
    +
    +
    Args
    +
    -----=
    +
    expiration_seconds
    +
    Lifetime of an issued state token in seconds. After +this window consume() returns False. Keep this value short. A +value of 300 (5 minutes) is a good default. Avoid long lifetimes.
    +
    signing_secret
    +
    Secret used to sign and verify tokens with HMAC. Keep it +secret. Keep it the same across every instance that must validate a +shared token.
    +
    logger
    +
    Logger for validation warnings.
    +
    +

    Ancestors

    + +

    Instance variables

    +
    +
    prop logger : logging.Logger
    +
    +
    + +Expand source code + +
    @property
    +def logger(self) -> Logger:
    +    if self._logger is None:
    +        self._logger = logging.getLogger(__name__)
    +    return self._logger
    +
    +
    +
    +
    +

    Methods

    +
    +
    +async def async_consume(self, state: str) ‑> bool +
    +
    +
    + +Expand source code + +
    async def async_consume(self, state: str) -> bool:
    +    return self.consume(state)
    +
    +
    +
    +
    +async def async_issue(self, *args, **kwargs) ‑> str +
    +
    +
    + +Expand source code + +
    async def async_issue(self, *args, **kwargs) -> str:
    +    return self.issue(*args, **kwargs)
    +
    +
    +
    +
    +def consume(self, state: str) ‑> bool +
    +
    +
    + +Expand source code + +
    def consume(self, state: str) -> bool:
    +    """Validate a ``state`` token's signature and ``expiration`` claim.
    +
    +    Returns ``True`` for any correctly signed, unexpired token, **every time**.
    +    This store keeps no record of consumed tokens. It does not enforce
    +    one-time-use. See the class docstring for the anti-replay caveat.
    +    """
    +    try:
    +        parts = state.split(".")
    +        if len(parts) != 3:
    +            return False
    +        header, payload, signature = parts
    +        expected_signature = self._sign(f"{header}.{payload}")
    +        if not hmac.compare_digest(signature, expected_signature):
    +            self.logger.warning("Invalid JWT signature for state parameter")
    +            return False
    +        claims = json.loads(self._b64url_decode(payload))
    +        exp = claims.get("exp")
    +        if exp is None or time.time() > exp:
    +            self.logger.warning("Expired or missing exp claim in state JWT")
    +            return False
    +        return True
    +    except Exception as e:
    +        self.logger.warning(f"Failed to validate state JWT: {e}")
    +        return False
    +
    +

    Validate a state token's signature and expiration claim.

    +

    Returns True for any correctly signed, unexpired token, every time. +This store keeps no record of consumed tokens. It does not enforce +one-time-use. See the class docstring for the anti-replay caveat.

    +
    +
    +def issue(self, *args, **kwargs) ‑> str +
    +
    +
    + +Expand source code + +
    def issue(self, *args, **kwargs) -> str:
    +    header = self._b64url_encode(json.dumps({"alg": "HS256", "typ": "JWT"}, separators=(",", ":")).encode())
    +    payload = self._b64url_encode(
    +        json.dumps({"exp": int(time.time()) + self.expiration_seconds}, separators=(",", ":")).encode()
    +    )
    +    signature = self._sign(f"{header}.{payload}")
    +    return f"{header}.{payload}.{signature}"
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    + + + diff --git a/docs/reference/oauth/token_rotation/async_rotator.html b/docs/reference/oauth/token_rotation/async_rotator.html index 35d64f362..b9fbfa862 100644 --- a/docs/reference/oauth/token_rotation/async_rotator.html +++ b/docs/reference/oauth/token_rotation/async_rotator.html @@ -258,15 +258,17 @@

    Methods

    raise SlackTokenRotationError(e)

    Performs bot token rotation if the underlying bot token is expired / expiring.

    -

    Args

    +
    Args
    +
    -----=
    bot
    the current bot installation data
    minutes_before_expiration
    the minutes before the token expiration
    -

    Returns

    -

    None if no rotation is necessary for now.

    +

    Returns +-----= +None if no rotation is necessary for now.

    async def perform_token_rotation(self,
    *,
    installation: Installation,
    minutes_before_expiration: int = 120) ‑> Installation | None
    @@ -316,15 +318,17 @@

    Returns

    return rotated_installation

    Performs token rotation if the underlying tokens (bot / user) are expired / expiring.

    -

    Args

    +
    Args
    +
    -----=
    installation
    the current installation data
    minutes_before_expiration
    the minutes before the token expiration
    -

    Returns

    -

    None if no rotation is necessary for now.

    +

    Returns +-----= +None if no rotation is necessary for now.

    async def perform_user_token_rotation(self,
    *,
    installation: Installation,
    minutes_before_expiration: int = 120) ‑> Installation | None
    @@ -374,15 +378,17 @@

    Returns

    raise SlackTokenRotationError(e)

    Performs user token rotation if the underlying user token is expired / expiring.

    -

    Args

    +
    Args
    +
    -----=
    installation
    the current installation data
    minutes_before_expiration
    the minutes before the token expiration
    -

    Returns

    -

    None if no rotation is necessary for now.

    +

    Returns +-----= +None if no rotation is necessary for now.

    diff --git a/docs/reference/oauth/token_rotation/index.html b/docs/reference/oauth/token_rotation/index.html index 979f9f80c..39fca7152 100644 --- a/docs/reference/oauth/token_rotation/index.html +++ b/docs/reference/oauth/token_rotation/index.html @@ -260,15 +260,17 @@

    Methods

    raise SlackTokenRotationError(e)

    Performs bot token rotation if the underlying bot token is expired / expiring.

    -

    Args

    +
    Args
    +
    -----=
    bot
    the current bot installation data
    minutes_before_expiration
    the minutes before the token expiration
    -

    Returns

    -

    None if no rotation is necessary for now.

    +

    Returns +-----= +None if no rotation is necessary for now.

    def perform_token_rotation(self,
    *,
    installation: Installation,
    minutes_before_expiration: int = 120) ‑> Installation | None
    @@ -318,15 +320,17 @@

    Returns

    return rotated_installation

    Performs token rotation if the underlying tokens (bot / user) are expired / expiring.

    -

    Args

    +
    Args
    +
    -----=
    installation
    the current installation data
    minutes_before_expiration
    the minutes before the token expiration
    -

    Returns

    -

    None if no rotation is necessary for now.

    +

    Returns +-----= +None if no rotation is necessary for now.

    def perform_user_token_rotation(self,
    *,
    installation: Installation,
    minutes_before_expiration: int = 120) ‑> Installation | None
    @@ -377,15 +381,17 @@

    Returns

    raise SlackTokenRotationError(e)

    Performs user token rotation if the underlying user token is expired / expiring.

    -

    Args

    +
    Args
    +
    -----=
    installation
    the current installation data
    minutes_before_expiration
    the minutes before the token expiration
    -

    Returns

    -

    None if no rotation is necessary for now.

    +

    Returns +-----= +None if no rotation is necessary for now.

    diff --git a/docs/reference/oauth/token_rotation/rotator.html b/docs/reference/oauth/token_rotation/rotator.html index afcccb48c..58f82a9a8 100644 --- a/docs/reference/oauth/token_rotation/rotator.html +++ b/docs/reference/oauth/token_rotation/rotator.html @@ -249,15 +249,17 @@

    Methods

    raise SlackTokenRotationError(e)

    Performs bot token rotation if the underlying bot token is expired / expiring.

    -

    Args

    +
    Args
    +
    -----=
    bot
    the current bot installation data
    minutes_before_expiration
    the minutes before the token expiration
    -

    Returns

    -

    None if no rotation is necessary for now.

    +

    Returns +-----= +None if no rotation is necessary for now.

    def perform_token_rotation(self,
    *,
    installation: Installation,
    minutes_before_expiration: int = 120) ‑> Installation | None
    @@ -307,15 +309,17 @@

    Returns

    return rotated_installation

    Performs token rotation if the underlying tokens (bot / user) are expired / expiring.

    -

    Args

    +
    Args
    +
    -----=
    installation
    the current installation data
    minutes_before_expiration
    the minutes before the token expiration
    -

    Returns

    -

    None if no rotation is necessary for now.

    +

    Returns +-----= +None if no rotation is necessary for now.

    def perform_user_token_rotation(self,
    *,
    installation: Installation,
    minutes_before_expiration: int = 120) ‑> Installation | None
    @@ -366,15 +370,17 @@

    Returns

    raise SlackTokenRotationError(e)

    Performs user token rotation if the underlying user token is expired / expiring.

    -

    Args

    +
    Args
    +
    -----=
    installation
    the current installation data
    minutes_before_expiration
    the minutes before the token expiration
    -

    Returns

    -

    None if no rotation is necessary for now.

    +

    Returns +-----= +None if no rotation is necessary for now.

    diff --git a/docs/reference/rtm/index.html b/docs/reference/rtm/index.html index 870fa3797..a24b73075 100644 --- a/docs/reference/rtm/index.html +++ b/docs/reference/rtm/index.html @@ -614,8 +614,9 @@

    Classes

    link callbacks to their corresponding events. When an event occurs this client executes your callback while passing along any information it receives.

    -

    Attributes

    +
    Attributes
    +
    -----=
    token : str
    A string specifying an xoxp or xoxb token.
    run_async : bool
    @@ -653,8 +654,9 @@

    Attributes

    If None is specified we attempt to use the current loop with get_event_loop. Default is None.
    -

    Methods

    -

    ping: Sends a ping message over the websocket to Slack. +

    Methods +-----= +ping: Sends a ping message over the websocket to Slack. typing: Sends a typing indicator to the specified channel. on: Stores and links callbacks to websocket and Slack events. run_on: Decorator that stores and links callbacks to websocket and Slack events. @@ -683,8 +685,9 @@

    Methods

    rtm_client = RTMClient(token=slack_token) rtm_client.start()
    -

    Note

    -

    The initial state returned when establishing an RTM connection will +

    Note +-----= +The initial state returned when establishing an RTM connection will be available as the data in payload for the 'open' event. This data is not and will not be stored on the RTM Client.

    Any attributes or methods prefixed with _underscores are @@ -697,8 +700,9 @@

    Static methods

    Stores and links the callback(s) to the event.

    -

    Args

    +
    Args
    +
    -----=
    event : str
    A string that specifies a Slack or websocket event. e.g. 'channel_joined' or 'open'
    @@ -706,9 +710,8 @@

    Args

    Any object or a list of objects that can be called. e.g. or [,]
    -
    -

    Raises

    -
    +
    Raises
    +
    -----=
    SlackClientError
    The specified callback is not callable.
    SlackClientError
    @@ -779,8 +782,9 @@

    Methods

    Sends a ping message over the websocket to Slack.

    Not all web browsers support the WebSocket ping spec, so the RTM protocol also supports ping/pong messages.

    -

    Raises

    +
    Raises
    +
    -----=
    SlackClientNotConnectedError
    Websocket connection is closed.
    @@ -820,15 +824,17 @@

    Raises

    return asyncio.ensure_future(self._send_json(payload), loop=self._event_loop)

    Sends a message to Slack over the WebSocket connection.

    -

    Note

    -

    The RTM API only supports posting simple messages formatted using +

    Note +-----= +The RTM API only supports posting simple messages formatted using our default message formatting mode. It does not support attachments or other message formatting modes. For this reason we recommend users send messages via the Web API methods. e.g. web_client.chat_postMessage()

    If the message "id" is not specified in the payload, it'll be added.

    -

    Args

    +
    Args
    +
    -----=
    payload : dict
    The message to send over the wesocket.
    @@ -838,8 +844,9 @@

    Args

    "type": "typing", "channel": "C024BE91L" }

    -

    Raises

    +
    Raises
    +
    -----=
    SlackClientNotConnectedError
    Websocket connection is closed.
    @@ -887,8 +894,9 @@

    Raises

    If 'auto_reconnect' is specified we retrieve a new url and reconnect any time the connection is lost unintentionally or an exception is thrown.

    -

    Raises

    +
    Raises
    +
    -----=
    SlackApiError
    Unable to retrieve RTM URL from Slack.
    @@ -946,13 +954,13 @@

    Raises

    Sends a typing indicator to the specified channel.

    This indicates that this app is currently writing a message to send to a channel.

    -

    Args

    +
    Args
    +
    -----=
    channel : str
    The channel id. e.g. 'C024BE91L'
    -
    -

    Raises

    -
    +
    Raises
    +
    -----=
    SlackClientNotConnectedError
    Websocket connection is closed.
    diff --git a/docs/reference/rtm/v2/index.html b/docs/reference/rtm/v2/index.html index d0c0591ec..5f6267c25 100644 --- a/docs/reference/rtm/v2/index.html +++ b/docs/reference/rtm/v2/index.html @@ -736,8 +736,9 @@

    Methods

    return __call__

    Registers a new event listener.

    -

    Args

    +
    Args
    +
    -----=
    event_type
    str representing an event's type (e.g., message, reaction_added)
    diff --git a/docs/reference/rtm_v2/index.html b/docs/reference/rtm_v2/index.html index 5d65bdc74..70d19d5c0 100644 --- a/docs/reference/rtm_v2/index.html +++ b/docs/reference/rtm_v2/index.html @@ -737,8 +737,9 @@

    Methods

    return __call__

    Registers a new event listener.

    -

    Args

    +
    Args
    +
    -----=
    event_type
    str representing an event's type (e.g., message, reaction_added)
    diff --git a/docs/reference/scim/async_client.html b/docs/reference/scim/async_client.html index c91441c29..db7fc9f35 100644 --- a/docs/reference/scim/async_client.html +++ b/docs/reference/scim/async_client.html @@ -419,8 +419,9 @@

    Classes

    API client for SCIM API See https://docs.slack.dev/admins/scim-api/ for more details

    -

    Args

    +
    Args
    +
    -----=
    token
    An admin user's token, which starts with xoxp-
    timeout
    diff --git a/docs/reference/scim/index.html b/docs/reference/scim/index.html index 1e6e1e228..61a5127cf 100644 --- a/docs/reference/scim/index.html +++ b/docs/reference/scim/index.html @@ -647,8 +647,9 @@

    Inherited members

    API client for SCIM API See https://docs.slack.dev/admins/scim-api/ for more details

    -

    Args

    +
    Args
    +
    -----=
    token
    An admin user's token, which starts with xoxp-
    timeout
    diff --git a/docs/reference/scim/v1/async_client.html b/docs/reference/scim/v1/async_client.html index 6a971bb80..261e93444 100644 --- a/docs/reference/scim/v1/async_client.html +++ b/docs/reference/scim/v1/async_client.html @@ -419,8 +419,9 @@

    Classes

    API client for SCIM API See https://docs.slack.dev/admins/scim-api/ for more details

    -

    Args

    +
    Args
    +
    -----=
    token
    An admin user's token, which starts with xoxp-
    timeout
    diff --git a/docs/reference/scim/v1/client.html b/docs/reference/scim/v1/client.html index 4317f2394..4474d925e 100644 --- a/docs/reference/scim/v1/client.html +++ b/docs/reference/scim/v1/client.html @@ -432,8 +432,9 @@

    Classes

    API client for SCIM API See https://docs.slack.dev/admins/scim-api/ for more details

    -

    Args

    +
    Args
    +
    -----=
    token
    An admin user's token, which starts with xoxp-
    timeout
    diff --git a/docs/reference/socket_mode/aiohttp/index.html b/docs/reference/socket_mode/aiohttp/index.html index 2568e6291..1c987d9b2 100644 --- a/docs/reference/socket_mode/aiohttp/index.html +++ b/docs/reference/socket_mode/aiohttp/index.html @@ -279,7 +279,7 @@

    Classes

    self.logger.debug( f"Received message " f"(type: {message_type}, " - f"data: {message_data}, " + f"data: {repr(message_data)}, " f"extra: {message.extra}, " f"session: {session_id})" ) @@ -496,8 +496,9 @@

    Classes

    return "s_" + str(hash(session))

    Socket Mode client

    -

    Args

    +
    Args
    +
    -----=
    app_token
    App-level token
    logger
    @@ -877,7 +878,7 @@

    Methods

    self.logger.debug( f"Received message " f"(type: {message_type}, " - f"data: {message_data}, " + f"data: {repr(message_data)}, " f"extra: {message.extra}, " f"session: {session_id})" ) diff --git a/docs/reference/socket_mode/async_client.html b/docs/reference/socket_mode/async_client.html index 20d07951a..2dba67f84 100644 --- a/docs/reference/socket_mode/async_client.html +++ b/docs/reference/socket_mode/async_client.html @@ -109,15 +109,22 @@

    Classes

    async def connect_to_new_endpoint(self, force: bool = False): session_id = await self.session_id() + acquired = False try: - await self.connect_operation_lock.acquire() + try: + acquired = await asyncio.wait_for(self.connect_operation_lock.acquire(), timeout=5) + except asyncio.TimeoutError: + acquired = False if self.trace_enabled: - self.logger.debug(f"For reconnection, the connect_operation_lock was acquired (session: {session_id})") - if force or not await self.is_connected(): + self.logger.debug( + f"Attempted to acquire the connect_operation_lock for reconnection " + f"(acquired={acquired}, session={session_id})" + ) + if force or (acquired and not await self.is_connected()): self.wss_uri = await self.issue_new_wss_url() await self.connect() finally: - if self.connect_operation_lock.locked() is True: + if acquired: self.connect_operation_lock.release() if self.trace_enabled: self.logger.debug(f"The connect_operation_lock for reconnection was released (session: {session_id})") @@ -297,15 +304,22 @@

    Methods

    async def connect_to_new_endpoint(self, force: bool = False):
         session_id = await self.session_id()
    +    acquired = False
         try:
    -        await self.connect_operation_lock.acquire()
    +        try:
    +            acquired = await asyncio.wait_for(self.connect_operation_lock.acquire(), timeout=5)
    +        except asyncio.TimeoutError:
    +            acquired = False
             if self.trace_enabled:
    -            self.logger.debug(f"For reconnection, the connect_operation_lock was acquired (session: {session_id})")
    -        if force or not await self.is_connected():
    +            self.logger.debug(
    +                f"Attempted to acquire the connect_operation_lock for reconnection "
    +                f"(acquired={acquired}, session={session_id})"
    +            )
    +        if force or (acquired and not await self.is_connected()):
                 self.wss_uri = await self.issue_new_wss_url()
                 await self.connect()
         finally:
    -        if self.connect_operation_lock.locked() is True:
    +        if acquired:
                 self.connect_operation_lock.release()
                 if self.trace_enabled:
                     self.logger.debug(f"The connect_operation_lock for reconnection was released (session: {session_id})")
    diff --git a/docs/reference/socket_mode/builtin/client.html b/docs/reference/socket_mode/builtin/client.html index 8e55f2347..056668a16 100644 --- a/docs/reference/socket_mode/builtin/client.html +++ b/docs/reference/socket_mode/builtin/client.html @@ -325,8 +325,9 @@

    Classes

    )

    Socket Mode client

    -

    Args

    +
    Args
    +
    -----=
    app_token
    App-level token
    logger
    diff --git a/docs/reference/socket_mode/builtin/index.html b/docs/reference/socket_mode/builtin/index.html index 9f710eaf6..b24db1c9b 100644 --- a/docs/reference/socket_mode/builtin/index.html +++ b/docs/reference/socket_mode/builtin/index.html @@ -339,8 +339,9 @@

    Classes

    )

    Socket Mode client

    -

    Args

    +
    Args
    +
    -----=
    app_token
    App-level token
    logger
    diff --git a/docs/reference/socket_mode/index.html b/docs/reference/socket_mode/index.html index 770181ab5..1fb84832e 100644 --- a/docs/reference/socket_mode/index.html +++ b/docs/reference/socket_mode/index.html @@ -376,8 +376,9 @@

    Classes

    )

    Socket Mode client

    -

    Args

    +
    Args
    +
    -----=
    app_token
    App-level token
    logger
    diff --git a/docs/reference/socket_mode/websocket_client/index.html b/docs/reference/socket_mode/websocket_client/index.html index 09cfb4424..c0df7f141 100644 --- a/docs/reference/socket_mode/websocket_client/index.html +++ b/docs/reference/socket_mode/websocket_client/index.html @@ -297,8 +297,9 @@

    Classes

    f"(error: {type(e).__name__}, message: {e})" ) -

    Args

    -
    +
    +
    Args
    +
    -----=
    app_token
    App-level token
    logger
    diff --git a/docs/reference/socket_mode/websockets/index.html b/docs/reference/socket_mode/websockets/index.html index 17b3c6dc2..a83d5d1a5 100644 --- a/docs/reference/socket_mode/websockets/index.html +++ b/docs/reference/socket_mode/websockets/index.html @@ -287,8 +287,9 @@

    Classes

    return "s_" + str(hash(session))

    Socket Mode client

    -

    Args

    +
    Args
    +
    -----=
    app_token
    App-level token
    logger
    diff --git a/docs/reference/web/async_base_client.html b/docs/reference/web/async_base_client.html index 97615d924..e58cf00a3 100644 --- a/docs/reference/web/async_base_client.html +++ b/docs/reference/web/async_base_client.html @@ -448,8 +448,9 @@

    Methods

    )

    Create a request and execute the API call to Slack.

    -

    Args

    +
    Args
    +
    -----=
    api_method : str
    The target Slack API method. e.g. 'chat.postMessage'
    @@ -474,14 +475,16 @@

    Args

    auth : dict
    A dictionary that consists of client_id and client_secret
    -

    Returns

    -

    (AsyncSlackResponse) +

    Returns +-----= +(AsyncSlackResponse) The server's response to an HTTP request. Data from the response can be accessed like a dict. If the response included 'next_cursor' it can be iterated on to execute subsequent requests.

    -

    Raises

    +
    Raises
    +
    -----=
    SlackApiError
    The following Slack API call failed: 'chat.postMessage'.
    diff --git a/docs/reference/web/async_chat_stream.html b/docs/reference/web/async_chat_stream.html index c9bcd185a..61792538d 100644 --- a/docs/reference/web/async_chat_stream.html +++ b/docs/reference/web/async_chat_stream.html @@ -191,6 +191,7 @@

    Classes

    chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, + session_status: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Stop the stream and finalize the message. @@ -202,6 +203,7 @@

    Classes

    what will be appended to the message received so far. metadata: JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. + session_status: The session status to set after stopping the stream. **kwargs: Additional arguments passed to the underlying API calls. Returns: @@ -250,6 +252,7 @@

    Classes

    blocks=blocks, chunks=flushings, metadata=metadata, + session_status=session_status, **kwargs, ) self._state = "completed" @@ -287,8 +290,9 @@

    Classes

    methods, with automatic buffering and state management.

    Initialize a new ChatStream instance.

    The init method creates a unique ChatStream instance that keeps track of one chat stream.

    -

    Args

    +
    Args
    +
    -----=
    client
    The WebClient instance to use for API calls.
    channel
    @@ -409,8 +413,9 @@

    Methods

    Append to the stream.

    The "append" method appends to the chat stream being used. This method can be called multiple times. After the stream is stopped this method cannot be called.

    -

    Args

    +
    Args
    +
    -----=
    chunks
    An array of streaming chunks. Chunks can be markdown text, plan, or task update chunks.
    markdown_text
    @@ -419,14 +424,17 @@

    Args

    **kwargs
    Additional arguments passed to the underlying API calls.
    -

    Returns

    -

    AsyncSlackResponse if the buffer was flushed, None if buffering.

    -

    Raises

    +

    Returns +-----= +AsyncSlackResponse if the buffer was flushed, None if buffering.

    +
    Raises
    +
    -----=
    SlackRequestError
    If the stream is already completed.
    -

    Example

    +

    Example +-----=

    streamer = client.chat_stream(
         channel="C0123456789",
         thread_ts="1700000001.123456",
    @@ -439,7 +447,7 @@ 

    Example

    -async def stop(self,
    *,
    markdown_text: str | None = None,
    chunks: Sequence[Dict | Chunk] | None = None,
    blocks: str | Sequence[Dict | Block] | None = None,
    metadata: Dict | Metadata | None = None,
    **kwargs) ‑> AsyncSlackResponse
    +async def stop(self,
    *,
    markdown_text: str | None = None,
    chunks: Sequence[Dict | Chunk] | None = None,
    blocks: str | Sequence[Dict | Block] | None = None,
    metadata: Dict | Metadata | None = None,
    session_status: str | None = None,
    **kwargs) ‑> AsyncSlackResponse
    @@ -453,6 +461,7 @@

    Example

    chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, + session_status: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Stop the stream and finalize the message. @@ -464,6 +473,7 @@

    Example

    what will be appended to the message received so far. metadata: JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. + session_status: The session status to set after stopping the stream. **kwargs: Additional arguments passed to the underlying API calls. Returns: @@ -512,14 +522,16 @@

    Example

    blocks=blocks, chunks=flushings, metadata=metadata, + session_status=session_status, **kwargs, ) self._state = "completed" return response

    Stop the stream and finalize the message.

    -

    Args

    +
    Args
    +
    -----=
    blocks
    A list of blocks that will be rendered at the bottom of the finalized message.
    chunks
    @@ -530,17 +542,22 @@

    Args

    metadata
    JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace.
    +
    session_status
    +
    The session status to set after stopping the stream.
    **kwargs
    Additional arguments passed to the underlying API calls.
    -

    Returns

    -

    AsyncSlackResponse from the chat.stopStream API call.

    -

    Raises

    +

    Returns +-----= +AsyncSlackResponse from the chat.stopStream API call.

    +
    Raises
    +
    -----=
    SlackRequestError
    If the stream is already completed.
    -

    Example

    +

    Example +-----=

    streamer = client.chat_stream(
         channel="C0123456789",
         thread_ts="1700000001.123456",
    diff --git a/docs/reference/web/async_client.html b/docs/reference/web/async_client.html
    index 8af35b5d1..a89d3e99e 100644
    --- a/docs/reference/web/async_client.html
    +++ b/docs/reference/web/async_client.html
    @@ -1953,6 +1953,58 @@ 

    Classes

    kwargs.update({"workflow_ids": workflow_ids}) return await self.api_call("admin.workflows.unpublish", params=kwargs) + async def agents_sessions_rename( + self, + *, + channel_id: str, + title: str, + thread_ts: Optional[str] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Rename an agent session. + https://docs.slack.dev/reference/methods/agents.sessions.rename + """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "thread_ts": thread_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return await self.api_call("agents.sessions.rename", json=kwargs) + + async def agents_sessions_setStatus( + self, + *, + channel_id: str, + status: str, + thread_ts: Optional[str] = None, + title: Optional[str] = None, + initiator_user_id: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Set an agent session's lifecycle status, creating the session if needed. + https://docs.slack.dev/reference/methods/agents.sessions.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "status": status, + "thread_ts": thread_ts, + "title": title, + "initiator_user_id": initiator_user_id, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return await self.api_call("agents.sessions.setStatus", json=kwargs) + async def api_test( self, *, @@ -2200,6 +2252,32 @@

    Classes

    kwargs.update({"cursor": cursor, "limit": limit, "include_icon": include_icon}) return await self.api_call("auth.teams.list", params=kwargs) + async def blocks_validate( + self, + *, + blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, + message: Optional[Union[str, Dict]] = None, + view: Optional[Union[str, Dict, View]] = None, + **kwargs, + ) -> AsyncSlackResponse: + """Validates an array of blocks, or a message or view payload. + Provide exactly one of ``blocks``, ``message``, or ``view``. + https://docs.slack.dev/reference/methods/blocks.validate + """ + if blocks is not None: + if isinstance(blocks, str): + kwargs.update({"blocks": blocks}) + else: + kwargs.update({"blocks": json.dumps([b.to_dict() if isinstance(b, Block) else b for b in blocks])}) + if message is not None: + kwargs.update({"message": message if isinstance(message, str) else json.dumps(message)}) + if view is not None: + if isinstance(view, View): + kwargs.update({"view": json.dumps(view.to_dict())}) + else: + kwargs.update({"view": view if isinstance(view, str) else json.dumps(view)}) + return await self.api_call("blocks.validate", params=kwargs) + async def bookmarks_add( self, *, @@ -2971,6 +3049,7 @@

    Classes

    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Stops a streaming conversation. @@ -2984,6 +3063,7 @@

    Classes

    "blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) @@ -6040,8 +6120,9 @@

    Classes

    and enacting change in a Slack workspace.

    This client handles constructing and sending HTTP requests to Slack as well as parsing any responses received into a SlackResponse.

    -

    Attributes

    +
    Attributes
    +
    -----=
    token : str
    A string specifying an xoxp-* or xoxb-* token.
    base_url : str
    @@ -6063,8 +6144,9 @@

    Attributes

    headers : dict
    Additional request headers to attach to all requests.
    -

    Methods

    -

    api_call: Constructs a request and executes the API call to Slack.

    +

    Methods +-----= +api_call: Constructs a request and executes the API call to Slack.

    Example of recommended usage:

        import os
         from slack_sdk.web.async_client import AsyncWebClient
    @@ -6088,8 +6170,9 @@ 

    Methods

    assert response["ok"] assert response["message"]["text"] == "Hello world!"
    -

    Note

    -

    Any attributes or methods prefixed with _underscores are +

    Note +-----= +Any attributes or methods prefixed with _underscores are intended to be "private" internal use only. They may be changed or removed at anytime.

    Ancestors

    @@ -9023,6 +9106,80 @@

    Methods

    Unpublish workflows within the team or enterprise https://docs.slack.dev/reference/methods/admin.workflows.unpublish

    +
    +async def agents_sessions_rename(self, *, channel_id: str, title: str, thread_ts: str | None = None, **kwargs) ‑> AsyncSlackResponse +
    +
    +
    + +Expand source code + +
    async def agents_sessions_rename(
    +    self,
    +    *,
    +    channel_id: str,
    +    title: str,
    +    thread_ts: Optional[str] = None,
    +    **kwargs,
    +) -> AsyncSlackResponse:
    +    """Rename an agent session.
    +    https://docs.slack.dev/reference/methods/agents.sessions.rename
    +    """
    +    kwargs.update(
    +        {
    +            "channel_id": channel_id,
    +            "title": title,
    +            "thread_ts": thread_ts,
    +        }
    +    )
    +    kwargs = _remove_none_values(kwargs)
    +    return await self.api_call("agents.sessions.rename", json=kwargs)
    +
    + +
    +
    +async def agents_sessions_setStatus(self,
    *,
    channel_id: str,
    status: str,
    thread_ts: str | None = None,
    title: str | None = None,
    initiator_user_id: str | None = None,
    icon_emoji: str | None = None,
    icon_url: str | None = None,
    username: str | None = None,
    **kwargs) ‑> AsyncSlackResponse
    +
    +
    +
    + +Expand source code + +
    async def agents_sessions_setStatus(
    +    self,
    +    *,
    +    channel_id: str,
    +    status: str,
    +    thread_ts: Optional[str] = None,
    +    title: Optional[str] = None,
    +    initiator_user_id: Optional[str] = None,
    +    icon_emoji: Optional[str] = None,
    +    icon_url: Optional[str] = None,
    +    username: Optional[str] = None,
    +    **kwargs,
    +) -> AsyncSlackResponse:
    +    """Set an agent session's lifecycle status, creating the session if needed.
    +    https://docs.slack.dev/reference/methods/agents.sessions.setStatus
    +    """
    +    kwargs.update(
    +        {
    +            "channel_id": channel_id,
    +            "status": status,
    +            "thread_ts": thread_ts,
    +            "title": title,
    +            "initiator_user_id": initiator_user_id,
    +            "icon_emoji": icon_emoji,
    +            "icon_url": icon_url,
    +            "username": username,
    +        }
    +    )
    +    kwargs = _remove_none_values(kwargs)
    +    return await self.api_call("agents.sessions.setStatus", json=kwargs)
    +
    +

    Set an agent session's lifecycle status, creating the session if needed. +https://docs.slack.dev/reference/methods/agents.sessions.setStatus

    +
    async def api_test(self, *, error: str | None = None, **kwargs) ‑> AsyncSlackResponse
    @@ -9436,6 +9593,44 @@

    Methods

    Checks authentication & identity. https://docs.slack.dev/reference/methods/auth.test

    +
    +async def blocks_validate(self,
    *,
    blocks: str | Sequence[Dict | Block] | None = None,
    message: str | Dict | None = None,
    view: str | Dict | View | None = None,
    **kwargs) ‑> AsyncSlackResponse
    +
    +
    +
    + +Expand source code + +
    async def blocks_validate(
    +    self,
    +    *,
    +    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None,
    +    message: Optional[Union[str, Dict]] = None,
    +    view: Optional[Union[str, Dict, View]] = None,
    +    **kwargs,
    +) -> AsyncSlackResponse:
    +    """Validates an array of blocks, or a message or view payload.
    +    Provide exactly one of ``blocks``, ``message``, or ``view``.
    +    https://docs.slack.dev/reference/methods/blocks.validate
    +    """
    +    if blocks is not None:
    +        if isinstance(blocks, str):
    +            kwargs.update({"blocks": blocks})
    +        else:
    +            kwargs.update({"blocks": json.dumps([b.to_dict() if isinstance(b, Block) else b for b in blocks])})
    +    if message is not None:
    +        kwargs.update({"message": message if isinstance(message, str) else json.dumps(message)})
    +    if view is not None:
    +        if isinstance(view, View):
    +            kwargs.update({"view": json.dumps(view.to_dict())})
    +        else:
    +            kwargs.update({"view": view if isinstance(view, str) else json.dumps(view)})
    +    return await self.api_call("blocks.validate", params=kwargs)
    +
    +

    Validates an array of blocks, or a message or view payload. +Provide exactly one of blocks, message, or view. +https://docs.slack.dev/reference/methods/blocks.validate

    +
    async def bookmarks_add(self,
    *,
    channel_id: str,
    title: str,
    type: str,
    emoji: str | None = None,
    entity_id: str | None = None,
    link: str | None = None,
    parent_id: str | None = None,
    **kwargs) ‑> AsyncSlackResponse
    @@ -10638,7 +10833,7 @@

    Methods

    https://docs.slack.dev/reference/methods/chat.startStream

    -async def chat_stopStream(self,
    *,
    channel: str,
    ts: str,
    markdown_text: str | None = None,
    blocks: str | Sequence[Dict | Block] | None = None,
    metadata: Dict | Metadata | None = None,
    chunks: Sequence[Dict | Chunk] | None = None,
    **kwargs) ‑> AsyncSlackResponse
    +async def chat_stopStream(self,
    *,
    channel: str,
    ts: str,
    markdown_text: str | None = None,
    blocks: str | Sequence[Dict | Block] | None = None,
    metadata: Dict | Metadata | None = None,
    chunks: Sequence[Dict | Chunk] | None = None,
    session_status: str | None = None,
    **kwargs) ‑> AsyncSlackResponse
    @@ -10654,6 +10849,7 @@

    Methods

    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> AsyncSlackResponse: """Stops a streaming conversation. @@ -10667,6 +10863,7 @@

    Methods

    "blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) @@ -10772,8 +10969,9 @@

    Methods

  • chat.stopStream: Stops a streaming conversation. Reference.
  • -

    Args

    +
    Args
    +
    -----=
    buffer_size
    The length of markdown_text to buffer in-memory before calling a stream method. Increasing this value decreases the number of method calls made for the same amount of text, which is useful to avoid rate @@ -10800,9 +10998,11 @@

    Args

    **kwargs
    Additional arguments passed to the underlying API calls.
    -

    Returns

    -

    ChatStream instance for managing the stream

    -

    Example

    +

    Returns +-----= +ChatStream instance for managing the stream

    +

    Example +-----=

    streamer = await client.chat_stream(
         channel="C0123456789",
         thread_ts="1700000001.123456",
    @@ -15687,6 +15887,8 @@ 

    admin_workflows_permissions_lookup
  • admin_workflows_search
  • admin_workflows_unpublish
  • +
  • agents_sessions_rename
  • +
  • agents_sessions_setStatus
  • api_test
  • apps_connections_open
  • apps_event_authorizations_list
  • @@ -15703,6 +15905,7 @@

    auth_revoke
  • auth_teams_list
  • auth_test
  • +
  • blocks_validate
  • bookmarks_add
  • bookmarks_edit
  • bookmarks_list
  • diff --git a/docs/reference/web/async_slack_response.html b/docs/reference/web/async_slack_response.html index 5deb67481..f031d597d 100644 --- a/docs/reference/web/async_slack_response.html +++ b/docs/reference/web/async_slack_response.html @@ -248,14 +248,16 @@

    Classes

    raise e.SlackApiError(message=msg, response=self)

    An iterable container of response data.

    -

    Attributes

    +
    Attributes
    +
    -----=
    data : dict
    The json-encoded content of the response. Along with the headers and status code information.
    -

    Methods

    -

    validate: Check if the response from Slack was successful. +

    Methods +-----= +validate: Check if the response from Slack was successful. get: Retrieves any key from the response data. next: Retrieves the next portion of results, if 'next_cursor' is present.

    @@ -275,8 +277,9 @@

    Methods

    async for page in await client.users_list(limit=2): users = users + page['members']
    -

    Note

    -

    Some responses return collections of information +

    Note +-----= +Some responses return collections of information like channel and user lists. If they do it's likely that you'll only receive a portion of results. This object allows you to iterate over the response which @@ -313,12 +316,14 @@

    Methods

    return self.data.get(key, default)

    Retrieves any key from the response data.

    -

    Note

    -

    This is implemented so users can reference the +

    Note +-----= +This is implemented so users can reference the SlackResponse object like a dictionary. e.g. response.get("ok", False)

    -

    Returns

    -

    The value from data or the specified default.

    +

    Returns +-----= +The value from data or the specified default.

    def validate(self) @@ -344,11 +349,13 @@

    Returns

    raise e.SlackApiError(message=msg, response=self)

    Check if the response from Slack was successful.

    -

    Returns

    -

    (AsyncSlackResponse) +

    Returns +-----= +(AsyncSlackResponse) This method returns it's own object. e.g. 'self'

    -

    Raises

    +
    Raises
    +
    -----=
    SlackApiError
    The request to the Slack API failed.
    diff --git a/docs/reference/web/base_client.html b/docs/reference/web/base_client.html index affbba13c..0aa95faf0 100644 --- a/docs/reference/web/base_client.html +++ b/docs/reference/web/base_client.html @@ -721,8 +721,9 @@

    Static methods

    header. The signature is created by combining the signing secret with the body of the request we're sending using a standard HMAC-SHA256 keyed hash.

    https://docs.slack.dev/authentication/verifying-requests-from-slack/#how_to_make_a_request_signature_in_4_easy_steps__an_overview

    -

    Args

    +
    Args
    +
    -----=
    signing_secret
    Your application's signing secret, available in the Slack API dashboard
    @@ -734,8 +735,9 @@

    Args

    from the 'X-Slack-Signature' header - the calculated signature should match this.
    -

    Returns

    -

    True if signatures matches

    +

    Returns +-----= +True if signatures matches

    Instance variables

    @@ -863,8 +865,9 @@

    Methods

    return self._sync_send(api_url=api_url, req_args=req_args)

    Create a request and execute the API call to Slack.

    -

    Args

    +
    Args
    +
    -----=
    api_method : str
    The target Slack API method. e.g. 'chat.postMessage'
    @@ -889,14 +892,16 @@

    Args

    auth : dict
    A dictionary that consists of client_id and client_secret
    -

    Returns

    -

    (SlackResponse) +

    Returns +-----= +(SlackResponse) The server's response to an HTTP request. Data from the response can be accessed like a dict. If the response included 'next_cursor' it can be iterated on to execute subsequent requests.

    -

    Raises

    +
    Raises
    +
    -----=
    SlackApiError
    The following Slack API call failed: 'chat.postMessage'.
    diff --git a/docs/reference/web/chat_stream.html b/docs/reference/web/chat_stream.html index a6887e3c9..116eb6df4 100644 --- a/docs/reference/web/chat_stream.html +++ b/docs/reference/web/chat_stream.html @@ -191,6 +191,7 @@

    Classes

    chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, + session_status: Optional[str] = None, **kwargs, ) -> SlackResponse: """Stop the stream and finalize the message. @@ -202,6 +203,7 @@

    Classes

    what will be appended to the message received so far. metadata: JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. + session_status: The session status to set after stopping the stream. **kwargs: Additional arguments passed to the underlying API calls. Returns: @@ -250,6 +252,7 @@

    Classes

    blocks=blocks, chunks=flushings, metadata=metadata, + session_status=session_status, **kwargs, ) self._state = "completed" @@ -287,8 +290,9 @@

    Classes

    methods, with automatic buffering and state management.

    Initialize a new ChatStream instance.

    The init method creates a unique ChatStream instance that keeps track of one chat stream.

    -

    Args

    +
    Args
    +
    -----=
    client
    The WebClient instance to use for API calls.
    channel
    @@ -409,8 +413,9 @@

    Methods

    Append to the stream.

    The "append" method appends to the chat stream being used. This method can be called multiple times. After the stream is stopped this method cannot be called.

    -

    Args

    +
    Args
    +
    -----=
    chunks
    An array of streaming chunks. Chunks can be markdown text, plan, or task update chunks.
    markdown_text
    @@ -419,14 +424,17 @@

    Args

    **kwargs
    Additional arguments passed to the underlying API calls.
    -

    Returns

    -

    SlackResponse if the buffer was flushed, None if buffering.

    -

    Raises

    +

    Returns +-----= +SlackResponse if the buffer was flushed, None if buffering.

    +
    Raises
    +
    -----=
    SlackRequestError
    If the stream is already completed.
    -

    Example

    +

    Example +-----=

    streamer = client.chat_stream(
         channel="C0123456789",
         thread_ts="1700000001.123456",
    @@ -439,7 +447,7 @@ 

    Example

    -def stop(self,
    *,
    markdown_text: str | None = None,
    chunks: Sequence[Dict | Chunk] | None = None,
    blocks: str | Sequence[Dict | Block] | None = None,
    metadata: Dict | Metadata | None = None,
    **kwargs) ‑> SlackResponse
    +def stop(self,
    *,
    markdown_text: str | None = None,
    chunks: Sequence[Dict | Chunk] | None = None,
    blocks: str | Sequence[Dict | Block] | None = None,
    metadata: Dict | Metadata | None = None,
    session_status: str | None = None,
    **kwargs) ‑> SlackResponse
    @@ -453,6 +461,7 @@

    Example

    chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, + session_status: Optional[str] = None, **kwargs, ) -> SlackResponse: """Stop the stream and finalize the message. @@ -464,6 +473,7 @@

    Example

    what will be appended to the message received so far. metadata: JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. + session_status: The session status to set after stopping the stream. **kwargs: Additional arguments passed to the underlying API calls. Returns: @@ -512,14 +522,16 @@

    Example

    blocks=blocks, chunks=flushings, metadata=metadata, + session_status=session_status, **kwargs, ) self._state = "completed" return response

    Stop the stream and finalize the message.

    -

    Args

    +
    Args
    +
    -----=
    blocks
    A list of blocks that will be rendered at the bottom of the finalized message.
    chunks
    @@ -530,17 +542,22 @@

    Args

    metadata
    JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace.
    +
    session_status
    +
    The session status to set after stopping the stream.
    **kwargs
    Additional arguments passed to the underlying API calls.
    -

    Returns

    -

    SlackResponse from the chat.stopStream API call.

    -

    Raises

    +

    Returns +-----= +SlackResponse from the chat.stopStream API call.

    +
    Raises
    +
    -----=
    SlackRequestError
    If the stream is already completed.
    -

    Example

    +

    Example +-----=

    streamer = client.chat_stream(
         channel="C0123456789",
         thread_ts="1700000001.123456",
    diff --git a/docs/reference/web/client.html b/docs/reference/web/client.html
    index 58d305038..197b2e9fa 100644
    --- a/docs/reference/web/client.html
    +++ b/docs/reference/web/client.html
    @@ -1953,6 +1953,58 @@ 

    Classes

    kwargs.update({"workflow_ids": workflow_ids}) return self.api_call("admin.workflows.unpublish", params=kwargs) + def agents_sessions_rename( + self, + *, + channel_id: str, + title: str, + thread_ts: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Rename an agent session. + https://docs.slack.dev/reference/methods/agents.sessions.rename + """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "thread_ts": thread_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.rename", json=kwargs) + + def agents_sessions_setStatus( + self, + *, + channel_id: str, + status: str, + thread_ts: Optional[str] = None, + title: Optional[str] = None, + initiator_user_id: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Set an agent session's lifecycle status, creating the session if needed. + https://docs.slack.dev/reference/methods/agents.sessions.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "status": status, + "thread_ts": thread_ts, + "title": title, + "initiator_user_id": initiator_user_id, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.setStatus", json=kwargs) + def api_test( self, *, @@ -2200,6 +2252,32 @@

    Classes

    kwargs.update({"cursor": cursor, "limit": limit, "include_icon": include_icon}) return self.api_call("auth.teams.list", params=kwargs) + def blocks_validate( + self, + *, + blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, + message: Optional[Union[str, Dict]] = None, + view: Optional[Union[str, Dict, View]] = None, + **kwargs, + ) -> SlackResponse: + """Validates an array of blocks, or a message or view payload. + Provide exactly one of ``blocks``, ``message``, or ``view``. + https://docs.slack.dev/reference/methods/blocks.validate + """ + if blocks is not None: + if isinstance(blocks, str): + kwargs.update({"blocks": blocks}) + else: + kwargs.update({"blocks": json.dumps([b.to_dict() if isinstance(b, Block) else b for b in blocks])}) + if message is not None: + kwargs.update({"message": message if isinstance(message, str) else json.dumps(message)}) + if view is not None: + if isinstance(view, View): + kwargs.update({"view": json.dumps(view.to_dict())}) + else: + kwargs.update({"view": view if isinstance(view, str) else json.dumps(view)}) + return self.api_call("blocks.validate", params=kwargs) + def bookmarks_add( self, *, @@ -2971,6 +3049,7 @@

    Classes

    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> SlackResponse: """Stops a streaming conversation. @@ -2984,6 +3063,7 @@

    Classes

    "blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) @@ -6040,8 +6120,9 @@

    Classes

    and enacting change in a Slack workspace.

    This client handles constructing and sending HTTP requests to Slack as well as parsing any responses received into a SlackResponse.

    -

    Attributes

    +
    Attributes
    +
    -----=
    token : str
    A string specifying an xoxp-* or xoxb-* token.
    base_url : str
    @@ -6063,8 +6144,9 @@

    Attributes

    headers : dict
    Additional request headers to attach to all requests.
    -

    Methods

    -

    api_call: Constructs a request and executes the API call to Slack.

    +

    Methods +-----= +api_call: Constructs a request and executes the API call to Slack.

    Example of recommended usage:

        import os
         from slack_sdk import WebClient
    @@ -6088,8 +6170,9 @@ 

    Methods

    assert response["ok"] assert response["message"]["text"] == "Hello world!"
    -

    Note

    -

    Any attributes or methods prefixed with _underscores are +

    Note +-----= +Any attributes or methods prefixed with _underscores are intended to be "private" internal use only. They may be changed or removed at anytime.

    Ancestors

    @@ -9023,6 +9106,80 @@

    Methods

    Unpublish workflows within the team or enterprise https://docs.slack.dev/reference/methods/admin.workflows.unpublish

    +
    +def agents_sessions_rename(self, *, channel_id: str, title: str, thread_ts: str | None = None, **kwargs) ‑> SlackResponse +
    +
    +
    + +Expand source code + +
    def agents_sessions_rename(
    +    self,
    +    *,
    +    channel_id: str,
    +    title: str,
    +    thread_ts: Optional[str] = None,
    +    **kwargs,
    +) -> SlackResponse:
    +    """Rename an agent session.
    +    https://docs.slack.dev/reference/methods/agents.sessions.rename
    +    """
    +    kwargs.update(
    +        {
    +            "channel_id": channel_id,
    +            "title": title,
    +            "thread_ts": thread_ts,
    +        }
    +    )
    +    kwargs = _remove_none_values(kwargs)
    +    return self.api_call("agents.sessions.rename", json=kwargs)
    +
    + +
    +
    +def agents_sessions_setStatus(self,
    *,
    channel_id: str,
    status: str,
    thread_ts: str | None = None,
    title: str | None = None,
    initiator_user_id: str | None = None,
    icon_emoji: str | None = None,
    icon_url: str | None = None,
    username: str | None = None,
    **kwargs) ‑> SlackResponse
    +
    +
    +
    + +Expand source code + +
    def agents_sessions_setStatus(
    +    self,
    +    *,
    +    channel_id: str,
    +    status: str,
    +    thread_ts: Optional[str] = None,
    +    title: Optional[str] = None,
    +    initiator_user_id: Optional[str] = None,
    +    icon_emoji: Optional[str] = None,
    +    icon_url: Optional[str] = None,
    +    username: Optional[str] = None,
    +    **kwargs,
    +) -> SlackResponse:
    +    """Set an agent session's lifecycle status, creating the session if needed.
    +    https://docs.slack.dev/reference/methods/agents.sessions.setStatus
    +    """
    +    kwargs.update(
    +        {
    +            "channel_id": channel_id,
    +            "status": status,
    +            "thread_ts": thread_ts,
    +            "title": title,
    +            "initiator_user_id": initiator_user_id,
    +            "icon_emoji": icon_emoji,
    +            "icon_url": icon_url,
    +            "username": username,
    +        }
    +    )
    +    kwargs = _remove_none_values(kwargs)
    +    return self.api_call("agents.sessions.setStatus", json=kwargs)
    +
    +

    Set an agent session's lifecycle status, creating the session if needed. +https://docs.slack.dev/reference/methods/agents.sessions.setStatus

    +
    def api_test(self, *, error: str | None = None, **kwargs) ‑> SlackResponse
    @@ -9436,6 +9593,44 @@

    Methods

    Checks authentication & identity. https://docs.slack.dev/reference/methods/auth.test

    +
    +def blocks_validate(self,
    *,
    blocks: str | Sequence[Dict | Block] | None = None,
    message: str | Dict | None = None,
    view: str | Dict | View | None = None,
    **kwargs) ‑> SlackResponse
    +
    +
    +
    + +Expand source code + +
    def blocks_validate(
    +    self,
    +    *,
    +    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None,
    +    message: Optional[Union[str, Dict]] = None,
    +    view: Optional[Union[str, Dict, View]] = None,
    +    **kwargs,
    +) -> SlackResponse:
    +    """Validates an array of blocks, or a message or view payload.
    +    Provide exactly one of ``blocks``, ``message``, or ``view``.
    +    https://docs.slack.dev/reference/methods/blocks.validate
    +    """
    +    if blocks is not None:
    +        if isinstance(blocks, str):
    +            kwargs.update({"blocks": blocks})
    +        else:
    +            kwargs.update({"blocks": json.dumps([b.to_dict() if isinstance(b, Block) else b for b in blocks])})
    +    if message is not None:
    +        kwargs.update({"message": message if isinstance(message, str) else json.dumps(message)})
    +    if view is not None:
    +        if isinstance(view, View):
    +            kwargs.update({"view": json.dumps(view.to_dict())})
    +        else:
    +            kwargs.update({"view": view if isinstance(view, str) else json.dumps(view)})
    +    return self.api_call("blocks.validate", params=kwargs)
    +
    +

    Validates an array of blocks, or a message or view payload. +Provide exactly one of blocks, message, or view. +https://docs.slack.dev/reference/methods/blocks.validate

    +
    def bookmarks_add(self,
    *,
    channel_id: str,
    title: str,
    type: str,
    emoji: str | None = None,
    entity_id: str | None = None,
    link: str | None = None,
    parent_id: str | None = None,
    **kwargs) ‑> SlackResponse
    @@ -10638,7 +10833,7 @@

    Methods

    https://docs.slack.dev/reference/methods/chat.startStream

    -def chat_stopStream(self,
    *,
    channel: str,
    ts: str,
    markdown_text: str | None = None,
    blocks: str | Sequence[Dict | Block] | None = None,
    metadata: Dict | Metadata | None = None,
    chunks: Sequence[Dict | Chunk] | None = None,
    **kwargs) ‑> SlackResponse
    +def chat_stopStream(self,
    *,
    channel: str,
    ts: str,
    markdown_text: str | None = None,
    blocks: str | Sequence[Dict | Block] | None = None,
    metadata: Dict | Metadata | None = None,
    chunks: Sequence[Dict | Chunk] | None = None,
    session_status: str | None = None,
    **kwargs) ‑> SlackResponse
    @@ -10654,6 +10849,7 @@

    Methods

    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> SlackResponse: """Stops a streaming conversation. @@ -10667,6 +10863,7 @@

    Methods

    "blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) @@ -10772,8 +10969,9 @@

    Methods

  • chat.stopStream: Stops a streaming conversation. Reference.
  • -

    Args

    +
    Args
    +
    -----=
    buffer_size
    The length of markdown_text to buffer in-memory before calling a stream method. Increasing this value decreases the number of method calls made for the same amount of text, which is useful to avoid rate @@ -10800,9 +10998,11 @@

    Args

    **kwargs
    Additional arguments passed to the underlying API calls.
    -

    Returns

    -

    ChatStream instance for managing the stream

    -

    Example

    +

    Returns +-----= +ChatStream instance for managing the stream

    +

    Example +-----=

    streamer = client.chat_stream(
         channel="C0123456789",
         thread_ts="1700000001.123456",
    @@ -15686,6 +15886,8 @@ 

    admin_workflows_permissions_lookup
  • admin_workflows_search
  • admin_workflows_unpublish
  • +
  • agents_sessions_rename
  • +
  • agents_sessions_setStatus
  • api_test
  • apps_connections_open
  • apps_event_authorizations_list
  • @@ -15702,6 +15904,7 @@

    auth_revoke
  • auth_teams_list
  • auth_test
  • +
  • blocks_validate
  • bookmarks_add
  • bookmarks_edit
  • bookmarks_list
  • diff --git a/docs/reference/web/index.html b/docs/reference/web/index.html index d5598018f..8c42b1030 100644 --- a/docs/reference/web/index.html +++ b/docs/reference/web/index.html @@ -307,14 +307,16 @@

    Classes

    raise e.SlackApiError(message=msg, response=self)

    An iterable container of response data.

    -

    Attributes

    +
    Attributes
    +
    -----=
    data : dict
    The json-encoded content of the response. Along with the headers and status code information.
    -

    Methods

    -

    validate: Check if the response from Slack was successful. +

    Methods +-----= +validate: Check if the response from Slack was successful. get: Retrieves any key from the response data. next: Retrieves the next portion of results, if 'next_cursor' is present.

    @@ -334,8 +336,9 @@

    Methods

    for page in client.users_list(limit=2): users = users + page['members']
    -

    Note

    -

    Some responses return collections of information +

    Note +-----= +Some responses return collections of information like channel and user lists. If they do it's likely that you'll only receive a portion of results. This object allows you to iterate over the response which @@ -372,12 +375,14 @@

    Methods

    return self.data.get(key, default)

    Retrieves any key from the response data.

    -

    Note

    -

    This is implemented so users can reference the +

    Note +-----= +This is implemented so users can reference the SlackResponse object like a dictionary. e.g. response.get("ok", False)

    -

    Returns

    -

    The value from data or the specified default.

    +

    Returns +-----= +The value from data or the specified default.

    def validate(self) @@ -403,11 +408,13 @@

    Returns

    raise e.SlackApiError(message=msg, response=self)

    Check if the response from Slack was successful.

    -

    Returns

    -

    (SlackResponse) +

    Returns +-----= +(SlackResponse) This method returns it's own object. e.g. 'self'

    -

    Raises

    +
    Raises
    +
    -----=
    SlackApiError
    The request to the Slack API failed.
    @@ -2320,6 +2327,58 @@

    Raises

    kwargs.update({"workflow_ids": workflow_ids}) return self.api_call("admin.workflows.unpublish", params=kwargs) + def agents_sessions_rename( + self, + *, + channel_id: str, + title: str, + thread_ts: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Rename an agent session. + https://docs.slack.dev/reference/methods/agents.sessions.rename + """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "thread_ts": thread_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.rename", json=kwargs) + + def agents_sessions_setStatus( + self, + *, + channel_id: str, + status: str, + thread_ts: Optional[str] = None, + title: Optional[str] = None, + initiator_user_id: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> SlackResponse: + """Set an agent session's lifecycle status, creating the session if needed. + https://docs.slack.dev/reference/methods/agents.sessions.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "status": status, + "thread_ts": thread_ts, + "title": title, + "initiator_user_id": initiator_user_id, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.setStatus", json=kwargs) + def api_test( self, *, @@ -2567,6 +2626,32 @@

    Raises

    kwargs.update({"cursor": cursor, "limit": limit, "include_icon": include_icon}) return self.api_call("auth.teams.list", params=kwargs) + def blocks_validate( + self, + *, + blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, + message: Optional[Union[str, Dict]] = None, + view: Optional[Union[str, Dict, View]] = None, + **kwargs, + ) -> SlackResponse: + """Validates an array of blocks, or a message or view payload. + Provide exactly one of ``blocks``, ``message``, or ``view``. + https://docs.slack.dev/reference/methods/blocks.validate + """ + if blocks is not None: + if isinstance(blocks, str): + kwargs.update({"blocks": blocks}) + else: + kwargs.update({"blocks": json.dumps([b.to_dict() if isinstance(b, Block) else b for b in blocks])}) + if message is not None: + kwargs.update({"message": message if isinstance(message, str) else json.dumps(message)}) + if view is not None: + if isinstance(view, View): + kwargs.update({"view": json.dumps(view.to_dict())}) + else: + kwargs.update({"view": view if isinstance(view, str) else json.dumps(view)}) + return self.api_call("blocks.validate", params=kwargs) + def bookmarks_add( self, *, @@ -3338,6 +3423,7 @@

    Raises

    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> SlackResponse: """Stops a streaming conversation. @@ -3351,6 +3437,7 @@

    Raises

    "blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) @@ -6407,8 +6494,9 @@

    Raises

    and enacting change in a Slack workspace.

    This client handles constructing and sending HTTP requests to Slack as well as parsing any responses received into a SlackResponse.

    -

    Attributes

    +
    Attributes
    +
    -----=
    token : str
    A string specifying an xoxp-* or xoxb-* token.
    base_url : str
    @@ -6430,8 +6518,9 @@

    Attributes

    headers : dict
    Additional request headers to attach to all requests.
    -

    Methods

    -

    api_call: Constructs a request and executes the API call to Slack.

    +

    Methods +-----= +api_call: Constructs a request and executes the API call to Slack.

    Example of recommended usage:

        import os
         from slack_sdk import WebClient
    @@ -6455,8 +6544,9 @@ 

    Methods

    assert response["ok"] assert response["message"]["text"] == "Hello world!"
    -

    Note

    -

    Any attributes or methods prefixed with _underscores are +

    Note +-----= +Any attributes or methods prefixed with _underscores are intended to be "private" internal use only. They may be changed or removed at anytime.

    Ancestors

    @@ -9390,6 +9480,80 @@

    Methods

    Unpublish workflows within the team or enterprise https://docs.slack.dev/reference/methods/admin.workflows.unpublish

    +
    +def agents_sessions_rename(self, *, channel_id: str, title: str, thread_ts: str | None = None, **kwargs) ‑> SlackResponse +
    +
    +
    + +Expand source code + +
    def agents_sessions_rename(
    +    self,
    +    *,
    +    channel_id: str,
    +    title: str,
    +    thread_ts: Optional[str] = None,
    +    **kwargs,
    +) -> SlackResponse:
    +    """Rename an agent session.
    +    https://docs.slack.dev/reference/methods/agents.sessions.rename
    +    """
    +    kwargs.update(
    +        {
    +            "channel_id": channel_id,
    +            "title": title,
    +            "thread_ts": thread_ts,
    +        }
    +    )
    +    kwargs = _remove_none_values(kwargs)
    +    return self.api_call("agents.sessions.rename", json=kwargs)
    +
    + +
    +
    +def agents_sessions_setStatus(self,
    *,
    channel_id: str,
    status: str,
    thread_ts: str | None = None,
    title: str | None = None,
    initiator_user_id: str | None = None,
    icon_emoji: str | None = None,
    icon_url: str | None = None,
    username: str | None = None,
    **kwargs) ‑> SlackResponse
    +
    +
    +
    + +Expand source code + +
    def agents_sessions_setStatus(
    +    self,
    +    *,
    +    channel_id: str,
    +    status: str,
    +    thread_ts: Optional[str] = None,
    +    title: Optional[str] = None,
    +    initiator_user_id: Optional[str] = None,
    +    icon_emoji: Optional[str] = None,
    +    icon_url: Optional[str] = None,
    +    username: Optional[str] = None,
    +    **kwargs,
    +) -> SlackResponse:
    +    """Set an agent session's lifecycle status, creating the session if needed.
    +    https://docs.slack.dev/reference/methods/agents.sessions.setStatus
    +    """
    +    kwargs.update(
    +        {
    +            "channel_id": channel_id,
    +            "status": status,
    +            "thread_ts": thread_ts,
    +            "title": title,
    +            "initiator_user_id": initiator_user_id,
    +            "icon_emoji": icon_emoji,
    +            "icon_url": icon_url,
    +            "username": username,
    +        }
    +    )
    +    kwargs = _remove_none_values(kwargs)
    +    return self.api_call("agents.sessions.setStatus", json=kwargs)
    +
    +

    Set an agent session's lifecycle status, creating the session if needed. +https://docs.slack.dev/reference/methods/agents.sessions.setStatus

    +
    def api_test(self, *, error: str | None = None, **kwargs) ‑> SlackResponse
    @@ -9803,6 +9967,44 @@

    Methods

    Checks authentication & identity. https://docs.slack.dev/reference/methods/auth.test

    +
    +def blocks_validate(self,
    *,
    blocks: str | Sequence[Dict | Block] | None = None,
    message: str | Dict | None = None,
    view: str | Dict | View | None = None,
    **kwargs) ‑> SlackResponse
    +
    +
    +
    + +Expand source code + +
    def blocks_validate(
    +    self,
    +    *,
    +    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None,
    +    message: Optional[Union[str, Dict]] = None,
    +    view: Optional[Union[str, Dict, View]] = None,
    +    **kwargs,
    +) -> SlackResponse:
    +    """Validates an array of blocks, or a message or view payload.
    +    Provide exactly one of ``blocks``, ``message``, or ``view``.
    +    https://docs.slack.dev/reference/methods/blocks.validate
    +    """
    +    if blocks is not None:
    +        if isinstance(blocks, str):
    +            kwargs.update({"blocks": blocks})
    +        else:
    +            kwargs.update({"blocks": json.dumps([b.to_dict() if isinstance(b, Block) else b for b in blocks])})
    +    if message is not None:
    +        kwargs.update({"message": message if isinstance(message, str) else json.dumps(message)})
    +    if view is not None:
    +        if isinstance(view, View):
    +            kwargs.update({"view": json.dumps(view.to_dict())})
    +        else:
    +            kwargs.update({"view": view if isinstance(view, str) else json.dumps(view)})
    +    return self.api_call("blocks.validate", params=kwargs)
    +
    +

    Validates an array of blocks, or a message or view payload. +Provide exactly one of blocks, message, or view. +https://docs.slack.dev/reference/methods/blocks.validate

    +
    def bookmarks_add(self,
    *,
    channel_id: str,
    title: str,
    type: str,
    emoji: str | None = None,
    entity_id: str | None = None,
    link: str | None = None,
    parent_id: str | None = None,
    **kwargs) ‑> SlackResponse
    @@ -11005,7 +11207,7 @@

    Methods

    https://docs.slack.dev/reference/methods/chat.startStream

    -def chat_stopStream(self,
    *,
    channel: str,
    ts: str,
    markdown_text: str | None = None,
    blocks: str | Sequence[Dict | Block] | None = None,
    metadata: Dict | Metadata | None = None,
    chunks: Sequence[Dict | Chunk] | None = None,
    **kwargs) ‑> SlackResponse
    +def chat_stopStream(self,
    *,
    channel: str,
    ts: str,
    markdown_text: str | None = None,
    blocks: str | Sequence[Dict | Block] | None = None,
    metadata: Dict | Metadata | None = None,
    chunks: Sequence[Dict | Chunk] | None = None,
    session_status: str | None = None,
    **kwargs) ‑> SlackResponse
    @@ -11021,6 +11223,7 @@

    Methods

    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> SlackResponse: """Stops a streaming conversation. @@ -11034,6 +11237,7 @@

    Methods

    "blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) @@ -11139,8 +11343,9 @@

    Methods

  • chat.stopStream: Stops a streaming conversation. Reference.
  • -

    Args

    +
    Args
    +
    -----=
    buffer_size
    The length of markdown_text to buffer in-memory before calling a stream method. Increasing this value decreases the number of method calls made for the same amount of text, which is useful to avoid rate @@ -11167,9 +11372,11 @@

    Args

    **kwargs
    Additional arguments passed to the underlying API calls.
    -

    Returns

    -

    ChatStream instance for managing the stream

    -

    Example

    +

    Returns +-----= +ChatStream instance for managing the stream

    +

    Example +-----=

    streamer = client.chat_stream(
         channel="C0123456789",
         thread_ts="1700000001.123456",
    @@ -16079,6 +16286,8 @@ 

    Web
  • admin_workflows_permissions_lookup
  • admin_workflows_search
  • admin_workflows_unpublish
  • +
  • agents_sessions_rename
  • +
  • agents_sessions_setStatus
  • api_test
  • apps_connections_open
  • apps_event_authorizations_list
  • @@ -16095,6 +16304,7 @@

    Web
  • auth_revoke
  • auth_teams_list
  • auth_test
  • +
  • blocks_validate
  • bookmarks_add
  • bookmarks_edit
  • bookmarks_list
  • diff --git a/docs/reference/web/internal_utils.html b/docs/reference/web/internal_utils.html index 89227edce..27fa57f04 100644 --- a/docs/reference/web/internal_utils.html +++ b/docs/reference/web/internal_utils.html @@ -73,13 +73,15 @@

    Functions

    Slack APIs safely accept "0"/"1" as boolean values. Using True/False (bool in Python) doesn't work with aiohttp. This method converts only the bool values in top-level of a given dict.

    -

    Args

    +
    Args
    +
    -----=
    params
    params as a dict
    -

    Returns

    -

    Modified dict

    +

    Returns +-----= +Modified dict

    def get_user_agent(prefix: str | None = None, suffix: str | None = None) @@ -108,8 +110,9 @@

    Returns

    Construct the user-agent header with the package info, Python version and OS version.

    -

    Returns

    -

    The user agent string. +

    Returns +-----= +The user agent string. e.g. 'Python/3.7.17 slackclient/2.0.0 Darwin/17.7.0'

    diff --git a/docs/reference/web/legacy_base_client.html b/docs/reference/web/legacy_base_client.html index 2abe94377..8cfd35e7e 100644 --- a/docs/reference/web/legacy_base_client.html +++ b/docs/reference/web/legacy_base_client.html @@ -662,8 +662,9 @@

    Static methods

    header. The signature is created by combining the signing secret with the body of the request we're sending using a standard HMAC-SHA256 keyed hash. https://docs.slack.dev/authentication/verifying-requests-from-slack/#how_to_make_a_request_signature_in_4_easy_steps__an_overview

    -

    Args

    +
    Args
    +
    -----=
    signing_secret
    Your application's signing secret, available in the Slack API dashboard
    @@ -675,8 +676,9 @@

    Args

    from the 'X-Slack-Signature' header - the calculated signature should match this.
    -

    Returns

    -

    True if signatures matches

    +

    Returns +-----= +True if signatures matches

    Instance variables

    @@ -811,8 +813,9 @@

    Methods

    return self._sync_send(api_url=api_url, req_args=req_args)

    Create a request and execute the API call to Slack.

    -

    Args

    +
    Args
    +
    -----=
    api_method : str
    The target Slack API method. e.g. 'chat.postMessage'
    @@ -837,14 +840,16 @@

    Args

    auth : dict
    A dictionary that consists of client_id and client_secret
    -

    Returns

    -

    (SlackResponse) +

    Returns +-----= +(SlackResponse) The server's response to an HTTP request. Data from the response can be accessed like a dict. If the response included 'next_cursor' it can be iterated on to execute subsequent requests.

    -

    Raises

    +
    Raises
    +
    -----=
    SlackApiError
    The following Slack API call failed: 'chat.postMessage'.
    diff --git a/docs/reference/web/legacy_client.html b/docs/reference/web/legacy_client.html index 411ed28d2..5d3c4d165 100644 --- a/docs/reference/web/legacy_client.html +++ b/docs/reference/web/legacy_client.html @@ -1952,6 +1952,58 @@

    Classes

    kwargs.update({"workflow_ids": workflow_ids}) return self.api_call("admin.workflows.unpublish", params=kwargs) + def agents_sessions_rename( + self, + *, + channel_id: str, + title: str, + thread_ts: Optional[str] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Rename an agent session. + https://docs.slack.dev/reference/methods/agents.sessions.rename + """ + kwargs.update( + { + "channel_id": channel_id, + "title": title, + "thread_ts": thread_ts, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.rename", json=kwargs) + + def agents_sessions_setStatus( + self, + *, + channel_id: str, + status: str, + thread_ts: Optional[str] = None, + title: Optional[str] = None, + initiator_user_id: Optional[str] = None, + icon_emoji: Optional[str] = None, + icon_url: Optional[str] = None, + username: Optional[str] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Set an agent session's lifecycle status, creating the session if needed. + https://docs.slack.dev/reference/methods/agents.sessions.setStatus + """ + kwargs.update( + { + "channel_id": channel_id, + "status": status, + "thread_ts": thread_ts, + "title": title, + "initiator_user_id": initiator_user_id, + "icon_emoji": icon_emoji, + "icon_url": icon_url, + "username": username, + } + ) + kwargs = _remove_none_values(kwargs) + return self.api_call("agents.sessions.setStatus", json=kwargs) + def api_test( self, *, @@ -2199,6 +2251,32 @@

    Classes

    kwargs.update({"cursor": cursor, "limit": limit, "include_icon": include_icon}) return self.api_call("auth.teams.list", params=kwargs) + def blocks_validate( + self, + *, + blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, + message: Optional[Union[str, Dict]] = None, + view: Optional[Union[str, Dict, View]] = None, + **kwargs, + ) -> Union[Future, SlackResponse]: + """Validates an array of blocks, or a message or view payload. + Provide exactly one of ``blocks``, ``message``, or ``view``. + https://docs.slack.dev/reference/methods/blocks.validate + """ + if blocks is not None: + if isinstance(blocks, str): + kwargs.update({"blocks": blocks}) + else: + kwargs.update({"blocks": json.dumps([b.to_dict() if isinstance(b, Block) else b for b in blocks])}) + if message is not None: + kwargs.update({"message": message if isinstance(message, str) else json.dumps(message)}) + if view is not None: + if isinstance(view, View): + kwargs.update({"view": json.dumps(view.to_dict())}) + else: + kwargs.update({"view": view if isinstance(view, str) else json.dumps(view)}) + return self.api_call("blocks.validate", params=kwargs) + def bookmarks_add( self, *, @@ -2970,6 +3048,7 @@

    Classes

    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Stops a streaming conversation. @@ -2983,6 +3062,7 @@

    Classes

    "blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) @@ -5963,8 +6043,9 @@

    Classes

    and enacting change in a Slack workspace.

    This client handles constructing and sending HTTP requests to Slack as well as parsing any responses received into a SlackResponse.

    -

    Attributes

    +
    Attributes
    +
    -----=
    token : str
    A string specifying an xoxp-* or xoxb-* token.
    base_url : str
    @@ -5986,8 +6067,9 @@

    Attributes

    headers : dict
    Additional request headers to attach to all requests.
    -

    Methods

    -

    api_call: Constructs a request and executes the API call to Slack.

    +

    Methods +-----= +api_call: Constructs a request and executes the API call to Slack.

    Example of recommended usage:

        import os
         from slack_sdk.web.legacy_client import LegacyWebClient
    @@ -6011,8 +6093,9 @@ 

    Methods

    assert response["ok"] assert response["message"]["text"] == "Hello world!"
    -

    Note

    -

    Any attributes or methods prefixed with _underscores are +

    Note +-----= +Any attributes or methods prefixed with _underscores are intended to be "private" internal use only. They may be changed or removed at anytime.

    Ancestors

    @@ -8946,6 +9029,80 @@

    Methods

    Unpublish workflows within the team or enterprise https://docs.slack.dev/reference/methods/admin.workflows.unpublish

    +
    +def agents_sessions_rename(self, *, channel_id: str, title: str, thread_ts: str | None = None, **kwargs) ‑> _asyncio.Future | LegacySlackResponse +
    +
    +
    + +Expand source code + +
    def agents_sessions_rename(
    +    self,
    +    *,
    +    channel_id: str,
    +    title: str,
    +    thread_ts: Optional[str] = None,
    +    **kwargs,
    +) -> Union[Future, SlackResponse]:
    +    """Rename an agent session.
    +    https://docs.slack.dev/reference/methods/agents.sessions.rename
    +    """
    +    kwargs.update(
    +        {
    +            "channel_id": channel_id,
    +            "title": title,
    +            "thread_ts": thread_ts,
    +        }
    +    )
    +    kwargs = _remove_none_values(kwargs)
    +    return self.api_call("agents.sessions.rename", json=kwargs)
    +
    + +
    +
    +def agents_sessions_setStatus(self,
    *,
    channel_id: str,
    status: str,
    thread_ts: str | None = None,
    title: str | None = None,
    initiator_user_id: str | None = None,
    icon_emoji: str | None = None,
    icon_url: str | None = None,
    username: str | None = None,
    **kwargs) ‑> _asyncio.Future | LegacySlackResponse
    +
    +
    +
    + +Expand source code + +
    def agents_sessions_setStatus(
    +    self,
    +    *,
    +    channel_id: str,
    +    status: str,
    +    thread_ts: Optional[str] = None,
    +    title: Optional[str] = None,
    +    initiator_user_id: Optional[str] = None,
    +    icon_emoji: Optional[str] = None,
    +    icon_url: Optional[str] = None,
    +    username: Optional[str] = None,
    +    **kwargs,
    +) -> Union[Future, SlackResponse]:
    +    """Set an agent session's lifecycle status, creating the session if needed.
    +    https://docs.slack.dev/reference/methods/agents.sessions.setStatus
    +    """
    +    kwargs.update(
    +        {
    +            "channel_id": channel_id,
    +            "status": status,
    +            "thread_ts": thread_ts,
    +            "title": title,
    +            "initiator_user_id": initiator_user_id,
    +            "icon_emoji": icon_emoji,
    +            "icon_url": icon_url,
    +            "username": username,
    +        }
    +    )
    +    kwargs = _remove_none_values(kwargs)
    +    return self.api_call("agents.sessions.setStatus", json=kwargs)
    +
    +

    Set an agent session's lifecycle status, creating the session if needed. +https://docs.slack.dev/reference/methods/agents.sessions.setStatus

    +
    def api_test(self, *, error: str | None = None, **kwargs) ‑> _asyncio.Future | LegacySlackResponse
    @@ -9359,6 +9516,44 @@

    Methods

    Checks authentication & identity. https://docs.slack.dev/reference/methods/auth.test

    +
    +def blocks_validate(self,
    *,
    blocks: str | Sequence[Dict | Block] | None = None,
    message: str | Dict | None = None,
    view: str | Dict | View | None = None,
    **kwargs) ‑> _asyncio.Future | LegacySlackResponse
    +
    +
    +
    + +Expand source code + +
    def blocks_validate(
    +    self,
    +    *,
    +    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None,
    +    message: Optional[Union[str, Dict]] = None,
    +    view: Optional[Union[str, Dict, View]] = None,
    +    **kwargs,
    +) -> Union[Future, SlackResponse]:
    +    """Validates an array of blocks, or a message or view payload.
    +    Provide exactly one of ``blocks``, ``message``, or ``view``.
    +    https://docs.slack.dev/reference/methods/blocks.validate
    +    """
    +    if blocks is not None:
    +        if isinstance(blocks, str):
    +            kwargs.update({"blocks": blocks})
    +        else:
    +            kwargs.update({"blocks": json.dumps([b.to_dict() if isinstance(b, Block) else b for b in blocks])})
    +    if message is not None:
    +        kwargs.update({"message": message if isinstance(message, str) else json.dumps(message)})
    +    if view is not None:
    +        if isinstance(view, View):
    +            kwargs.update({"view": json.dumps(view.to_dict())})
    +        else:
    +            kwargs.update({"view": view if isinstance(view, str) else json.dumps(view)})
    +    return self.api_call("blocks.validate", params=kwargs)
    +
    +

    Validates an array of blocks, or a message or view payload. +Provide exactly one of blocks, message, or view. +https://docs.slack.dev/reference/methods/blocks.validate

    +
    def bookmarks_add(self,
    *,
    channel_id: str,
    title: str,
    type: str,
    emoji: str | None = None,
    entity_id: str | None = None,
    link: str | None = None,
    parent_id: str | None = None,
    **kwargs) ‑> _asyncio.Future | LegacySlackResponse
    @@ -10561,7 +10756,7 @@

    Methods

    https://docs.slack.dev/reference/methods/chat.startStream

    -def chat_stopStream(self,
    *,
    channel: str,
    ts: str,
    markdown_text: str | None = None,
    blocks: str | Sequence[Dict | Block] | None = None,
    metadata: Dict | Metadata | None = None,
    chunks: Sequence[Dict | Chunk] | None = None,
    **kwargs) ‑> _asyncio.Future | LegacySlackResponse
    +def chat_stopStream(self,
    *,
    channel: str,
    ts: str,
    markdown_text: str | None = None,
    blocks: str | Sequence[Dict | Block] | None = None,
    metadata: Dict | Metadata | None = None,
    chunks: Sequence[Dict | Chunk] | None = None,
    session_status: str | None = None,
    **kwargs) ‑> _asyncio.Future | LegacySlackResponse
    @@ -10577,6 +10772,7 @@

    Methods

    blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None, metadata: Optional[Union[Dict, Metadata]] = None, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, + session_status: Optional[str] = None, **kwargs, ) -> Union[Future, SlackResponse]: """Stops a streaming conversation. @@ -10590,6 +10786,7 @@

    Methods

    "blocks": blocks, "metadata": metadata, "chunks": chunks, + "session_status": session_status, } ) _parse_web_class_objects(kwargs) @@ -15470,6 +15667,8 @@

    admin_workflows_permissions_lookup
  • admin_workflows_search
  • admin_workflows_unpublish
  • +
  • agents_sessions_rename
  • +
  • agents_sessions_setStatus
  • api_test
  • apps_connections_open
  • apps_event_authorizations_list
  • @@ -15486,6 +15685,7 @@

    auth_revoke
  • auth_teams_list
  • auth_test
  • +
  • blocks_validate
  • bookmarks_add
  • bookmarks_edit
  • bookmarks_list
  • diff --git a/docs/reference/web/legacy_slack_response.html b/docs/reference/web/legacy_slack_response.html index c0531066d..ebb222904 100644 --- a/docs/reference/web/legacy_slack_response.html +++ b/docs/reference/web/legacy_slack_response.html @@ -266,14 +266,16 @@

    Classes

    return present

    An iterable container of response data.

    -

    Attributes

    +
    Attributes
    +
    -----=
    data : dict
    The json-encoded content of the response. Along with the headers and status code information.
    -

    Methods

    -

    validate: Check if the response from Slack was successful. +

    Methods +-----= +validate: Check if the response from Slack was successful. get: Retrieves any key from the response data. next: Retrieves the next portion of results, if 'next_cursor' is present.

    @@ -294,8 +296,9 @@

    Methods

    TODO: This example should specify when to break. users = users + page['members']
    -

    Note

    -

    Some responses return collections of information +

    Note +-----= +Some responses return collections of information like channel and user lists. If they do it's likely that you'll only receive a portion of results. This object allows you to iterate over the response which @@ -330,12 +333,14 @@

    Methods

    return self.data.get(key, default)

    Retrieves any key from the response data.

    -

    Note

    -

    This is implemented so users can reference the +

    Note +-----= +This is implemented so users can reference the SlackResponse object like a dictionary. e.g. response.get("ok", False)

    -

    Returns

    -

    The value from data or the specified default.

    +

    Returns +-----= +The value from data or the specified default.

    def validate(self) @@ -369,11 +374,13 @@

    Returns

    raise e.SlackApiError(message=msg, response=self)

    Check if the response from Slack was successful.

    -

    Returns

    -

    (SlackResponse) +

    Returns +-----= +(SlackResponse) This method returns it's own object. e.g. 'self'

    -

    Raises

    +
    Raises
    +
    -----=
    SlackApiError
    The request to the Slack API failed.
    diff --git a/docs/reference/web/slack_response.html b/docs/reference/web/slack_response.html index d6905106e..ba05b1c00 100644 --- a/docs/reference/web/slack_response.html +++ b/docs/reference/web/slack_response.html @@ -242,14 +242,16 @@

    Classes

    raise e.SlackApiError(message=msg, response=self)

    An iterable container of response data.

    -

    Attributes

    +
    Attributes
    +
    -----=
    data : dict
    The json-encoded content of the response. Along with the headers and status code information.
    -

    Methods

    -

    validate: Check if the response from Slack was successful. +

    Methods +-----= +validate: Check if the response from Slack was successful. get: Retrieves any key from the response data. next: Retrieves the next portion of results, if 'next_cursor' is present.

    @@ -269,8 +271,9 @@

    Methods

    for page in client.users_list(limit=2): users = users + page['members'] -

    Note

    -

    Some responses return collections of information +

    Note +-----= +Some responses return collections of information like channel and user lists. If they do it's likely that you'll only receive a portion of results. This object allows you to iterate over the response which @@ -307,12 +310,14 @@

    Methods

    return self.data.get(key, default)

    Retrieves any key from the response data.

    -

    Note

    -

    This is implemented so users can reference the +

    Note +-----= +This is implemented so users can reference the SlackResponse object like a dictionary. e.g. response.get("ok", False)

    -

    Returns

    -

    The value from data or the specified default.

    +

    Returns +-----= +The value from data or the specified default.

    def validate(self) @@ -338,11 +343,13 @@

    Returns

    raise e.SlackApiError(message=msg, response=self)

    Check if the response from Slack was successful.

    -

    Returns

    -

    (SlackResponse) +

    Returns +-----= +(SlackResponse) This method returns it's own object. e.g. 'self'

    -

    Raises

    +
    Raises
    +
    -----=
    SlackApiError
    The request to the Slack API failed.
    diff --git a/docs/reference/webhook/async_client.html b/docs/reference/webhook/async_client.html index 15c7e4a45..c5c01c799 100644 --- a/docs/reference/webhook/async_client.html +++ b/docs/reference/webhook/async_client.html @@ -303,8 +303,9 @@

    Classes

    API client for Incoming Webhooks and response_url

    https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks/

    -

    Args

    +
    Args
    +
    -----=
    url
    Complete URL to send data (e.g., https://hooks.slack.com/XXX)
    timeout
    @@ -430,8 +431,9 @@

    Methods

    )

    Performs a Slack API request and returns the result.

    -

    Args

    +
    Args
    +
    -----=
    text
    The text message (even when having blocks, setting this as well is recommended as it works as fallback)
    attachments
    @@ -453,8 +455,9 @@

    Args

    headers
    Request headers to append only for this request
    -

    Returns

    -

    Webhook response

    +

    Returns +-----= +Webhook response

    async def send_dict(self, body: Dict[str, Any], headers: Dict[str, str] | None = None) ‑> WebhookResponse @@ -480,16 +483,18 @@

    Returns

    )

    Performs a Slack API request and returns the result.

    -

    Args

    +
    Args
    +
    -----=
    body
    JSON data structure (it's still a dict at this point), if you give this argument, body_params and files will be skipped
    headers
    Request headers to append only for this request
    -

    Returns

    -

    Webhook response

    +

    Returns +-----= +Webhook response

    diff --git a/docs/reference/webhook/client.html b/docs/reference/webhook/client.html index aebec5a3f..bbf549d90 100644 --- a/docs/reference/webhook/client.html +++ b/docs/reference/webhook/client.html @@ -310,8 +310,9 @@

    Classes

    API client for Incoming Webhooks and response_url

    https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks/

    -

    Args

    +
    Args
    +
    -----=
    url
    Complete URL to send data (e.g., https://hooks.slack.com/XXX)
    timeout
    @@ -422,8 +423,9 @@

    Methods

    )

    Performs a Slack API request and returns the result.

    -

    Args

    +
    Args
    +
    -----=
    text
    The text message (even when having blocks, setting this as well is recommended as it works as fallback)
    @@ -446,8 +448,9 @@

    Args

    headers
    Request headers to append only for this request
    -

    Returns

    -

    Webhook response

    +

    Returns +-----= +Webhook response

    def send_dict(self, body: Dict[str, Any], headers: Dict[str, str] | None = None) ‑> WebhookResponse @@ -473,16 +476,18 @@

    Returns

    )

    Performs a Slack API request and returns the result.

    -

    Args

    +
    Args
    +
    -----=
    body
    JSON data structure (it's still a dict at this point), if you give this argument, body_params and files will be skipped
    headers
    Request headers to append only for this request
    -

    Returns

    -

    Webhook response

    +

    Returns +-----= +Webhook response

    diff --git a/docs/reference/webhook/index.html b/docs/reference/webhook/index.html index 51c387ef4..2fd6daa97 100644 --- a/docs/reference/webhook/index.html +++ b/docs/reference/webhook/index.html @@ -332,8 +332,9 @@

    Classes

    API client for Incoming Webhooks and response_url

    https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks/

    -

    Args

    +
    Args
    +
    -----=
    url
    Complete URL to send data (e.g., https://hooks.slack.com/XXX)
    timeout
    @@ -444,8 +445,9 @@

    Methods

    )

    Performs a Slack API request and returns the result.

    -

    Args

    +
    Args
    +
    -----=
    text
    The text message (even when having blocks, setting this as well is recommended as it works as fallback)
    @@ -468,8 +470,9 @@

    Args

    headers
    Request headers to append only for this request
    -

    Returns

    -

    Webhook response

    +

    Returns +-----= +Webhook response

    def send_dict(self, body: Dict[str, Any], headers: Dict[str, str] | None = None) ‑> WebhookResponse @@ -495,16 +498,18 @@

    Returns

    )

    Performs a Slack API request and returns the result.

    -

    Args

    +
    Args
    +
    -----=
    body
    JSON data structure (it's still a dict at this point), if you give this argument, body_params and files will be skipped
    headers
    Request headers to append only for this request
    -

    Returns

    -

    Webhook response

    +

    Returns +-----= +Webhook response

    diff --git a/slack_sdk/version.py b/slack_sdk/version.py index 1e1b54a58..ed69eec06 100644 --- a/slack_sdk/version.py +++ b/slack_sdk/version.py @@ -1,3 +1,3 @@ """Check the latest version at https://pypi.org/project/slack-sdk/""" -__version__ = "3.43.0" +__version__ = "3.44.0"