file/get
Retrieve metadata for a single file stored in your Slack workspace by its file ID. Returns details such as file name, size, type, uploader identity, and upload timestamp.
When to Use
- Retrieve file metadata to populate an audit trail record in an external system.
- Verify a file exists and is accessible before generating a shareable link for downstream processing.
- Get the original uploader's user ID for attribution in a compliance report.
- Check a file's MIME type before routing it to the correct processing pipeline.
- Fetch file size to validate storage capacity before archiving large files externally.
Configuration
Connection
| Field | Required | Description |
botToken | Required | Slack Bot Token starting with xoxb-. Must have the files:read OAuth scope to retrieve file metadata. |
Operation Fields
| Field | Required | Description |
fileId | Required | The Slack file identifier, always starting with F (e.g. F08ABCDEFGH). Typically captured from a previous file/upload node output or from a Slack event payload. |
Sample Configuration
{
"operation": "file/get",
"connection": {
"botToken": "{{ $credentials.slackBot.token }}"
},
"fileId": "{{ $output.uploadReport.fileId }}"
}
Validation Errors
| Error Code | Cause | Resolution |
file_not_found | No file with the given fileId exists, or the bot does not have visibility of the file. | Confirm the file ID is correct and the bot is in at least one channel where the file was shared. |
invalid_auth | The bot token is invalid or has been revoked. | Regenerate the token in your Slack App settings and update the stored credential. |
missing_scope | Bot token lacks the files:read scope. | Add files:read under OAuth & Permissions in your Slack App and reinstall. |
file_deleted | The file existed but has been deleted (free workspace age limit or manual deletion). | Handle via the error port and log or notify as appropriate. |
Output
Success Port
| Field | Type | Description |
fileId | string | The Slack file identifier (echoed from input). |
fileName | string | The name of the file as stored in Slack. |
fileSize | number | File size in bytes. |
fileType | string | Slack file type string (e.g. pdf, csv, png). |
uploadedBy | string | User ID of the workspace member who uploaded the file. |
uploadedTimestamp | number | Unix timestamp (seconds) when the file was uploaded. |
status | string | "success" on successful retrieval. |
errorCode | string | Empty on success. Contains the Slack API error code on failure. |
payload | object | Full raw Slack API response for advanced field access. |
Error Port
Activated when the file is not found, has been deleted, or the token lacks read permissions. Inspect errorCode to distinguish between not-found and access-denied scenarios.
Sample Output
{
"fileId": "F08XYZ12345",
"fileName": "monthly-sales-report.pdf",
"fileSize": 204800,
"fileType": "pdf",
"uploadedBy": "U01UPLOADER",
"uploadedTimestamp": 1748221200,
"status": "success",
"errorCode": "",
"payload": {
"ok": true,
"file": {
"id": "F08XYZ12345",
"name": "monthly-sales-report.pdf",
"mimetype": "application/pdf",
"size": 204800,
"user": "U01UPLOADER",
"created": 1748221200,
"permalink": "https://yourworkspace.slack.com/files/U01UPLOADER/F08XYZ12345/monthly-sales-report.pdf"
}
}
}
Expression Reference
| Expression | Result |
{{ $output.getFile.fileId }} | Slack file ID for use in downstream nodes. |
{{ $output.getFile.fileName }} | File name for display in confirmation messages. |
{{ $output.getFile.fileSize }} | File size in bytes for capacity or validation checks. |
{{ $output.getFile.fileType }} | File type string for routing to the correct processing pipeline. |
{{ $output.getFile.uploadedBy }} | User ID of the uploader for attribution or notification. |
{{ $output.getFile.uploadedTimestamp | date:'yyyy-MM-dd' }} | Formatted upload date for audit records. |
Node Policies & GuardRails
| Policy Area | Recommendation |
| Scope Minimization | Use a token with only files:read for read-only metadata operations. Do not reuse upload tokens for read-only flows. |
| Error Handling | Always wire the error port. A file_not_found error may indicate a deleted file; log and notify rather than failing the entire workflow. |
| Free Workspace Retention | Files on free workspaces may be purged after 90 days. If file_deleted is received for a recent file ID, check workspace plan limits. |
| Sensitive File Access | Be aware that retrieving file metadata does not check channel-level visibility for all bots. Confirm the bot has been added to the channel where the file was shared. |
| Permalink Usage | The payload.file.permalink URL requires authentication. Do not share it publicly or embed it in unauthenticated systems. |
Examples
Verify File Before Generating a Shareable Reference
Before creating a message that references an uploaded file, confirm it exists and retrieve its display name.
{
"operation": "file/get",
"fileId": "{{ $trigger.event.fileId }}"
}
Audit Trail — Capture Uploader and Timestamp
After a file upload event, fetch metadata and write the uploader ID and timestamp to an external audit database.
{
"operation": "file/get",
"fileId": "{{ $trigger.slackEvent.file_id }}"
}
// Then in WriteAuditRecord node:
// uploadedBy: {{ $output.getFile.uploadedBy }}
// uploadedAt: {{ $output.getFile.uploadedTimestamp }}
Route by File Type
Fetch file metadata then use a branch node to route PDFs to a compliance archive and CSVs to a data pipeline.
{
"operation": "file/get",
"fileId": "{{ $input.fileId }}"
}
// Branch condition: {{ $output.getFile.fileType }} == "pdf"