Objects
Composition objects are the lowest-level primitives used inside of Block objects.
See: https://api.slack.com/reference/block-kit/composition-objects.
Confirm
Alias for ConfirmationDialogue
to retain backwards compatibility.
See
Source code in slackblocks/objects.py
252 253 254 255 256 257 258 259 260 261 |
|
ConfirmationDialogue
An object that defines a dialog that provides a confirmation step to any interactive element. This dialog will ask the user to confirm their action by offering confirm and deny buttons.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
TextLike
|
the text heading presented at the top of the dialogue box (max 100 chars). |
required |
text |
TextLike
|
the text explaining the decision being made by the user through the dialogue box (max 300 chars). |
required |
confirm |
TextLike
|
the text inside the confirmation button of the dialogue box (max 30 chars). |
required |
deny |
TextLike
|
the text inside the deny button of the dialogue box (max 30 chars). |
required |
Throws
InvalidUsageError: if any of the arguments fail to pass validation checks.
Source code in slackblocks/objects.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
|
ConversationFilter
Provides a way to filter the list of options in a conversations select menu or conversations multi-select menu.
See: https://api.slack.com/reference/block-kit/composition-objects#filter_conversations.
At least one of the available arguments must be provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
include |
Optional[Union[str, List[str]]]
|
Which types of conversations to include in the list.
One of more of |
None
|
exclude_external_shared_channels |
Optional[bool]
|
whether to remove shared public channels from the list. See https://api.slack.com/enterprise/shared-channels. |
None
|
exclude_bot_users |
Optional[bool]
|
whether to remove bot users from the list of conversations. |
None
|
Throws
InvalidUsageException: in the event that the user provides none of include
,
exclude_external_shared_channels
, or exclude_bot_users
arguments.
Source code in slackblocks/objects.py
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
|
DispatchActionConfiguration
Determines when a plain-text input element will return a block_action
s interaction payload.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trigger_actions_on |
Optional[Union[str, List[str]]]
|
a list of strings representing interaction types that should return
a |
None
|
Throws
InvalidUsageError: if an invalid value is provided amongst the options for
trigger_actions_on
.
Source code in slackblocks/objects.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
|
InputParameter
Contains information about an input parameter.
See https://api.slack.com/automation/workflows#defining-input-parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
the name of the input parameter. |
required |
value |
str
|
the value associated with the input parameter. |
required |
Source code in slackblocks/objects.py
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
|
Option
An object that represents a single selectable item in a select menu, multi-select menu, checkbox group, radio button group, or overflow menu.
See https://api.slack.com/reference/block-kit/composition-objects#option.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
TextLike
|
the text identifying the option (that the user will see). |
required |
value |
str
|
the underlying value of that option (not seen by the user). |
required |
description |
Optional[TextLike]
|
a more detailed explanation of what the option means (user-facing). |
None
|
url |
Optional[str]
|
a URL to load in the user's browser when the option is clicked.
Only available in |
None
|
Throws
InvalidUsageError: when any of the provided arguments fail validation.
Source code in slackblocks/objects.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
|
OptionGroup
Provides a way to group options in a select menu or multi-select menu.
See https://api.slack.com/reference/block-kit/composition-objects#option_group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label |
TextLike
|
a label shown above the group of options. |
required |
options |
List[Option]
|
a list of |
required |
Throws
InvalidUsageError: if no options are provided or the label is not valid.
Source code in slackblocks/objects.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
SlackFile
Defines an object containing Slack file information to be used in an image block or image element.
This file must be an image and you must provide either the URL or ID (not both).
See: https://api.slack.com/reference/block-kit/composition-objects#slack_file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
Optional[str]
|
the URL can be the |
required |
id |
Optional[str]
|
the Slack ID of the file
(only one of |
required |
Throws
InvalidUsageError: if both url
and id
are provided
Source code in slackblocks/objects.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
|
Text
An object containing some text, formatted either as plain_text
or using
Slack's mrkdwn
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
the text to be rendered in a message (max 3000 characters). |
required |
type_ |
TextType
|
either |
MARKDOWN
|
emoji |
bool
|
only usable with |
False
|
verbatim |
bool
|
only usable with |
False
|
Throws
InvalidUsageException: if the provided text
fails validation.
Source code in slackblocks/objects.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
to_text
staticmethod
to_text(
text,
force_plaintext=False,
max_length=None,
allow_none=False,
)
Coerces str
or Text
objects into Text
objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
Optional[Union[str, Text]]
|
the |
required |
force_plaintext |
bool
|
if |
False
|
max_length |
Optional[int]
|
|
None
|
allow_none |
bool
|
whether to accept |
False
|
Source code in slackblocks/objects.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
to_text_nonnull
staticmethod
to_text_nonnull(
text, force_plaintext=False, max_length=None
)
Coerces str
or Text
objects into Text
objects, but does not allow None
values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
Union[str, Text]
|
the |
required |
force_plaintext |
bool
|
if |
False
|
max_length |
Optional[int]
|
|
None
|
Returns:
Type | Description |
---|---|
Text
|
A |
Throws
InvalidUsageError: if the text length exceeds the specified max_length.
Source code in slackblocks/objects.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
|
TextType
Allowable types for Slack Text objects.
tradional markdown formatting, see
https://api.slack.com/reference/surfaces/formatting#basic-formatting
PLAINTEXT: simple Unicode text with no formatting (e.g. bold) features.
N.B: some usages of Text objects only allow the PLAINTEXT
variety.
Source code in slackblocks/objects.py
61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
Trigger
Contains information about a trigger.
See: https://api.slack.com/automation/triggers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
a link trigger URL, see https://api.slack.com/automation/triggers/link |
required |
customizable_input_parameters |
Optional[Union[InputParameter, List[InputParameter]]]
|
a list of |
required |
Throws
InvalidUsageError: when any of the items in
customizable_input_parameters
is not a valid InputParameter
.
Source code in slackblocks/objects.py
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 |
|
Workflow
Contains information about a workflow.
See https://api.slack.com/automation/workflows.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trigger |
Trigger
|
a |
required |
Source code in slackblocks/objects.py
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
|