From da22bdc0351637c8da7b121167208882fd97ebaa Mon Sep 17 00:00:00 2001
From: Eden Zimbelman Classes
thread_ts: str,
status: str,
loading_messages: Optional[List[str]] = None,
+ icon_emoji: Optional[str] = None,
+ icon_url: Optional[str] = None,
+ username: Optional[str] = None,
**kwargs,
) -> SlackResponse:
"""Set the status for an AI assistant thread.
https://docs.slack.dev/reference/methods/assistant.threads.setStatus
"""
kwargs.update(
- {"channel_id": channel_id, "thread_ts": thread_ts, "status": status, "loading_messages": loading_messages}
+ {
+ "channel_id": channel_id,
+ "thread_ts": thread_ts,
+ "status": status,
+ "loading_messages": loading_messages,
+ "icon_emoji": icon_emoji,
+ "icon_url": icon_url,
+ "username": username,
+ }
)
kwargs = _remove_none_values(kwargs)
return self.api_call("assistant.threads.setStatus", json=kwargs)
@@ -3027,6 +3038,9 @@ Classes
recipient_user_id: Optional[str] = None,
chunks: Optional[Sequence[Union[Dict, Chunk]]] = None,
task_display_mode: Optional[str] = None, # timeline, plan
+ icon_emoji: Optional[str] = None,
+ icon_url: Optional[str] = None,
+ username: Optional[str] = None,
**kwargs,
) -> SlackResponse:
"""Starts a new streaming conversation.
@@ -3041,6 +3055,9 @@ Classes
"recipient_user_id": recipient_user_id,
"chunks": chunks,
"task_display_mode": task_display_mode,
+ "icon_emoji": icon_emoji,
+ "icon_url": icon_url,
+ "username": username,
}
)
_parse_web_class_objects(kwargs)
@@ -3084,6 +3101,9 @@ Classes
recipient_team_id: Optional[str] = None,
recipient_user_id: Optional[str] = None,
task_display_mode: Optional[str] = None,
+ icon_emoji: Optional[str] = None,
+ icon_url: Optional[str] = None,
+ username: Optional[str] = None,
**kwargs,
) -> ChatStream:
"""Stream markdown text into a conversation.
@@ -3112,6 +3132,9 @@ Classes
recipient_user_id: The encoded ID of the user to receive the streaming text. Required when streaming to channels.
task_display_mode: Specifies how tasks are displayed in the message. A "timeline" displays individual tasks
with text and "plan" displays all tasks together.
+ icon_emoji: Emoji to use as the icon for this message. Overrides icon_url.
+ icon_url: Image URL to use as the icon for this message.
+ username: The bot's username to display.
**kwargs: Additional arguments passed to the underlying API calls.
Returns:
@@ -3138,6 +3161,9 @@ Classes
recipient_team_id=recipient_team_id,
recipient_user_id=recipient_user_id,
task_display_mode=task_display_mode,
+ icon_emoji=icon_emoji,
+ icon_url=icon_url,
+ username=username,
buffer_size=buffer_size,
**kwargs,
)
@@ -4134,6 +4160,7 @@ Classes
content: Optional[Union[str, bytes]] = None,
title: Optional[str] = None,
alt_txt: Optional[str] = None,
+ highlight_type: Optional[str] = None,
snippet_type: Optional[str] = None,
# To upload multiple files at a time
file_uploads: Optional[List[Dict[str, Any]]] = None,
@@ -4178,6 +4205,7 @@ Classes
"content": content,
"title": title,
"alt_txt": alt_txt,
+ "highlight_type": highlight_type,
"snippet_type": snippet_type,
}
)
@@ -4216,7 +4244,7 @@ Classes
# step3: files.completeUploadExternal with all the sets of (file_id + title)
completion = self.files_completeUploadExternal(
- files=[{"id": f["file_id"], "title": f["title"]} for f in files],
+ files=[{"id": f["file_id"], "title": f["title"], "highlight_type": f.get("highlight_type")} for f in files],
channel_id=channel,
channels=channels,
initial_comment=initial_comment,
@@ -4252,7 +4280,7 @@ Classes
def files_completeUploadExternal(
self,
*,
- files: List[Dict[str, str]],
+ files: List[Dict[str, Optional[str]]],
channel_id: Optional[str] = None,
channels: Optional[List[str]] = None,
initial_comment: Optional[str] = None,
@@ -9349,7 +9377,7 @@ Methods
https://docs.slack.dev/reference/methods/apps.user.connection.update
-def assistant_threads_setStatus(self,
*,
channel_id: str,
thread_ts: str,
status: str,
loading_messages: List[str] | None = None,
**kwargs) ‑> SlackResponse
+def assistant_threads_setStatus(self,
*,
channel_id: str,
thread_ts: str,
status: str,
loading_messages: List[str] | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> SlackResponse
-def chat_startStream(self,
*,
channel: str,
thread_ts: str,
markdown_text: str | None = None,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
task_display_mode: str | None = None,
**kwargs) ‑> SlackResponse
+def chat_startStream(self,
*,
channel: str,
thread_ts: str,
markdown_text: str | None = None,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> SlackResponse
-def chat_stream(self,
*,
buffer_size: int = 256,
channel: str,
thread_ts: str,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
**kwargs) ‑> ChatStream
+def chat_stream(self,
*,
buffer_size: int = 256,
channel: str,
thread_ts: str,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> ChatStream
task_display_modeicon_emojiicon_urlusername**kwargs
-def files_completeUploadExternal(self,
*,
files: List[Dict[str, str]],
channel_id: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
**kwargs) ‑> SlackResponse
+def files_completeUploadExternal(self,
*,
files: List[Dict[str, str | None]],
channel_id: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
**kwargs) ‑> SlackResponse
def files_completeUploadExternal(
self,
*,
- files: List[Dict[str, str]],
+ files: List[Dict[str, Optional[str]]],
channel_id: Optional[str] = None,
channels: Optional[List[str]] = None,
initial_comment: Optional[str] = None,
@@ -12470,7 +12530,7 @@ Example
https://docs.slack.dev/reference/methods/files.upload
-def files_upload_v2(self,
*,
filename: str | None = None,
file: str | bytes | io.IOBase | os.PathLike | None = None,
content: str | bytes | None = None,
title: str | None = None,
alt_txt: str | None = None,
snippet_type: str | None = None,
file_uploads: List[Dict[str, Any]] | None = None,
channel: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
request_file_info: bool = True,
**kwargs) ‑> SlackResponse
+def files_upload_v2(self,
*,
filename: str | None = None,
file: str | bytes | io.IOBase | os.PathLike | None = None,
content: str | bytes | None = None,
title: str | None = None,
alt_txt: str | None = None,
highlight_type: str | None = None,
snippet_type: str | None = None,
file_uploads: List[Dict[str, Any]] | None = None,
channel: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
request_file_info: bool = True,
**kwargs) ‑> SlackResponse
-def parse(confirm: ConfirmObject | Dict[str, Any])
+def parse(confirm: ForwardRef('ConfirmObject') | Dict[str, Any])
-def parse(config: DispatchActionConfig | Dict[str, Any])
+def parse(config: ForwardRef('DispatchActionConfig') | Dict[str, Any])
-def parse(feedback_button: FeedbackButtonObject | Dict[str, Any])
+def parse(feedback_button: ForwardRef('FeedbackButtonObject') | Dict[str, Any])
Creates a simple Option instance with the same value and label
-def parse_all(options: Sequence[Dict[str, Any] | Option] | None) ‑> List[Option] | None
+def parse_all(options: Sequence[Dict[str, Any] | ForwardRef('Option')] | None) ‑> List[Option] | None
-def parse_all(option_groups: Sequence[Dict[str, Any] | OptionGroup] | None) ‑> List[OptionGroup] | None
+def parse_all(option_groups: Sequence[Dict[str, Any] | ForwardRef('OptionGroup')] | None) ‑> List[OptionGroup] | None
-def parse(text: str | Dict[str, Any] | TextObject,
default_type: str = 'mrkdwn') ‑> TextObject | None
+def parse(text: str | Dict[str, Any] | ForwardRef('TextObject'),
default_type: str = 'mrkdwn') ‑> TextObject | None
-def parse(block_element: dict | BlockElement) ‑> BlockElement | TextObject | None
+def parse(block_element: dict | ForwardRef('BlockElement')) ‑> BlockElement | TextObject | None
-def parse_all(block_elements: Sequence[dict | BlockElement | TextObject]) ‑> List[BlockElement | TextObject]
+def parse_all(block_elements: Sequence[dict | ForwardRef('BlockElement') | TextObject]) ‑> List[BlockElement | TextObject]
-def parse(filter: dict | ConversationFilter)
+def parse(filter: dict | ForwardRef('ConversationFilter'))
class RichTextInputElement
-(*,
action_id: str | None = None,
placeholder: str | dict | TextObject | None = None,
initial_value: Dict[str, Any] | RichTextBlock | None = None,
dispatch_action_config: dict | DispatchActionConfig | None = None,
focus_on_load: bool | None = None,
**others: dict)
+(*,
action_id: str | None = None,
placeholder: str | dict | TextObject | None = None,
initial_value: Dict[str, Any] | ForwardRef('RichTextBlock') | None = None,
dispatch_action_config: dict | DispatchActionConfig | None = None,
focus_on_load: bool | None = None,
**others: dict)
+class AlertBlock
+(*,
text: str | dict | TextObject,
level: str | None = None,
block_id: str | None = None,
**others: dict)
+class AlertBlock(Block):
+ type = "alert"
+ valid_levels = {"default", "info", "warning", "error", "success"}
+
+ @property
+ def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union({"text", "level"})
+
+ def __init__(
+ self,
+ *,
+ text: Union[str, dict, TextObject],
+ level: Optional[str] = None,
+ block_id: Optional[str] = None,
+ **others: dict,
+ ):
+ """Displays alerts, warnings, and informational messages.
+ https://docs.slack.dev/reference/block-kit/blocks/alert-block
+
+ Args:
+ text (required): The alert message, using plain_text or mrkdwn formatting.
+ level: One of "default", "info", "warning", "error", or "success".
+ Will be "default" if omitted.
+ block_id: A unique identifier for a block. If not specified, a block_id will be generated.
+ """
+ super().__init__(type=self.type, block_id=block_id)
+ show_unknown_key_warning(self, others)
+
+ self.text = TextObject.parse(text)
+ self.level = level
+
+ @JsonValidator("text attribute must be specified")
+ def _validate_text(self):
+ return self.text is not None
+
+ @JsonValidator("level must be a valid value (default, info, warning, error, success)")
+ def _validate_level(self):
+ return self.level is None or self.level in self.valid_levels
+Blocks are a series of components that can be combined +to create visually rich and compellingly interactive messages. +https://docs.slack.dev/reference/block-kit/blocks
+Displays alerts, warnings, and informational messages. +https://docs.slack.dev/reference/block-kit/blocks/alert-block
+text : requiredlevelblock_idvar typeThe type of the None singleton.
var valid_levelsThe type of the None singleton.
prop attributes : Set[str]@property
+def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union({"text", "level"})
+Build an unordered collection of unique elements.
Block:
+
+
class Block
(*,
type: str | None = None,
subtype: str | None = None,
block_id: str | None = None)
@@ -242,6 +350,12 @@ Inherited members
return TaskCardBlock(**block)
elif type == PlanBlock.type:
return PlanBlock(**block)
+ elif type == CardBlock.type:
+ return CardBlock(**block)
+ elif type == AlertBlock.type:
+ return AlertBlock(**block)
+ elif type == CarouselBlock.type:
+ return CarouselBlock(**block)
else:
cls.logger.warning(f"Unknown block detected and skipped ({block})")
return None
@@ -264,7 +378,10 @@ Ancestors
Subclasses
- ActionsBlock
+- AlertBlock
- CallBlock
+- CardBlock
+- CarouselBlock
- ContextActionsBlock
- ContextBlock
- DividerBlock
@@ -298,13 +415,13 @@ Class variables
Static methods
-def parse(block: dict | Block) ‑> Block | None
+def parse(block: dict | ForwardRef('Block')) ‑> Block | None
-
-def parse_all(blocks: Sequence[dict | Block] | None) ‑> List[Block]
+def parse_all(blocks: Sequence[dict | ForwardRef('Block')] | None) ‑> List[Block]
-
@@ -417,6 +534,269 @@
Inherited members
+class CardBlock
+(*,
block_id: str | None = None,
hero_image: str | None = None,
icon: str | None = None,
title: str | dict | TextObject | None = None,
subtitle: str | dict | TextObject | None = None,
body: str | dict | TextObject | None = None,
actions: Sequence[dict | BlockElement] | None = None,
**others: dict)
+class CardBlock(Block):
+ type = "card"
+ title_max_length = 150
+ subtitle_max_length = 150
+ body_max_length = 200
+
+ @property
+ def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union(
+ {
+ "hero_image",
+ "icon",
+ "title",
+ "subtitle",
+ "body",
+ "actions",
+ }
+ )
+
+ def __init__(
+ self,
+ *,
+ block_id: Optional[str] = None,
+ hero_image: Optional[str] = None,
+ icon: Optional[str] = None,
+ title: Optional[Union[str, dict, TextObject]] = None,
+ subtitle: Optional[Union[str, dict, TextObject]] = None,
+ body: Optional[Union[str, dict, TextObject]] = None,
+ actions: Optional[Sequence[Union[dict, BlockElement]]] = None,
+ **others: dict,
+ ):
+ """Displays content in a card.
+ https://docs.slack.dev/reference/block-kit/blocks/card-block
+
+ Args:
+ block_id: A unique identifier for a block. If not specified, a block_id will be generated.
+ hero_image: Link to the top image used on the card.
+ icon: Link to the small image used next to the card's title and subtitle.
+ title: Title of the card. 150 characters max.
+ subtitle: Subtitle of the card. 150 characters max.
+ body: Content of the card. 200 characters max.
+ actions: Action buttons shown at the bottom of the card.
+ """
+ super().__init__(type=self.type, block_id=block_id)
+ show_unknown_key_warning(self, others)
+
+ self.hero_image = hero_image
+ self.icon = icon
+ self.title = TextObject.parse(title, default_type=MarkdownTextObject.type) # type: ignore[arg-type]
+ self.subtitle = TextObject.parse(subtitle, default_type=MarkdownTextObject.type) # type: ignore[arg-type]
+ self.body = TextObject.parse(body, default_type=MarkdownTextObject.type) # type: ignore[arg-type]
+ self.actions = BlockElement.parse_all(actions) if actions else None
+
+ @JsonValidator("At least one of hero_image, title, actions, or body is required")
+ def _validate_content(self):
+ return self.hero_image is not None or self.title is not None or self.actions is not None or self.body is not None
+
+ @JsonValidator(f"title attribute cannot exceed {title_max_length} characters")
+ def _validate_title_length(self):
+ return self.title is None or self.title.text is None or len(self.title.text) <= self.title_max_length
+
+ @JsonValidator(f"subtitle attribute cannot exceed {subtitle_max_length} characters")
+ def _validate_subtitle_length(self):
+ return self.subtitle is None or self.subtitle.text is None or len(self.subtitle.text) <= self.subtitle_max_length
+
+ @JsonValidator(f"body attribute cannot exceed {body_max_length} characters")
+ def _validate_body_length(self):
+ return self.body is None or self.body.text is None or len(self.body.text) <= self.body_max_length
+Blocks are a series of components that can be combined +to create visually rich and compellingly interactive messages. +https://docs.slack.dev/reference/block-kit/blocks
+Displays content in a card. +https://docs.slack.dev/reference/block-kit/blocks/card-block
+block_idhero_imageicontitlesubtitlebodyactionsvar body_max_lengthThe type of the None singleton.
var subtitle_max_lengthThe type of the None singleton.
var title_max_lengthThe type of the None singleton.
var typeThe type of the None singleton.
prop attributes : Set[str]@property
+def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union(
+ {
+ "hero_image",
+ "icon",
+ "title",
+ "subtitle",
+ "body",
+ "actions",
+ }
+ )
+Build an unordered collection of unique elements.
Block:
+
+
+class CarouselBlock
+(*,
elements: Sequence[dict | CardBlock],
block_id: str | None = None,
**others: dict)
+class CarouselBlock(Block):
+ type = "carousel"
+ elements_max_length = 10
+
+ @property
+ def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union({"elements"})
+
+ def __init__(
+ self,
+ *,
+ elements: Sequence[Union[dict, CardBlock]],
+ block_id: Optional[str] = None,
+ **others: dict,
+ ):
+ """Displays related card blocks in a horizontally-scrolling container.
+ https://docs.slack.dev/reference/block-kit/blocks/carousel-block
+
+ Args:
+ elements (required): A list of cards. Minimum 1, maximum 10 cards.
+ block_id: A unique identifier for a block. If not specified, a block_id will be generated.
+ """
+ super().__init__(type=self.type, block_id=block_id)
+ show_unknown_key_warning(self, others)
+
+ self.elements = Block.parse_all(elements)
+
+ @JsonValidator("elements attribute must contain at least 1 card")
+ def _validate_elements_present(self):
+ return self.elements is not None and len(self.elements) >= 1
+
+ @JsonValidator(f"elements attribute cannot exceed {elements_max_length} cards")
+ def _validate_elements_length(self):
+ return self.elements is None or len(self.elements) <= self.elements_max_length
+Blocks are a series of components that can be combined +to create visually rich and compellingly interactive messages. +https://docs.slack.dev/reference/block-kit/blocks
+Displays related card blocks in a horizontally-scrolling container. +https://docs.slack.dev/reference/block-kit/blocks/carousel-block
+elements : requiredblock_idvar elements_max_lengthThe type of the None singleton.
var typeThe type of the None singleton.
prop attributes : Set[str]@property
+def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union({"elements"})
+Build an unordered collection of unique elements.
Block:
+
+
class ContextActionsBlock
(*,
elements: Sequence[dict | FeedbackButtonsElement | IconButtonElement],
block_id: str | None = None,
**others: dict)
@@ -1601,7 +1981,7 @@ Inherited members
else:
field_objects.append(PlainTextObject(**d)) # type: ignore[arg-type]
else:
- self.logger.warning(f"Unsupported field detected and skipped {f}")
+ self.logger.warning(f"Unsupported field detected and skipped: {f}")
self.fields = field_objects
self.accessory = BlockElement.parse(accessory) # type: ignore[arg-type]
self.expand = expand
@@ -2182,6 +2562,14 @@ AlertBlock
+
+attributes
+type
+valid_levels
+
+
+-
Block
attributes
@@ -2200,6 +2588,24 @@ CardBlock
+
+
+-
+
CarouselBlock
+
+
+-
ContextActionsBlock
attributes
diff --git a/docs/reference/models/blocks/index.html b/docs/reference/models/blocks/index.html
index 11d4d8af0..90d5e0d41 100644
--- a/docs/reference/models/blocks/index.html
+++ b/docs/reference/models/blocks/index.html
@@ -177,6 +177,114 @@ Inherited members
+class AlertBlock
+(*,
text: str | dict | TextObject,
level: str | None = None,
block_id: str | None = None,
**others: dict)
+class AlertBlock(Block):
+ type = "alert"
+ valid_levels = {"default", "info", "warning", "error", "success"}
+
+ @property
+ def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union({"text", "level"})
+
+ def __init__(
+ self,
+ *,
+ text: Union[str, dict, TextObject],
+ level: Optional[str] = None,
+ block_id: Optional[str] = None,
+ **others: dict,
+ ):
+ """Displays alerts, warnings, and informational messages.
+ https://docs.slack.dev/reference/block-kit/blocks/alert-block
+
+ Args:
+ text (required): The alert message, using plain_text or mrkdwn formatting.
+ level: One of "default", "info", "warning", "error", or "success".
+ Will be "default" if omitted.
+ block_id: A unique identifier for a block. If not specified, a block_id will be generated.
+ """
+ super().__init__(type=self.type, block_id=block_id)
+ show_unknown_key_warning(self, others)
+
+ self.text = TextObject.parse(text)
+ self.level = level
+
+ @JsonValidator("text attribute must be specified")
+ def _validate_text(self):
+ return self.text is not None
+
+ @JsonValidator("level must be a valid value (default, info, warning, error, success)")
+ def _validate_level(self):
+ return self.level is None or self.level in self.valid_levels
+Blocks are a series of components that can be combined +to create visually rich and compellingly interactive messages. +https://docs.slack.dev/reference/block-kit/blocks
+Displays alerts, warnings, and informational messages. +https://docs.slack.dev/reference/block-kit/blocks/alert-block
+text : requiredlevelblock_idvar typeThe type of the None singleton.
var valid_levelsThe type of the None singleton.
prop attributes : Set[str]@property
+def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union({"text", "level"})
+Build an unordered collection of unique elements.
Block:
+
+
class Block
(*,
type: str | None = None,
subtype: str | None = None,
block_id: str | None = None)
@@ -264,6 +372,12 @@ Inherited members
return TaskCardBlock(**block)
elif type == PlanBlock.type:
return PlanBlock(**block)
+ elif type == CardBlock.type:
+ return CardBlock(**block)
+ elif type == AlertBlock.type:
+ return AlertBlock(**block)
+ elif type == CarouselBlock.type:
+ return CarouselBlock(**block)
else:
cls.logger.warning(f"Unknown block detected and skipped ({block})")
return None
@@ -286,7 +400,10 @@ Ancestors
Subclasses
- ActionsBlock
+- AlertBlock
- CallBlock
+- CardBlock
+- CarouselBlock
- ContextActionsBlock
- ContextBlock
- DividerBlock
@@ -320,13 +437,13 @@ Class variables
Static methods
-def parse(block: dict | Block) ‑> Block | None
+def parse(block: dict | ForwardRef('Block')) ‑> Block | None
-
-def parse_all(blocks: Sequence[dict | Block] | None) ‑> List[Block]
+def parse_all(blocks: Sequence[dict | ForwardRef('Block')] | None) ‑> List[Block]
-
@@ -458,13 +575,13 @@
Class variables
Static methods
-def parse(block_element: dict | BlockElement) ‑> BlockElement | TextObject | None
+def parse(block_element: dict | ForwardRef('BlockElement')) ‑> BlockElement | TextObject | None
-
-def parse_all(block_elements: Sequence[dict | BlockElement | TextObject]) ‑> List[BlockElement | TextObject]
+def parse_all(block_elements: Sequence[dict | ForwardRef('BlockElement') | TextObject]) ‑> List[BlockElement | TextObject]
-
@@ -750,6 +867,269 @@
Inherited members
+class CardBlock
+(*,
block_id: str | None = None,
hero_image: str | None = None,
icon: str | None = None,
title: str | dict | TextObject | None = None,
subtitle: str | dict | TextObject | None = None,
body: str | dict | TextObject | None = None,
actions: Sequence[dict | BlockElement] | None = None,
**others: dict)
+class CardBlock(Block):
+ type = "card"
+ title_max_length = 150
+ subtitle_max_length = 150
+ body_max_length = 200
+
+ @property
+ def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union(
+ {
+ "hero_image",
+ "icon",
+ "title",
+ "subtitle",
+ "body",
+ "actions",
+ }
+ )
+
+ def __init__(
+ self,
+ *,
+ block_id: Optional[str] = None,
+ hero_image: Optional[str] = None,
+ icon: Optional[str] = None,
+ title: Optional[Union[str, dict, TextObject]] = None,
+ subtitle: Optional[Union[str, dict, TextObject]] = None,
+ body: Optional[Union[str, dict, TextObject]] = None,
+ actions: Optional[Sequence[Union[dict, BlockElement]]] = None,
+ **others: dict,
+ ):
+ """Displays content in a card.
+ https://docs.slack.dev/reference/block-kit/blocks/card-block
+
+ Args:
+ block_id: A unique identifier for a block. If not specified, a block_id will be generated.
+ hero_image: Link to the top image used on the card.
+ icon: Link to the small image used next to the card's title and subtitle.
+ title: Title of the card. 150 characters max.
+ subtitle: Subtitle of the card. 150 characters max.
+ body: Content of the card. 200 characters max.
+ actions: Action buttons shown at the bottom of the card.
+ """
+ super().__init__(type=self.type, block_id=block_id)
+ show_unknown_key_warning(self, others)
+
+ self.hero_image = hero_image
+ self.icon = icon
+ self.title = TextObject.parse(title, default_type=MarkdownTextObject.type) # type: ignore[arg-type]
+ self.subtitle = TextObject.parse(subtitle, default_type=MarkdownTextObject.type) # type: ignore[arg-type]
+ self.body = TextObject.parse(body, default_type=MarkdownTextObject.type) # type: ignore[arg-type]
+ self.actions = BlockElement.parse_all(actions) if actions else None
+
+ @JsonValidator("At least one of hero_image, title, actions, or body is required")
+ def _validate_content(self):
+ return self.hero_image is not None or self.title is not None or self.actions is not None or self.body is not None
+
+ @JsonValidator(f"title attribute cannot exceed {title_max_length} characters")
+ def _validate_title_length(self):
+ return self.title is None or self.title.text is None or len(self.title.text) <= self.title_max_length
+
+ @JsonValidator(f"subtitle attribute cannot exceed {subtitle_max_length} characters")
+ def _validate_subtitle_length(self):
+ return self.subtitle is None or self.subtitle.text is None or len(self.subtitle.text) <= self.subtitle_max_length
+
+ @JsonValidator(f"body attribute cannot exceed {body_max_length} characters")
+ def _validate_body_length(self):
+ return self.body is None or self.body.text is None or len(self.body.text) <= self.body_max_length
+Blocks are a series of components that can be combined +to create visually rich and compellingly interactive messages. +https://docs.slack.dev/reference/block-kit/blocks
+Displays content in a card. +https://docs.slack.dev/reference/block-kit/blocks/card-block
+block_idhero_imageicontitlesubtitlebodyactionsvar body_max_lengthThe type of the None singleton.
var subtitle_max_lengthThe type of the None singleton.
var title_max_lengthThe type of the None singleton.
var typeThe type of the None singleton.
prop attributes : Set[str]@property
+def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union(
+ {
+ "hero_image",
+ "icon",
+ "title",
+ "subtitle",
+ "body",
+ "actions",
+ }
+ )
+Build an unordered collection of unique elements.
Block:
+
+
+class CarouselBlock
+(*,
elements: Sequence[dict | CardBlock],
block_id: str | None = None,
**others: dict)
+class CarouselBlock(Block):
+ type = "carousel"
+ elements_max_length = 10
+
+ @property
+ def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union({"elements"})
+
+ def __init__(
+ self,
+ *,
+ elements: Sequence[Union[dict, CardBlock]],
+ block_id: Optional[str] = None,
+ **others: dict,
+ ):
+ """Displays related card blocks in a horizontally-scrolling container.
+ https://docs.slack.dev/reference/block-kit/blocks/carousel-block
+
+ Args:
+ elements (required): A list of cards. Minimum 1, maximum 10 cards.
+ block_id: A unique identifier for a block. If not specified, a block_id will be generated.
+ """
+ super().__init__(type=self.type, block_id=block_id)
+ show_unknown_key_warning(self, others)
+
+ self.elements = Block.parse_all(elements)
+
+ @JsonValidator("elements attribute must contain at least 1 card")
+ def _validate_elements_present(self):
+ return self.elements is not None and len(self.elements) >= 1
+
+ @JsonValidator(f"elements attribute cannot exceed {elements_max_length} cards")
+ def _validate_elements_length(self):
+ return self.elements is None or len(self.elements) <= self.elements_max_length
+Blocks are a series of components that can be combined +to create visually rich and compellingly interactive messages. +https://docs.slack.dev/reference/block-kit/blocks
+Displays related card blocks in a horizontally-scrolling container. +https://docs.slack.dev/reference/block-kit/blocks/carousel-block
+elements : requiredblock_idvar elements_max_lengthThe type of the None singleton.
var typeThe type of the None singleton.
prop attributes : Set[str]@property
+def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union({"elements"})
+Build an unordered collection of unique elements.
Block:
+
+
class ChannelMultiSelectElement
(*,
placeholder: str | dict | TextObject | None = None,
action_id: str | None = None,
initial_channels: Sequence[str] | None = None,
confirm: dict | ConfirmObject | None = None,
max_selected_items: int | None = None,
focus_on_load: bool | None = None,
**others: dict)
@@ -1278,7 +1658,7 @@ Class variables
Static methods
-def parse(confirm: ConfirmObject | Dict[str, Any])
+def parse(confirm: ForwardRef('ConfirmObject') | Dict[str, Any])
-
@@ -1650,7 +2030,7 @@
Class variables
Static methods
-def parse(filter: dict | ConversationFilter)
+def parse(filter: dict | ForwardRef('ConversationFilter'))
-
@@ -2842,7 +3222,7 @@
Class variables
Static methods
-def parse(feedback_button: FeedbackButtonObject | Dict[str, Any])
+def parse(feedback_button: ForwardRef('FeedbackButtonObject') | Dict[str, Any])
-
@@ -4727,7 +5107,7 @@
Static methods
Creates a simple Option instance with the same value and label
-def parse_all(options: Sequence[Dict[str, Any] | Option] | None) ‑> List[Option] | None
+def parse_all(options: Sequence[Dict[str, Any] | ForwardRef('Option')] | None) ‑> List[Option] | None
-
@@ -4925,7 +5305,7 @@
Class variables
Static methods
-def parse_all(option_groups: Sequence[Dict[str, Any] | OptionGroup] | None) ‑> List[OptionGroup] | None
+def parse_all(option_groups: Sequence[Dict[str, Any] | ForwardRef('OptionGroup')] | None) ‑> List[OptionGroup] | None
-
@@ -6143,7 +6523,7 @@
Class variables
class RichTextInputElement
-(*,
action_id: str | None = None,
placeholder: str | dict | TextObject | None = None,
initial_value: Dict[str, Any] | RichTextBlock | None = None,
dispatch_action_config: dict | DispatchActionConfig | None = None,
focus_on_load: bool | None = None,
**others: dict)
+(*,
action_id: str | None = None,
placeholder: str | dict | TextObject | None = None,
initial_value: Dict[str, Any] | ForwardRef('RichTextBlock') | None = None,
dispatch_action_config: dict | DispatchActionConfig | None = None,
focus_on_load: bool | None = None,
**others: dict)
-
@@ -6592,7 +6972,7 @@
Inherited members
else:
field_objects.append(PlainTextObject(**d)) # type: ignore[arg-type]
else:
- self.logger.warning(f"Unsupported field detected and skipped {f}")
+ self.logger.warning(f"Unsupported field detected and skipped: {f}")
self.fields = field_objects
self.accessory = BlockElement.parse(accessory) # type: ignore[arg-type]
self.expand = expand
@@ -7547,7 +7927,7 @@ Class variables
Static methods
-def parse(text: str | Dict[str, Any] | TextObject,
default_type: str = 'mrkdwn') ‑> TextObject | None
+def parse(text: str | Dict[str, Any] | ForwardRef('TextObject'),
default_type: str = 'mrkdwn') ‑> TextObject | None
-
@@ -8435,6 +8815,14 @@
AlertBlock
+
+attributes
+type
+valid_levels
+
+
+-
Block
attributes
@@ -8472,6 +8860,24 @@ CardBlock
+
+
+-
+
CarouselBlock
+
+
+-
ChannelMultiSelectElement
attributes
diff --git a/docs/reference/models/messages/chunk.html b/docs/reference/models/messages/chunk.html
index 49c1ef1bc..00c5d1e30 100644
--- a/docs/reference/models/messages/chunk.html
+++ b/docs/reference/models/messages/chunk.html
@@ -46,6 +46,81 @@ Module slack_sdk.models.messages.chunk
Classes
+
+class BlocksChunk
+(*,
blocks: Sequence[Dict | Block],
**others: Dict)
+
+-
+
+
+Expand source code
+
+class BlocksChunk(Chunk):
+ type = "blocks"
+
+ @property
+ def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union({"blocks"})
+
+ def __init__(
+ self,
+ *,
+ blocks: Sequence[Union[Dict, Block]],
+ **others: Dict,
+ ):
+ """Used for passing an array of blocks within a streaming message.
+
+ https://docs.slack.dev/messaging/sending-and-scheduling-messages#text-streaming
+ """
+ super().__init__(type=self.type)
+ show_unknown_key_warning(self, others)
+
+ self.blocks = blocks
+
+Chunk for streaming messages.
+https://docs.slack.dev/messaging/sending-and-scheduling-messages#text-streaming
+Used for passing an array of blocks within a streaming message.
+https://docs.slack.dev/messaging/sending-and-scheduling-messages#text-streaming
+Ancestors
+
+- Chunk
+- JsonObject
+- BaseObject
+
+Class variables
+
+var type
+-
+
The type of the None singleton.
+
+
+Instance variables
+
+prop attributes : Set[str]
+-
+
+
+Expand source code
+
+@property
+def attributes(self) -> Set[str]: # type: ignore[override]
+ return super().attributes.union({"blocks"})
+
+Build an unordered collection of unique elements.
+
+
+Inherited members
+
+Chunk:
+
+
+
+
class Chunk
(*, type: str | None = None)
@@ -81,7 +156,9 @@ Classes
else:
if "type" in chunk:
type = chunk["type"]
- if type == MarkdownTextChunk.type:
+ if type == BlocksChunk.type:
+ return BlocksChunk(**chunk)
+ elif type == MarkdownTextChunk.type:
return MarkdownTextChunk(**chunk)
elif type == PlanUpdateChunk.type:
return PlanUpdateChunk(**chunk)
@@ -103,6 +180,7 @@ Ancestors
Subclasses
+- BlocksChunk
- MarkdownTextChunk
- PlanUpdateChunk
- TaskUpdateChunk
@@ -121,7 +199,7 @@ Class variables
Static methods
-def parse(chunk: Dict | Chunk) ‑> Chunk | None
+def parse(chunk: Dict | ForwardRef('Chunk')) ‑> Chunk | None
-
@@ -407,6 +485,13 @@
Inherited members
Classes
-
+
BlocksChunk
+
+attributes
+type
+
+
+-
Chunk
attributes
diff --git a/docs/reference/models/views/index.html b/docs/reference/models/views/index.html
index b7bad66bc..d9e60359b 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 | 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 | ForwardRef('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 | ViewStateValue]])
+(*,
values: Dict[str, Dict[str, dict | ForwardRef('ViewStateValue')]])
-
diff --git a/docs/reference/oauth/installation_store/amazon_s3/index.html b/docs/reference/oauth/installation_store/amazon_s3/index.html
index 0b3afe30a..9b6531ecb 100644
--- a/docs/reference/oauth/installation_store/amazon_s3/index.html
+++ b/docs/reference/oauth/installation_store/amazon_s3/index.html
@@ -147,7 +147,7 @@
Classes
def save_bot(self, bot: Bot):
if bot.bot_token is None:
- self.logger.debug("Skipped saving a new row because of the absense of bot token in it")
+ self.logger.debug("Skipped saving a new row because of the absence of bot token in it")
return
none = "none"
@@ -314,7 +314,7 @@ Classes
Key=content.get("Key"),
)
except Exception as e:
- message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}"
+ message = f"Failed to delete bot installation data for enterprise: {e_id}, team: {t_id}: {e}"
raise SlackClientConfigurationError(message)
async def async_delete_installation(
@@ -357,7 +357,7 @@ Classes
)
deleted_keys.append(key)
except Exception as e:
- message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}"
+ message = f"Failed to delete installation data for enterprise: {e_id}, team: {t_id}: {e}"
raise SlackClientConfigurationError(message)
try:
@@ -369,7 +369,7 @@ Classes
)
deleted_keys.append(no_user_id_key)
except Exception as e:
- message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}"
+ message = f"Failed to delete installation data for enterprise: {e_id}, team: {t_id}: {e}"
raise SlackClientConfigurationError(message)
# Check the remaining installation data
@@ -388,7 +388,7 @@ Classes
Key=content.get("Key"),
)
except Exception as e:
- message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}"
+ message = f"Failed to delete installation data for enterprise: {e_id}, team: {t_id}: {e}"
raise SlackClientConfigurationError(message)
The installation store interface.
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 a38205174..aba88128a 100644 --- a/docs/reference/oauth/installation_store/async_cacheable_installation_store.html +++ b/docs/reference/oauth/installation_store/async_cacheable_installation_store.html @@ -146,7 +146,8 @@def create_tables(self):
with sqlite3.connect(database=self.database) as conn:
- conn.execute(
- """
+ conn.execute("""
create table slack_installations (
id integer primary key autoincrement,
client_id text not null,
@@ -755,10 +746,8 @@ Methods
token_type text,
installed_at datetime not null default current_timestamp
);
- """
- )
- conn.execute(
- """
+ """)
+ conn.execute("""
create index slack_installations_idx on slack_installations (
client_id,
enterprise_id,
@@ -766,10 +755,8 @@ Methods
user_id,
installed_at
);
- """
- )
- conn.execute(
- """
+ """)
+ conn.execute("""
create table slack_bots (
id integer primary key autoincrement,
client_id text not null,
@@ -787,18 +774,15 @@ Methods
is_enterprise_install boolean not null default 0,
installed_at datetime not null default current_timestamp
);
- """
- )
- conn.execute(
- """
+ """)
+ conn.execute("""
create index slack_bots_idx on slack_bots (
client_id,
enterprise_id,
team_id,
installed_at
);
- """
- )
+ """)
self.logger.debug(f"Tables have been created (database: {self.database})")
conn.commit()
diff --git a/docs/reference/oauth/state_store/sqlite3/index.html b/docs/reference/oauth/state_store/sqlite3/index.html
index cd0b75b8b..e1e1d0b1f 100644
--- a/docs/reference/oauth/state_store/sqlite3/index.html
+++ b/docs/reference/oauth/state_store/sqlite3/index.html
@@ -91,15 +91,13 @@ def create_tables(self):
with sqlite3.connect(database=self.database) as conn:
- conn.execute(
- """
+ conn.execute("""
create table oauth_states (
id integer primary key autoincrement,
state text not null,
expire_at datetime not null
);
- """
- )
+ """)
self.logger.debug(f"Tables have been created (database: {self.database})")
conn.commit()
diff --git a/docs/reference/signature/index.html b/docs/reference/signature/index.html
index ecc1f0831..f1c87b3c1 100644
--- a/docs/reference/signature/index.html
+++ b/docs/reference/signature/index.html
@@ -101,7 +101,7 @@ Generates a signature
-def is_valid(self, body: str | bytes, timestamp: str, signature: str) ‑> bool
+def is_valid(self, body: str | bytes, timestamp: str | None, signature: str | None) ‑> bool
def is_valid(
self,
body: Union[str, bytes],
- timestamp: str,
- signature: str,
+ timestamp: Optional[str],
+ signature: Optional[str],
) -> bool:
"""Verifies if the given signature is valid"""
if timestamp is None or signature is None:
@@ -217,7 +217,7 @@ Methods
def is_valid_request(
self,
body: Union[str, bytes],
- headers: Dict[str, str],
+ headers: Mapping[str, str],
) -> bool:
"""Verifies if the given signature is valid"""
if headers is None:
@@ -225,8 +225,8 @@ Methods
normalized_headers = {k.lower(): v for k, v in headers.items()}
return self.is_valid(
body=body,
- timestamp=normalized_headers.get("x-slack-request-timestamp", None), # type: ignore[arg-type]
- signature=normalized_headers.get("x-slack-signature", None), # type: ignore[arg-type]
+ timestamp=normalized_headers.get("x-slack-request-timestamp", None),
+ signature=normalized_headers.get("x-slack-signature", None),
)
Verifies if the given signature is valid
def connect_to_new_endpoint(self, force: bool = False):
+ acquired = False
try:
- self.connect_operation_lock.acquire(blocking=True, timeout=5)
- if force or not self.is_connected():
+ acquired = self.connect_operation_lock.acquire(blocking=True, timeout=5)
+ if force or (acquired and not self.is_connected()):
self.logger.info("Connecting to a new endpoint...")
self.wss_uri = self.issue_new_wss_url()
self.connect()
self.logger.info("Connected to a new endpoint...")
finally:
- self.connect_operation_lock.release()
+ if acquired:
+ self.connect_operation_lock.release()
slack_sdk.socket_mode.websocket_clientwebsocket-client bassd Socket Mode client …
websocket-client based Socket Mode client …
slack_sdk.socket_mode.websocketswebsockets bassd Socket Mode client …
websockets based Socket Mode client …
def to_dict(self) -> dict:
- d = {"envelope_id": self.envelope_id}
+ d = {"type": self.type, "envelope_id": self.envelope_id}
if self.payload is not None:
d["payload"] = self.payload # type: ignore[assignment]
return d
diff --git a/docs/reference/socket_mode/websocket_client/index.html b/docs/reference/socket_mode/websocket_client/index.html
index b90aa9137..09cfb4424 100644
--- a/docs/reference/socket_mode/websocket_client/index.html
+++ b/docs/reference/socket_mode/websocket_client/index.html
@@ -5,7 +5,7 @@
slack_sdk.socket_mode.websocket_clientwebsocket-client bassd Socket Mode client
+websocket-client based Socket Mode client
slack_sdk.socket_mode.websocketswebsockets bassd Socket Mode client
+websockets based Socket Mode client
class AsyncChatStream
-(client: AsyncWebClient,
*,
channel: str,
logger: logging.Logger,
thread_ts: str,
buffer_size: int,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
**kwargs)
+(client: AsyncWebClient,
*,
channel: str,
logger: logging.Logger,
thread_ts: str,
buffer_size: int,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs)
task_display_modeicon_emojiicon_urlusernamebuffer_size
-async def assistant_threads_setStatus(self,
*,
channel_id: str,
thread_ts: str,
status: str,
loading_messages: List[str] | None = None,
**kwargs) ‑> AsyncSlackResponse
+async def assistant_threads_setStatus(self,
*,
channel_id: str,
thread_ts: str,
status: str,
loading_messages: List[str] | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> AsyncSlackResponse
-async def chat_startStream(self,
*,
channel: str,
thread_ts: str,
markdown_text: str | None = None,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
task_display_mode: str | None = None,
**kwargs) ‑> AsyncSlackResponse
+async def chat_startStream(self,
*,
channel: str,
thread_ts: str,
markdown_text: str | None = None,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> AsyncSlackResponse
-async def chat_stream(self,
*,
buffer_size: int = 256,
channel: str,
thread_ts: str,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
**kwargs) ‑> AsyncChatStream
+async def chat_stream(self,
*,
buffer_size: int = 256,
channel: str,
thread_ts: str,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> AsyncChatStream
task_display_modeicon_emojiicon_urlusername**kwargs
-async def files_completeUploadExternal(self,
*,
files: List[Dict[str, str]],
channel_id: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
**kwargs) ‑> AsyncSlackResponse
+async def files_completeUploadExternal(self,
*,
files: List[Dict[str, str | None]],
channel_id: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
**kwargs) ‑> AsyncSlackResponse
async def files_completeUploadExternal(
self,
*,
- files: List[Dict[str, str]],
+ files: List[Dict[str, Optional[str]]],
channel_id: Optional[str] = None,
channels: Optional[List[str]] = None,
initial_comment: Optional[str] = None,
@@ -12366,7 +12426,7 @@ Example
https://docs.slack.dev/reference/methods/files.upload
-async def files_upload_v2(self,
*,
filename: str | None = None,
file: str | bytes | io.IOBase | os.PathLike | None = None,
content: str | bytes | None = None,
title: str | None = None,
alt_txt: str | None = None,
snippet_type: str | None = None,
file_uploads: List[Dict[str, Any]] | None = None,
channel: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
request_file_info: bool = True,
**kwargs) ‑> AsyncSlackResponse
+async def files_upload_v2(self,
*,
filename: str | None = None,
file: str | bytes | io.IOBase | os.PathLike | None = None,
content: str | bytes | None = None,
title: str | None = None,
alt_txt: str | None = None,
highlight_type: str | None = None,
snippet_type: str | None = None,
file_uploads: List[Dict[str, Any]] | None = None,
channel: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
request_file_info: bool = True,
**kwargs) ‑> AsyncSlackResponse
class ChatStream
-(client: WebClient,
*,
channel: str,
logger: logging.Logger,
thread_ts: str,
buffer_size: int,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
**kwargs)
+(client: WebClient,
*,
channel: str,
logger: logging.Logger,
thread_ts: str,
buffer_size: int,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs)
task_display_modeicon_emojiicon_urlusernamebuffer_size
-def assistant_threads_setStatus(self,
*,
channel_id: str,
thread_ts: str,
status: str,
loading_messages: List[str] | None = None,
**kwargs) ‑> SlackResponse
+def assistant_threads_setStatus(self,
*,
channel_id: str,
thread_ts: str,
status: str,
loading_messages: List[str] | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> SlackResponse
-def chat_startStream(self,
*,
channel: str,
thread_ts: str,
markdown_text: str | None = None,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
task_display_mode: str | None = None,
**kwargs) ‑> SlackResponse
+def chat_startStream(self,
*,
channel: str,
thread_ts: str,
markdown_text: str | None = None,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> SlackResponse
-def chat_stream(self,
*,
buffer_size: int = 256,
channel: str,
thread_ts: str,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
**kwargs) ‑> ChatStream
+def chat_stream(self,
*,
buffer_size: int = 256,
channel: str,
thread_ts: str,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> ChatStream
task_display_modeicon_emojiicon_urlusername**kwargs
-def files_completeUploadExternal(self,
*,
files: List[Dict[str, str]],
channel_id: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
**kwargs) ‑> SlackResponse
+def files_completeUploadExternal(self,
*,
files: List[Dict[str, str | None]],
channel_id: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
**kwargs) ‑> SlackResponse
def files_completeUploadExternal(
self,
*,
- files: List[Dict[str, str]],
+ files: List[Dict[str, Optional[str]]],
channel_id: Optional[str] = None,
channels: Optional[List[str]] = None,
initial_comment: Optional[str] = None,
@@ -12366,7 +12426,7 @@ Example
https://docs.slack.dev/reference/methods/files.upload
-def files_upload_v2(self,
*,
filename: str | None = None,
file: str | bytes | io.IOBase | os.PathLike | None = None,
content: str | bytes | None = None,
title: str | None = None,
alt_txt: str | None = None,
snippet_type: str | None = None,
file_uploads: List[Dict[str, Any]] | None = None,
channel: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
request_file_info: bool = True,
**kwargs) ‑> SlackResponse
+def files_upload_v2(self,
*,
filename: str | None = None,
file: str | bytes | io.IOBase | os.PathLike | None = None,
content: str | bytes | None = None,
title: str | None = None,
alt_txt: str | None = None,
highlight_type: str | None = None,
snippet_type: str | None = None,
file_uploads: List[Dict[str, Any]] | None = None,
channel: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
request_file_info: bool = True,
**kwargs) ‑> SlackResponse
-def assistant_threads_setStatus(self,
*,
channel_id: str,
thread_ts: str,
status: str,
loading_messages: List[str] | None = None,
**kwargs) ‑> SlackResponse
+def assistant_threads_setStatus(self,
*,
channel_id: str,
thread_ts: str,
status: str,
loading_messages: List[str] | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> SlackResponse
-def chat_startStream(self,
*,
channel: str,
thread_ts: str,
markdown_text: str | None = None,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
task_display_mode: str | None = None,
**kwargs) ‑> SlackResponse
+def chat_startStream(self,
*,
channel: str,
thread_ts: str,
markdown_text: str | None = None,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> SlackResponse
-def chat_stream(self,
*,
buffer_size: int = 256,
channel: str,
thread_ts: str,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
**kwargs) ‑> ChatStream
+def chat_stream(self,
*,
buffer_size: int = 256,
channel: str,
thread_ts: str,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> ChatStream
task_display_modeicon_emojiicon_urlusername**kwargs
-def files_completeUploadExternal(self,
*,
files: List[Dict[str, str]],
channel_id: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
**kwargs) ‑> SlackResponse
+def files_completeUploadExternal(self,
*,
files: List[Dict[str, str | None]],
channel_id: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
**kwargs) ‑> SlackResponse
def files_completeUploadExternal(
self,
*,
- files: List[Dict[str, str]],
+ files: List[Dict[str, Optional[str]]],
channel_id: Optional[str] = None,
channels: Optional[List[str]] = None,
initial_comment: Optional[str] = None,
@@ -12733,7 +12793,7 @@ Example
https://docs.slack.dev/reference/methods/files.upload
-def files_upload_v2(self,
*,
filename: str | None = None,
file: str | bytes | io.IOBase | os.PathLike | None = None,
content: str | bytes | None = None,
title: str | None = None,
alt_txt: str | None = None,
snippet_type: str | None = None,
file_uploads: List[Dict[str, Any]] | None = None,
channel: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
request_file_info: bool = True,
**kwargs) ‑> SlackResponse
+def files_upload_v2(self,
*,
filename: str | None = None,
file: str | bytes | io.IOBase | os.PathLike | None = None,
content: str | bytes | None = None,
title: str | None = None,
alt_txt: str | None = None,
highlight_type: str | None = None,
snippet_type: str | None = None,
file_uploads: List[Dict[str, Any]] | None = None,
channel: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
request_file_info: bool = True,
**kwargs) ‑> SlackResponse
-def assistant_threads_setStatus(self,
*,
channel_id: str,
thread_ts: str,
status: str,
loading_messages: List[str] | None = None,
**kwargs) ‑> _asyncio.Future | LegacySlackResponse
+def assistant_threads_setStatus(self,
*,
channel_id: str,
thread_ts: str,
status: str,
loading_messages: List[str] | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> _asyncio.Future | LegacySlackResponse
-def chat_startStream(self,
*,
channel: str,
thread_ts: str,
markdown_text: str | None = None,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
task_display_mode: str | None = None,
**kwargs) ‑> _asyncio.Future | LegacySlackResponse
+def chat_startStream(self,
*,
channel: str,
thread_ts: str,
markdown_text: str | None = None,
recipient_team_id: str | None = None,
recipient_user_id: str | None = None,
chunks: Sequence[Dict | Chunk] | None = None,
task_display_mode: str | None = None,
icon_emoji: str | None = None,
icon_url: str | None = None,
username: str | None = None,
**kwargs) ‑> _asyncio.Future | LegacySlackResponse
-def files_completeUploadExternal(self,
*,
files: List[Dict[str, str]],
channel_id: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
**kwargs) ‑> _asyncio.Future | LegacySlackResponse
+def files_completeUploadExternal(self,
*,
files: List[Dict[str, str | None]],
channel_id: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
**kwargs) ‑> _asyncio.Future | LegacySlackResponse
def files_completeUploadExternal(
self,
*,
- files: List[Dict[str, str]],
+ files: List[Dict[str, Optional[str]]],
channel_id: Optional[str] = None,
channels: Optional[List[str]] = None,
initial_comment: Optional[str] = None,
@@ -12175,7 +12211,7 @@ Methods
https://docs.slack.dev/reference/methods/files.upload
-def files_upload_v2(self,
*,
filename: str | None = None,
file: str | bytes | io.IOBase | os.PathLike | None = None,
content: str | bytes | None = None,
title: str | None = None,
alt_txt: str | None = None,
snippet_type: str | None = None,
file_uploads: List[Dict[str, Any]] | None = None,
channel: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
request_file_info: bool = True,
**kwargs) ‑> _asyncio.Future | LegacySlackResponse
+def files_upload_v2(self,
*,
filename: str | None = None,
file: str | bytes | io.IOBase | os.PathLike | None = None,
content: str | bytes | None = None,
title: str | None = None,
alt_txt: str | None = None,
highlight_type: str | None = None,
snippet_type: str | None = None,
file_uploads: List[Dict[str, Any]] | None = None,
channel: str | None = None,
channels: List[str] | None = None,
initial_comment: str | None = None,
thread_ts: str | None = None,
request_file_info: bool = True,
**kwargs) ‑> _asyncio.Future | LegacySlackResponse