Messages
Messages are the core unit of Slack messaging functionality. They can be built out using blocks, elements, objects, and rich text features.
See: https://api.slack.com/messaging
Message
A Slack message object that can be converted to a JSON string for use with the Slack message API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
channel |
str
|
the Slack channel to send the message to, e.g. "#general". |
required |
text |
Optional[str]
|
markdown text to send in the message. If |
''
|
blocks |
Optional[Union[List[Block], Block]]
|
a list of |
None
|
attachments |
Optional[List[Attachment]]
|
a list of
|
None
|
thread_ts |
Optional[str]
|
the timestamp ID of another unthreaded message that will become the parent message of this message (now a reply in a thread). |
None
|
mrkdwn |
bool
|
if |
True
|
unfurl_links |
Optional[bool]
|
if |
None
|
unfurl_media |
Optional[bool]
|
if |
None
|
Throws:
InvalidUsageException: in the event that the items passed to blocks
are not valid Blocks
.
Source code in slackblocks/messages.py
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 |
|
ResponseType
Types of messages that can be sent via WebhookMessage
.
Source code in slackblocks/messages.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
WebhookMessage
Messages sent via the Slack WebhookClient
takes different arguments than
those sent via the regular WebClient
.
See: https://github.com/slackapi/python-slack-sdk/blob/7e71b73/slack_sdk/webhook/client.py#L28
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
Optional[str]
|
markdown text to send in the message. If |
None
|
attachments |
Optional[Union[Attachment, List[Attachment]]]
|
a list of
|
None
|
blocks |
Optional[Union[Block, List[Block]]]
|
a list of |
None
|
response_type |
Optional[Union[ResponseType, str]]
|
one of |
None
|
replace_orginal |
when |
required | |
delete_original |
Optional[bool]
|
when |
None
|
unfurl_links |
Optional[bool]
|
if |
None
|
unfurl_media |
Optional[bool]
|
if |
None
|
metadata |
Optional[Dict[str, Any]]
|
additional metadata to attach to the message. |
None
|
headres |
HTTP request headers to include with the message. |
required |
Throws
InvalidUsageError: when any of the passed fields fail validation.
Source code in slackblocks/messages.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 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 |
|