# slick message

**Send**, **edit**, and **delete** Slack messages. Markdown input is converted to [Block Kit](<https://docs.slack.dev/block-kit/>) by default; `--blocks` accepts raw Block Kit JSON. Slack-side message mutations require `chat:write` and permission to act in the destination; user-token profiles can edit and delete only their own messages.

For thread replies, see [`reply`](<https://matcra587.github.io/slack-cli/reply/index.md>). For reactions, see [`react`](<https://matcra587.github.io/slack-cli/react/index.md>).

Opening a one-to-one DM needs `im:write`; opening a group DM needs `mpim:write`. Both need `chat:write` to send. Resolving an email recipient also needs `users:read.email`. These requirements apply to scheduled sends too.

## message send

Send to a channel by ID, name, or alias; `--file -` reads the body from stdin, and `--dry-run` previews without sending:

```
slick message send --channel C1234567890 --message "Deploy complete"
echo "Deploy complete" | slick message send --channel C1234567890 --file -
slick message send --channel C1234567890 --message "Deploy complete" --dry-run
```

Send to one user, a group DM, or a Slack-profile email:

```
slick message send --user U1234567890 --message "Build artifact ready"
slick message send --user dev@example.com,ops@example.com --message "Review please"
```

Send a raw Block Kit payload from a file:

```
slick message send --channel C1234567890 --blocks --file blocks.json
```

Schedule a future send with RFC3339, a Go duration, or Unix seconds (no natural-language times). For an absolute time, set `send_at` to an RFC3339 timestamp within the next 120 days:

```
slick message send --channel C1234567890 --message "Deploy at the chosen time" --schedule "$send_at"
slick message send --channel C1234567890 --message "Deploy in 90 minutes" --schedule 90m
slick message send --user dev@example.com --message "DM follow-up" --schedule 90m
```

### Flags

`message send --filename` (`-N`) is a deprecated compatibility option with no effect. Message text has no filename. Use `file upload --filename` for attachments.

> [!NOTE]
>
> **Flags**
>
> | Flag | Value | Description |
> | --- | --- | --- |
> | `-c`, `--channel` | `<CHANNEL>` | Channel ID, name, or alias |
> | `-u`, `--user` | `<USER>…` | User ID or alias; repeat or comma-separate for group DM |
> | `-m`, `--message` | `<TEXT>` | Message body |
> | `-f`, `--file` | `<FILE>` | Read message body from file or `-` for stdin |
> | `-b`, `--blocks` |  | Treat message source as raw Block Kit JSON |
> | `-s`, `--schedule` | `<WHEN>` | Schedule for future send: RFC3339, Go duration, or Unix seconds |
> | `-n`, `--dry-run` |  | Preview without sending |

> [!NOTE]
>
> **Attribution flags**
>
> Accepted by the four mutating commands (`message send`, `message edit`, `reply`, `file upload`):
>
> | Flag | Value | Description |
> | --- | --- | --- |
> | `--[no-]attribution` |  | Toggle attribution for this command |
> | `--attribution-label` | `<LABEL>` | Override attribution label |
> | `--attribution-emoji` | `<EMOJI>` | Override attribution emoji |
> | `--attribution-message` | `<TEXT>` | Override attribution message |
>
> A custom label appears in the generated caption, including manual runs: `--attribution --attribution-label "Release helper"` produces `Sent via slick (Release helper)`. An explicit `--attribution-message` supplies the caption instead. Emoji overrides change its leading emoji.
>
> The attribution toggles are bare switches. Pass `--attribution` or `--no-attribution`; explicit forms such as `--attribution=false` are rejected. The two switches are mutually exclusive. Presentation overrides do not enable attribution by themselves.

If `default_channel` is set in config, both `--channel` and `--user` can be omitted for immediate sends. Scheduled sends require an explicit `--channel` or `--user` target.

`--user` accepts Slack user IDs, configured aliases, and Slack-profile email addresses resolved via `users.lookupByEmail`. Repeat the flag or comma-separate values to open a group DM. If Slack returns `users_not_found` for an email, that address did not match a Slack user in the active workspace.

Slick trims surrounding whitespace from channel and recipient inputs and stored alias values, including email aliases. Blank alias targets fail locally before authentication or Slack requests. They do not select the default channel. Removing both target flags restores the default for immediate sends; scheduled sends still require an explicit target. Recipient order is preserved.

Slack accepts 1–8 recipient IDs when opening a DM or group DM. Leave out the authenticated user; Slack includes that user automatically. Slack recipient argument errors (`too_many_users`, `not_enough_users`, and `users_list_not_supplied`) return `validation_error` with exit 4. Slick stops before posting or scheduling and does not retry the failed open. Check the recipients before running the command again. See [Slack’s recipient rules](<https://docs.slack.dev/reference/methods/conversations.open/>).

> [!NOTE]
>
> **Accepted `--schedule` formats**
>
> `--schedule` accepts only RFC3339 timestamps, Go durations such as `90m` or `2h30m`, and Unix seconds. It rejects every other format, including natural-language strings such as `tomorrow at 9am`.

Slack schedules in whole Unix seconds. Fractional durations and RFC3339 times are rounded down to that precision before the future and 120-day checks. A value that rounds to the current or an earlier second fails locally, including in dry runs.

Scheduled sends accept either `--channel` or `--user`; scheduled DMs resolve/open the DM before calling the Slack scheduled-message API. Real scheduled `--user` sends return the raw DM or MPIM conversation ID in `data.channel`. Scheduled sends return `scheduled_message_id`, not `ts`, because the Slack API does not assign a message timestamp until the message fires.

### Message sources and raw Block Kit

Use exactly one body source: `--message` for an argument, or `--file` for a file path. `--file -` reads stdin. Paths support `~` and environment variables. Removing `--blocks`, or passing `--blocks=false`, restores Markdown input. Empty or whitespace-only bodies fail locally, including file and stdin input. They do not clear an existing message. Use an explicit raw `[]` to clear blocks.

Raw Block Kit is sent as `blocks` without copying the JSON into Slack's `text` field. Slack can build notification and screen-reader text from supported blocks; see [Slack's accessibility guidance](<https://docs.slack.dev/reference/methods/chat.postMessage/>). Markdown input keeps its readable source as fallback text.

Raw dry runs show the validated plan in `data.message.blocks`, with no invented `data.message.text`. Scheduled raw sends and previews show submitted blocks in `data.blocks` and leave `data.text` empty; these are planned content, not a copy returned by Slack. Unknown JSON fields are omitted from that plan. A scheduled preview keeps `scheduled_message_id` equal to `Q-dry-run`.

An empty raw array clears an existing message's blocks without replacing its fallback text. It cannot create a new message without any blocks. Invalid input and missing files fail before authentication or Slack requests.

### Markdown handling

Markdown converts to Block Kit before posting:

- **Paragraphs** and **headings** render as `section` blocks with mrkdwn text. (Headings do not become Slack `header` blocks — slick treats them as section text so Slack renders them inline with the rest of the message.)
- **Inline links and styles** in paragraphs and headings convert to Slack's syntax: `[label](https://example.com)` becomes a clickable named link, `**bold**` becomes `*bold*`, and `~~old~~` becomes `~old~`. Existing Slack markers such as `*bold*` and `_italic_` stay unchanged. Inline code stays literal. Named links accept HTTP, HTTPS and mailto destinations; unsupported or relative targets stay readable text.
- **Tables** render as native Block Kit `table` blocks. Slack rejects messages containing more than one table block, so slick errors out rather than truncating.
- **Unsupported block-level constructs** — lists, blockquotes, fenced code, raw HTML — are preserved as readable `section` blocks rather than dropped.
- **User content is escaped.** Section-block text passes through [`slack-go/slackutilsx.EscapeMessage`](<https://pkg.go.dev/github.com/slack-go/slack/slackutilsx#EscapeMessage>) before posting: `&` → `&amp;`, `<` → `&lt;`, `>` → `&gt;`. Slack sentinels like `<!channel>`, `<@U…>`, `<#C…>`, `<!subteam^…>`, and the `<url|label>` link pattern in piped content render as literal text instead of firing mentions or forging links. Markdown blockquotes (`> quoted`) and bare URLs (`https://example.com`) still render correctly — Slack decodes the escapes before mrkdwn parsing.

> [!TIP]
>
> **Sending intentional mentions / links**
>
> The escape applies to *every* `< > &` in Markdown source, including sentinels you typed on purpose. To deliberately ping a user, channel, or user-group, bypass the Markdown converter with `--blocks` and use Slack's wire syntax inside your JSON:
>
> ```
> slick lookup user --filter john.doe -o compact | jq -r '.users[0].id'
> # → U123ABC
> printf '%s' '[{"type":"section","text":{"type":"mrkdwn","text":"Deploy failed — <@U123ABC>"}}]' \
>   | slick message send --channel C1234567890 --blocks --file -
> ```
>
> The `--blocks` path is the deliberate-action escape hatch; `<@U…>`, `<#C…>`, `<!subteam^S…>`, and `<url|label>` all work there. Look up IDs with [`lookup user`](<https://matcra587.github.io/slack-cli/lookup/index.md#lookup-user>) / [`lookup channel`](<https://matcra587.github.io/slack-cli/lookup/index.md#lookup-channel>).

### Text limits and message references

Section text supports up to 3,000 Unicode characters; each section field supports up to 2,000. Emoji and non-English text count by character rather than UTF-8 byte length.

Raw Block Kit input can link to an existing message with a `message_mention` element. Keep the timestamp as a string:

```
[{"type":"rich_text","elements":[
  {"type":"rich_text_section","elements":[
    {"type":"text","text":"Review "},
    {"type":"message_mention","channel_id":"C1234567890","message_ts":"1746284582.123456"},
    {"type":"text","text":" before release."}
  ]}
]}]
```

Save the array to `blocks.json`, then pass `--blocks --file blocks.json`. The referenced message must be in a channel the reader can access.

### Output

For real sends, `data.message` uses the message Slack returns, including its stored text, author, and blocks when present. SDK-decoded attachments and files are also preserved when Slack returns them, along with `client_msg_id` and `edited` metadata; slick does not fetch file URLs. Slick does not replace Slack's text with the submitted input. Dry runs describe the planned message instead.

Human output (real send):

```
Message sent channel=C7N2Q8L4P ts=1746284582.123456 permalink=p1746284582123456
```

When Slack metadata is available in human mode, `channel` may render as a friendly clickable label such as `#deployments` or `@johndoe`. Use JSON output for the raw conversation ID plus `channel_name`, `channel_hr`, and `channel_url` metadata.

`--dry-run` — `ts` is the literal `"dry-run"`, no `permalink` is emitted, and `dry_run=true` joins the event:

```
Message sent channel=C7N2Q8L4P ts=dry-run dry_run=true
```

JSON envelope (real send):

```
{
  "ok": true,
  "meta": {
    "command": "message.send",
    "workspace": "default",
    "timestamp": "2026-05-26T03:00:56Z",
    "request_id": "337f5bd1-a5f2-4bb8-8da5-510cb801f62d",
    "exit_code": 0
  },
  "data": {
    "message": {
      "type": "message",
      "text": "Deploy complete",
      "ts": "1746284582.123456",
      "channel": "C7N2Q8L4P",
      "channel_name": "deployments",
      "channel_hr": "#deployments",
      "channel_url": "https://app.slack.com/client/T8KQ42P9D/C7N2Q8L4P"
    },
    "permalink": "https://example.slack.com/archives/C7N2Q8L4P/p1746284582123456",
    "attribution": true
  },
  "errors": []
}
```

JSON data excerpt (`--dry-run`) — no Slack call is made, so `ts` is the literal string `"dry-run"`, `permalink` is absent, and `dry_run: true` joins the data record:

```
{
  "data": {
    "message": {
      "type": "message",
      "text": "Deploy complete",
      "ts": "dry-run",
      "channel": "C7N2Q8L4P",
      "channel_url": "https://app.slack.com/client/T8KQ42P9D/C7N2Q8L4P"
    },
    "dry_run": true,
    "attribution": true
  }
}
```

JSON data excerpt (`--schedule`) — scheduled messages have no `ts` until Slack posts them, so `scheduled_message_id` is the reference for list/delete:

```
{
  "data": {
    "channel": "C1234567890",
    "channel_name": "deployments",
    "channel_hr": "#deployments",
    "channel_url": "https://app.slack.com/client/T8KQ42P9D/C1234567890",
    "scheduled_message_id": "Q123",
    "post_at": 1780340400,
    "post_at_iso": "2026-06-01T19:00:00Z",
    "text": "Deploy tomorrow",
    "attribution": {
      "enabled": true,
      "label": "slick"
    }
  }
}
```

`permalink` is Slack's `chat.getPermalink` HTTP URL in JSON. Human mode renders the short form (`p1746284582123456`) as an OSC 8 terminal hyperlink on supporting terminals.

## message edit

JSON and compact edit results use the SDK-returned text, including an empty string. They do not substitute the requested text. The SDK represents an omitted response text field as empty too. JSON and compact dry runs show the requested text instead.

Edit your own message. The Slack API permits edits only to messages your token identity sent. Configured channel aliases resolve in previews and real edits. Surrounding whitespace is removed from the channel and timestamp; the timestamp otherwise stays an exact string. Pass `--channel` explicitly; edits never use `default_channel`.

```
slick message edit --channel C1234567890 --timestamp 1746284582.123456 --message "Corrected text"
slick message edit --channel C1234567890 --timestamp 1746284582.123456 --message "Updated" --dry-run
```

### Flags

> [!NOTE]
>
> **Flags**
>
> | Flag | Value | Description |
> | --- | --- | --- |
> | `-c`, `--channel` | `<CHANNEL>` | Channel ID, name, or alias |
> | `-t`, `--timestamp` | `<TS>` | Message timestamp |
> | `-m`, `--message` | `<TEXT>` | Message body |
> | `-f`, `--file` | `<FILE>` | Read message body from file or `-` for stdin |
> | `-b`, `--blocks` |  | Treat message source as raw Block Kit JSON |
> | `-n`, `--dry-run` |  | Preview without mutating |

> [!NOTE]
>
> **Attribution flags**
>
> Accepted by the four mutating commands (`message send`, `message edit`, `reply`, `file upload`):
>
> | Flag | Value | Description |
> | --- | --- | --- |
> | `--[no-]attribution` |  | Toggle attribution for this command |
> | `--attribution-label` | `<LABEL>` | Override attribution label |
> | `--attribution-emoji` | `<EMOJI>` | Override attribution emoji |
> | `--attribution-message` | `<TEXT>` | Override attribution message |
>
> A custom label appears in the generated caption, including manual runs: `--attribution --attribution-label "Release helper"` produces `Sent via slick (Release helper)`. An explicit `--attribution-message` supplies the caption instead. Emoji overrides change its leading emoji.
>
> The attribution toggles are bare switches. Pass `--attribution` or `--no-attribution`; explicit forms such as `--attribution=false` are rejected. The two switches are mutually exclusive. Presentation overrides do not enable attribution by themselves.

### Output

Raw `--blocks` input must be a JSON array. Objects, `null`, and blank input fail locally before credentials or Slack requests. New messages, replies, and scheduled messages require at least one block after attribution is applied.

To remove an existing message's blocks while keeping its fallback text, use:

```
slick message edit --channel C1234567890 --timestamp 1746284582.123456 \
  --blocks --message '[]' --no-attribution
```

The edit sends an explicit empty blocks array and leaves text, attachments, and metadata out of the request. `--no-attribution` prevents an attribution block from being added. A dry-run JSON or compact preview shows `blocks: []` without inventing replacement text. Removing `--blocks` returns to Markdown input.

`--dry-run`:

```
Message edited channel=C7N2Q8L4P ts=1746284582.123456 dry_run=true
```

JSON data excerpt (real edit). Slack's `chat.update` does not return a permalink, and slick suppresses `data.message.blocks` even when the edit re-renders Block Kit — verify rendered output via [`history list`](<https://matcra587.github.io/slack-cli/history/index.md#history-list>) or the Slack UI when needed. The `attribution` field is still present:

```
{
  "data": {
    "message": {
      "type": "message",
      "text": "Corrected text",
      "ts": "1746284582.123456",
      "channel": "C1234567890"
    },
    "attribution": true
  }
}
```

## message delete

Delete your own message. Requires `--force` unless you also pass `--dry-run`. Configured channel aliases resolve before both previews and real requests. Surrounding whitespace is removed from the channel and timestamp; the timestamp otherwise stays an exact string. A default channel never supplies a deletion target: pass `--channel` explicitly.

```
slick message delete --channel C1234567890 --timestamp 1746284582.123456 --dry-run
slick message delete --channel C1234567890 --timestamp 1746284582.123456 --force
```

### Flags

| Flag | Value | Description |
| --- | --- | --- |
| `-c`, `--channel` | `<CHANNEL>` | Channel ID, name, or alias |
| `-t`, `--timestamp` | `<TS>` | Message timestamp |
| `-n`, `--dry-run` |  | Preview without mutating |
| `-F`, `--force` |  | Confirm deletion |

### Output

```
Message deleted channel=C7N2Q8L4P ts=1746284582.123456 dry_run=true
```

JSON data excerpt. The timestamp field is `ts`:

```
{
  "data": {"channel": "C7N2Q8L4P", "ts": "1746284582.123456", "dry_run": true}
}
```

The `deleted` field was removed in v0.4.0; the action label conveys success and `errors[]` conveys failure.

## message scheduled list

List pending scheduled messages. Pass `--channel` to narrow the result to one conversation, or omit it to list across conversations. Slack returns pending messages scheduled through `chat.scheduleMessage` with the same token. Messages scheduled in the Slack UI are not included. This authenticated list method has no required OAuth scope; slick does not require `chat:write` to read the list.

```
slick message scheduled list --channel C1234567890 --limit 20 --output=json
slick message scheduled list --cursor <next-cursor> --output=json
```

### Flags

| Flag | Value | Description |
| --- | --- | --- |
| `-c`, `--channel` | `<CHANNEL>` | Channel ID, name, or alias |
| `-C`, `--cursor` | `<CURSOR>` | Pagination cursor |
| `-L`, `--limit` | `<N>` | Messages per page; 0 uses Slack’s default; negative values are rejected |

### Output

Output in a TTY or with `--output=human` renders a table. `CHANNEL` uses a readable `#channel` or `@user` name when Slack metadata is readable, and `DM` marks direct-message conversations:

```
ID           CHANNEL       DM     POST_AT               TEXT
Q123         #deployments  false  2026-06-01T19:00:00Z  Deploy tomorrow
Q124         @johndoe      true   2026-06-01T20:00:00Z  Hello from slick — sched…
```

When there are no pending messages, human output keeps the same action label and adds `count=0`:

```
Scheduled messages retrieved count=0
```

JSON output uses `data.scheduled_messages[]` and cursor metadata:

```
{
  "ok": true,
  "meta": {
    "command": "message.scheduled.list",
    "pagination": {
      "next_cursor": "cur-2",
      "has_more": true,
      "max_items": 20,
      "items_returned": 1
    },
    "exit_code": 0,
    "workspace": "default",
    "timestamp": "2026-05-26T03:00:56Z",
    "request_id": "337f5bd1-a5f2-4bb8-8da5-510cb801f62d"
  },
  "data": {
    "scheduled_messages": [
      {
        "id": "Q123",
        "channel": "C1234567890",
        "channel_name": "deployments",
        "channel_hr": "#deployments",
        "channel_url": "https://app.slack.com/client/T8KQ42P9D/C1234567890",
        "channel_type": "channel",
        "is_dm": false,
        "post_at": 1780340400,
        "post_at_iso": "2026-06-01T19:00:00Z",
        "text_preview": "Deploy tomorrow"
      }
    ],
    "pagination": {
      "next_cursor": "cur-2",
      "has_more": true,
      "max_items": 20,
      "items_returned": 1
    }
  },
  "errors": []
}
```

For automation, use JSON. The human `CHANNEL` value is display-only; pass the raw `data.scheduled_messages[].channel` value back to `message scheduled delete` or to future scheduled sends. JSON also adds optional `channel_name`, `channel_hr`, `channel_url`, `channel_type`, `channel_user`, and `is_dm` fields when metadata can be resolved.

`text_preview` is capped at 200 Unicode characters and ends with `…` when truncated.

## message scheduled delete

Delete a pending scheduled message by exact channel and scheduled-message ID. No `--force` flag is required.

```
slick message scheduled delete --channel C1234567890 --scheduled-id Q123 --dry-run
slick message scheduled delete --channel C1234567890 --scheduled-id Q123 --output=json
```

### Flags

| Flag | Value | Description |
| --- | --- | --- |
| `-c`, `--channel` | `<CHANNEL>` | Channel ID, name, or alias |
| `--scheduled-id` | `<QID>` | Scheduled message ID returned by scheduled send/list |
| `-n`, `--dry-run` |  | Preview without mutating |

JSON data excerpt:

```
{
  "data": {"channel": "C1234567890", "scheduled_message_id": "Q123", "deleted": true}
}
```

## Common errors

`message scheduled delete` returns `not_found` (exit 2) for `invalid_scheduled_message_id`. Slack uses that code for an invalid ID and for a message that has already been sent or deleted. Slack also rejects cancellation within 60 seconds of the scheduled send time. Refresh the scheduled list before choosing another target.

| Error | Cause | Fix |
| --- | --- | --- |
| `validation_error: --channel or --user is required` | No destination given and `default_channel` isn't set in config. | Provide `--channel`/`--user`, or set `default_channel`. |
| `not_in_channel` (`not_found`, exit 2) | App or user is not a member of the channel. | Add the bot to the channel, or use a user token that is a member. |
| `channel_not_found` | Bad channel ID or alias not configured. | Verify with [`lookup channel`](<https://matcra587.github.io/slack-cli/lookup/index.md#lookup-channel>). |
| `user_not_found` | Email or alias did not resolve. | Use a known Slack user ID or verify via [`lookup user`](<https://matcra587.github.io/slack-cli/lookup/index.md#lookup-user>). |
| `cant_update_message` / `cant_delete_message` (`validation_error`, exit 4) | Slack disallows the edit/delete for this token identity. | Use the user token that originally sent the message. |
| Schedule `validation_error` | `--schedule` was in the past, beyond 120 days, or not RFC3339/duration/Unix seconds. | Use a future RFC3339 timestamp, Go duration, or Unix seconds. |
| Raw Block Kit `validation_error` with `data=null` | Malformed JSON, unsupported block types, missing required fields, or Slack limits. | Inspect the `--blocks` JSON; the error envelope describes the rule that failed. |

## See also

- [`reply`](<https://matcra587.github.io/slack-cli/reply/index.md>) — thread replies (separate top-level command).
- [`react`](<https://matcra587.github.io/slack-cli/react/index.md>) — reactions on messages.
- [`history`](<https://matcra587.github.io/slack-cli/history/index.md>) — verify rendered output after edits.
- [`status`](<https://matcra587.github.io/slack-cli/status/index.md>), [`auth`](<https://matcra587.github.io/slack-cli/auth/index.md>), [`config`](<https://matcra587.github.io/slack-cli/config/index.md>).
- Slack API methods: [`chat.postMessage`](<https://docs.slack.dev/reference/methods/chat.postMessage/>), [`chat.update`](<https://docs.slack.dev/reference/methods/chat.update/>), [`chat.delete`](<https://docs.slack.dev/reference/methods/chat.delete/>), [`chat.scheduleMessage`](<https://docs.slack.dev/reference/methods/chat.scheduleMessage/>), [`chat.scheduledMessages.list`](<https://docs.slack.dev/reference/methods/chat.scheduledMessages.list/>), [`chat.deleteScheduledMessage`](<https://docs.slack.dev/reference/methods/chat.deleteScheduledMessage/>).

A missing or invalid Slack acknowledgement returns `server_error` (exit 5). The mutation may already have happened. Slick does not replay it automatically; inspect Slack before deciding whether to try again. Sends require the returned message identifiers, and scheduled sends require the assigned scheduling ID.
