Skip to content

feat(slack): attachment metadata + read-only file download (API + CLI) - #101

Merged
alexeygrigorev merged 1 commit into
mainfrom
feat/slack-attachments
Nov 23, 2026
Merged

alexeygrigorev merged 1 commit into
mainfrom
feat/slack-attachments

Conversation

@alexeygrigorev

Copy link
Copy Markdown
Member

Hub intake 761b08c7-83e0-4f1b-b5bc-6ab5ae41d4b1: read Slack attachments through Dapier.

What

  • slack history / replies / search now return a files list on every message, with minimal metadata only: id, name, title, mimetype, filetype, size, mode, external flag, image dimensions. URLs, thumbnails, previews and the uploader are left out. Existing fields are unchanged.
  • New read-only, operator-gated, audited routes:
    • GET /api/agent/slack/file (slack.file_info)
    • GET /api/agent/slack/file/content (slack.file_download)
  • New CLI commands: dapier slack file-info F… and dapier slack download F… [-o PATH] [--force]. Both accept --channel/--ts and --connection; the default connection is the slack bot.

Safety

  • A file is resolved only from Slack metadata: files.info, or the message named by --channel/--ts. There is no caller-supplied URL.
  • Content is fetched only from https://files.slack.com. Redirects are followed only within that host, and the token is never sent elsewhere. Sign-in HTML is refused, and so is a byte count that does not match Slack's metadata.
  • Files over 4 MiB are refused (413), so the base64 response stays under the 6 MB Lambda/HTTP API limit.
  • Missing scope returns 403. The error names the scope, says whether the token has files:read, and points to --channel/--ts or another connection. No scope or OAuth changes.
  • The CLI checks size and sha256, writes only a basename, will not overwrite without --force, and never prints the content.

Parity

These are read-only operator proxy routes, like the existing dapier slack history/replies/post, which have no console view. Nothing here mutates state, so no console counterpart is needed.

Tests

tests/test_slack_files.py uses synthetic fixtures only (no real files). Targeted run of slack tests locally: 75 passed. CI runs the full suite.

Docs: docs/slack-attachments.md.

history/replies/search now return a minimal, URL-free `files` list per
message. New operator-gated routes GET /api/agent/slack/file and
/api/agent/slack/file/content with CLI `dapier slack file-info` and
`dapier slack download` resolve a file only from Slack metadata
(files.info, or the carrying message via --channel/--ts), fetch it with
the connection token from files.slack.com only (redirects pinned to that
host), refuse sign-in HTML and files over 4 MiB, and report missing
scopes actionably. The CLI verifies size/sha256 and never prints content.

Co-Authored-By: Claude <noreply@anthropic.com>
@alexeygrigorev
alexeygrigorev merged commit 476062d into main Nov 23, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant