#OpenCaw won't send files to a slack request

1 messages · Page 1 of 1 (latest)

nocturne reef
#

I have integrated slack into the openclaw channels, gave all the needed scopes including file:write. I have a skill that generates reports successfully, but then is not being able to send the slack message with the file attached.

swift shaleBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> âś… Mark Solution

steady hollyBOT
#

A few common gotchas with Slack file sending in OpenClaw — if you answer the questions below we can narrow it down fast.

0) First: what’s the exact error + version?

  1. openclaw --version
  2. Paste the gateway log line / stack trace you get when it tries to send the attachment (even 10–20 lines is fine).

Without the error text we’re guessing between 3–4 different failure modes.

1) Scope name + reinstall (super common)

Slack’s scope is files:write (plural). I’ve seen people accidentally use/remember it as file:write.

Also: after changing scopes you must reinstall the Slack app to the workspace, otherwise your xoxb-... token won’t actually have the new scopes.

Docs (scope checklist): https://docs.openclaw.ai/channels/slack

2) Bot must be in the channel you’re sending to

Even with chat:write / files:write, Slack will return errors like not_in_channel if the bot/app isn’t invited to that channel (especially private channels).

#

3) Make sure you’re sending media the “OpenClaw way”

Outbound attachments from an agent reply require a standalone line like:

MEDIA:/path/to/report.pdf

(or use the CLI/tooling equivalent --media ...).

FAQ section: https://docs.openclaw.ai/help/faq#my-skill-generated-an-imagepdf-but-nothing-was-sent

4) Local file path must be inside allowed “media roots”

OpenClaw restricts what local paths it will read for outbound uploads. If your report is written somewhere random (e.g. ~/reports/...), the upload can fail even though the file exists.

Best fix: write the report into the agent workspace or OpenClaw state/tmp area (instead of an arbitrary folder), then attach that path.

5) Size limits (PDFs bite here)

#

Slack uploads go through OpenClaw’s media caps too. If your report is large, set:

  • channels.slack.mediaMaxMb: <number>

Docs mention this under Slack media behavior: https://docs.openclaw.ai/channels/slack

Quick isolation test (recommended)

Try a direct CLI send (this bypasses your skill logic):

openclaw message send --channel slack --target channel:C12345678 \
  --message "test upload" --media /path/to/report.pdf
  • If this fails, it’s Slack token/scopes/channel membership/size/path.
  • If this works, the issue is how the skill constructs the reply (missing MEDIA: line, wrong path, etc.).
#

Send the error text + where the file is written (full path + size), and I’ll tell you which of the above it is.

nocturne reef
#

Maybe the point 4 is the issue. I have a skill for generating reports, it creates and stores them but they are not being uploaded i think because it can't access the files where it stored them. How i can check and fix this out ?

steady hollyBOT
#

Yep, that very often is the issue.

OpenClaw will not upload arbitrary local paths for security reasons. When sending MEDIA:... (or --media ...) it only allows files under a small set of “safe roots” (agent workspace, OpenClaw state dirs, OpenClaw temp dir, sandbox dirs). If your report generator writes to something like /tmp/report.pdf or ~/Downloads/..., Slack upload will fail.

Also quick correction: Slack’s scope is files:write (plural), not file:write — and you need to reinstall the Slack app after changing scopes.

How to check what’s failing (2 quick ways)

A) Easiest: reproduce with the CLI (you’ll get the real error)

On the machine where the Gateway runs:

openclaw message send --channel slack --target channel:YOUR_CHANNEL_ID \
  --message "test upload" --media /absolute/path/to/your/report.pdf

If the path is blocked you’ll see something like:

#
  • LocalMediaAccessError: path-not-allowed
    or if it’s the wrong machine/path:
  • Local media file not found

B) Check the gateway log for the exact error

Default log location:

tail -n 200 "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/logs/gateway.log" | rg -i "slack|upload|media|LocalMediaAccessError|path-not-allowed|not found"

What paths are “safe” to write to?

Best fix: write the report into the agent workspace.

Find your workspace:

#
openclaw config get agents.defaults.workspace

Default is usually: ~/.openclaw/workspace

Then change your skill/report script to write to e.g.:

  • ~/.openclaw/workspace/reports/report.pdf

…and in the agent reply, attach it as either:

MEDIA:reports/report.pdf

(or absolute path, if you prefer)