Skip to content

Commit 696bea3

Browse files
committed
update
1 parent 7953a72 commit 696bea3

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

messaging/work-objects/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Read the [docs](https://docs.slack.dev/messaging/work-objects/) to learn more!
88

99
## Running locally
1010

11+
### 0. Create an app
12+
13+
Create an app and add `myappdomain.com`as an [app unfurl domain](https://docs.slack.dev/messaging/unfurling-links-in-messages/#configuring_domains) (or update the unfurl URLs in `metadata.py` with your domain). Also enable [Work Object Previews](https://docs.slack.dev/messaging/work-objects/#implementation) for your app.
14+
1115
### 1. Setup environment variables
1216

1317
```zsh

messaging/work-objects/src/metadata.py

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
EntityEditSupport,
1515
EntityCustomField,
1616
ExternalRef,
17+
EntityFullSizePreview
1718
)
1819

1920
# Update the URL here to match your app's domain
20-
sample_task_unfurl_url = "https://wo-python-nov2025.com/task"
21+
sample_task_unfurl_url = "https://myappdomain.com/task"
22+
sample_file_unfurl_url = "https://myappdomain.com/file"
2123

2224
sample_entities = {
2325
sample_task_unfurl_url: EntityMetadata(
@@ -28,7 +30,36 @@
2830
entity_payload=EntityPayload(
2931
attributes=EntityAttributes(
3032
title=EntityTitle(
31-
text="My Title",
33+
text="My Task",
34+
edit=EntityEditSupport(enabled=True),
35+
)
36+
),
37+
fields=TaskEntityFields(
38+
description=EntityStringField(
39+
value="Hello World!",
40+
edit=EntityEditSupport(enabled=True)
41+
)
42+
),
43+
custom_fields=[
44+
EntityCustomField(
45+
key="hello-world",
46+
label="hello-world",
47+
value="hello-world",
48+
type="string",
49+
)
50+
],
51+
),
52+
),
53+
sample_file_unfurl_url: EntityMetadata(
54+
entity_type="slack#/entities/file",
55+
url=sample_file_unfurl_url,
56+
app_unfurl_url=sample_file_unfurl_url,
57+
external_ref=ExternalRef(id="sample_task_id"),
58+
entity_payload=EntityPayload(
59+
attributes=EntityAttributes(
60+
full_size_preview=EntityFullSizePreview(is_supported=True, preview_url="https://muertoscoffeeco.com/cdn/shop/articles/Why-Roast-Coffee-scaled_1000x.jpg?v=1592234291"),
61+
title=EntityTitle(
62+
text="My File",
3263
edit=EntityEditSupport(enabled=True),
3364
)
3465
),

0 commit comments

Comments
 (0)