Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
matrix:
showcase:
- "block-kit"
- "messsaging/work-objects"
steps:
- name: Checkout code
uses: actions/checkout@v5
Expand Down
9 changes: 9 additions & 0 deletions messaging/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Messaging

Core Slack functionality!

Read the [docs](https://docs.slack.dev/messaging/) to learn about messaging in Slack.

## What's on display

- **[Work Objects](https://docs.slack.dev/messaging/work-objects/)**: Preview and interact with your app data in Slack.
6 changes: 6 additions & 0 deletions messaging/work-objects/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
dist/
.env
*.log
.DS_Store
package-lock.json
93 changes: 93 additions & 0 deletions messaging/work-objects/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Work Objects Example

A TypeScript app built with [Bolt for JavaScript](https://slack.dev/bolt-js/) that demonstrates **Work Objects** in Slack. This example shows how to:

- Unfurl links with rich Work Object metadata
- Display interactive details in the flexpane
- Support editing work object fields directly from Slack

This app responds to links being shared in Slack with Work Object metadata to display rich link previews. Users can click the preview to view detailed information in the flexpane, and edit supported fields like description and status.

Read the [Work Objects documentation](https://docs.slack.dev/messaging/work-objects/) to learn more!

## Setup

### 1. Create a Slack App

1. Go to [https://api.slack.com/apps](https://api.slack.com/apps)
2. Click **"Create New App"**
3. Choose **"From an app manifest"**
4. Select your workspace
5. Copy the contents of `manifest.json` and paste it into the manifest editor
6. Review the configuration and click **"Create"**

### 2. Configure Environment Variables

1. Copy the environment variables template:
```bash
cp .env.sample .env
```

2. Fill in your Slack credentials in `.env`:
```
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_APP_TOKEN=xapp-your-app-token
```

You can find these values in your app's settings:
- **Bot Token**: OAuth & Permissions → Bot User OAuth Token
- **App Token**: Basic Information → App-Level Tokens (create one with `connections:write` scope)

### 3. Install Dependencies

```bash
npm install
```

### 4. Run the App

```bash
npm start
```

## Troubleshooting

### Links aren't unfurling

1. Make sure you've added the domain used for the sample URLs in metadata.ts to the unfurl domains in App Settings
2. Verify that the `link_shared` event is enabled in Event Subscriptions
3. Check that your app has the `links:read` and `links:write` scopes
4. Ensure Socket Mode is enabled and you have a valid app-level token with `connections:write` scope
5. Verify the app is running (`⚡️ The Work Objects app is running!` should appear in console)

### Flexpane not opening

1. Ensure the `entity_details_requested` event is enabled in Event Subscriptions
2. Check that your app is connected via Socket Mode
3. Look for errors in the app logs

### Edits not saving

1. Ensure Interactivity is enabled in your app settings
2. Check that the `view_submission` handler is receiving events (check logs)
3. Verify the entity has editable fields defined with `edit: { enabled: true }`

## Key Features Demonstrated

- ✅ Link unfurling with `EntityMetadata`
- ✅ Flexpane display with `entity.presentDetails`
- ✅ Field editing via `view_submission`
- ✅ Support for both File and Task entity types
- ✅ TypeScript with strict typing using `@slack/types`
- ✅ Socket Mode for local development

## Resources

- [Work Objects Documentation](https://docs.slack.dev/messaging/work-objects/) - Official Slack docs
- [Entity Types Reference](https://docs.slack.dev/messaging/work-objects/#supported-entity-types) - Available entity types
- [Bolt for JavaScript](https://slack.dev/bolt-js/) - Framework documentation
- [@slack/types](https://www.npmjs.com/package/@slack/types) - TypeScript type definitions

## License

MIT
30 changes: 30 additions & 0 deletions messaging/work-objects/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"display_information": {
"name": "Work Objects Example",
"description": "A sample app demonstrating Slack Work Objects functionality",
"background_color": "#2c2d30"
},
"features": {
"bot_user": {
"display_name": "Work Objects Bot",
"always_online": true
},
"unfurl_domains": ["wo-js-nov2025.com"]
},
"oauth_config": {
"scopes": {
"bot": ["links:read", "links:write"]
}
},
"settings": {
"event_subscriptions": {
"bot_events": ["link_shared", "entity_details_requested"]
},
"interactivity": {
"is_enabled": true
},
"org_deploy_enabled": false,
"socket_mode_enabled": true,
"token_rotation_enabled": false
}
}
Loading
Loading