task icon Task

Send to Slack

Requirements
Destination (channel name like #general, or person name for DM), message content or intent. Optional: file path to upload OR Block Kit formatting (not both)
Instructions
You MUST use a todo list to complete these steps in order. Never move on to one step if you haven't completed the previous step. If you have multiple read steps in a row, read them all at once (in parallel).
1

Check uiConnection Profiles Quick Access table for channel/DM IDs. Resolve the destination. If not found or ambiguous, ask the user.

5

If no style sections exist, offer to run taskSetup Slack Connection. If Slack section missing but others exist, use those as reference.

7

Draft the message in the user's voice. For simple messages, use plain text. For announcements or structured content, compose Block Kit JSON. Show the user a preview and get approval.

8

Note: If uploading a file, the message will be plain text (Block Kit not supported with file uploads). If rich formatting is needed, send the Block Kit message first, then upload the file separately.

9

If user is attaching a file, confirm the file exists at the given path. Ask for optional title if not provided.

10

If using Block Kit (text-only message), write the blocks JSON to uiSlack Block Kit JSON first.

12

Confirm success. Clean up uiSlack Block Kit JSON if it exists. If a file was uploaded, share the permalink.

                    To run this task you must have the following required information:

> Destination (channel name like #general, or person name for DM), message content or intent. Optional: file path to upload OR Block Kit formatting (not both)

If you don't have all of this information, exit here and respond asking for any extra information you require, and instructions to run this task again with ALL required information.

---

You MUST use a todo list to complete these steps in order. Never move on to one step if you haven't completed the previous step. If you have multiple read steps in a row, read them all at once (in parallel).

Add all steps to your todo list now and begin executing.

## Steps

1. Check `./documents/connections/[service-name].md` Quick Access table for channel/DM IDs. Resolve the destination. If not found or ambiguous, ask the user.

2. [Read Writing Style]: Read the file at `./documents/user/writing_style.md` and analyze its contents (User's writing style - prefer Slack section, fall back to any available)

3. [Read Stated Preferences]: Read the file at `./documents/preferences/stated.yaml` and analyze its contents (Check for explicit messaging preferences)

4. [Read Learned Preferences]: Read the file at `./documents/preferences/learned.yaml` and analyze its contents (Check for past corrections (e.g., wrong tone, channel preferences))

5. If no style sections exist, offer to run `./skills/sauna/[skill_id]/references/recipes/slack.workspace.setup.md`. If Slack section missing but others exist, use those as reference.

6. [Read Slack Message Formatting]: Read the documentation in: `./skills/sauna/[skill_id]/references/compose.format.slack.md` (Block Kit formatting reference)

7. Draft the message in the user's voice. For simple messages, use plain text. For announcements or structured content, compose Block Kit JSON. Show the user a preview and get approval.

8. Note: If uploading a file, the message will be plain text (Block Kit not supported with file uploads). If rich formatting is needed, send the Block Kit message first, then upload the file separately.

9. If user is attaching a file, confirm the file exists at the given path. Ask for optional title if not provided.

10. If using Block Kit (text-only message), write the blocks JSON to `./documents/tmp/slack-blocks.json` first.

11. [Gather Arguments: Send to Slack] The next step has the following requirements for arguments, do not proceed until you have all the required information:
- `channelId`: Channel or DM ID
- `message`: Message text
- `filePath`: File path to upload, OR empty string for text-only message
- `blocksPath`: Block Kit JSON path (text-only messages), OR empty string
- `title`: File title (uploads only), OR empty string

12. [Run Code: Send to Slack]: Call `run_script` with:

```json
{
  "file": {
    "path": https://sk.ills.app/code/slack.workspace.send/preview,
    "args": [
      "channelId",
      "message",
      "filePath",
      "blocksPath",
      "title"
    ]
  },
  "packages": null
}
```

13. Confirm success. Clean up `./documents/tmp/slack-blocks.json` if it exists. If a file was uploaded, share the permalink.