-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask_card.py
More file actions
42 lines (39 loc) · 1.17 KB
/
task_card.py
File metadata and controls
42 lines (39 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from slack_sdk.models.blocks import RichTextBlock, TaskCardBlock
from slack_sdk.models.blocks.block_elements import (
RichTextElementParts,
RichTextSectionElement,
UrlSourceElement,
)
def example01() -> TaskCardBlock:
"""
Displays a single task, representing a single action.
https://docs.slack.dev/reference/block-kit/blocks/task-card-block/
A task card with output and sources.
"""
block = TaskCardBlock(
task_id="task_1",
title="Fetching weather data",
status="pending",
output=RichTextBlock(
elements=[
RichTextSectionElement(
elements=[
RichTextElementParts.Text(
text="Found weather data for Chicago from 2 sources"
)
]
)
]
),
sources=[
UrlSourceElement(
url="https://weather.com/",
text="weather.com",
),
UrlSourceElement(
url="https://www.accuweather.com/",
text="accuweather.com",
),
],
)
return block