File Storage Command Guide
Learn how to use the /filestorage slash command
Why Use File Storage?
The file storage system provides a simple yet powerful way to store and manage files with features like:
- Simple File Management: Store and retrieve files using unique filenames
- Flexible Content Types: Store any type of content, from JSON to plain text
- Custom Metadata: Add descriptive information to your files
- Expiring Links: Control file access with configurable expiration periods
- File History: Track file changes and access through detailed logs
- Append Capability: Add content to existing files without replacement
Common Use Cases
- Store configuration files with version tracking
- Maintain system logs with append functionality
- Manage documents with rich metadata
- Share files with controlled access periods
- Track file access and modifications
Notice about Race Conditions
There is no race condition prevention in place. If you have multiple automations that are trying to write to the same file, you will experience unexpected results.
Basic Usage from Slash Command
The /filestorage
command lets you create, read, update, and delete files in the storage system. After typing /filestorage
, you can specify your action and options in natural language.
Basic Usage from Filestorage UI
In the left nav, click “File Storage” where you’ll see a list of files that you’ve created through your automations or directly via the UI. Click Upload to upload a new file.
File Storage Fundamentals
Important Rules
- Each file must have a unique filename
- Files can include optional metadata
- File links can be set to expire after 1-7 days or made public
- Content can be appended to existing files
- File access history is automatically tracked
Real-World Example
Perhaps you want to store an email template for use across your automations. You could write a file with the following slash command:
Now you can use the file in your automations. To retrieve it you would write a prompt like this:
/filestorage retrieve contents of file welcome-email-template.json from file storage
Note that the reason I set file_links_expire_in_days to 1 is because that expiry is related to the signed URL that Pinkfish generates for you to access the file. And I only need it to be accessible for the duration of the Automation run.
Command Options
Creating Files
Basic syntax:
Available Options
Required Fields
filename
: (Required) Unique identifier for your filecontent
: (Required) The content to store in the file
Optional Fields
-
metadata
: Additional information about the file -
file_links_expire_in_days
: Control how long file links remain valid
Real-World Examples
- Configuration Management
- System Logging
- Document Storage
Managing Files
Creating Files
Note that if you create a file with the same name as an existing file, it will overwrite the existing file.
Updating Files
Append to existing file:
Reading Files
Get file metadata only:
Get file content and metadata:
List all files with full details including metadata and signedUrls:
List files files with minimal results (filename / filepath, date created):
Deleting Files
Best Practices
-
Filenames
- Use descriptive, meaningful names
- Include dates for time-sensitive files
- Follow a consistent naming convention
- Avoid special characters
-
Metadata
- Include version information
- Add context about the file’s purpose
- Track who created or modified the file
- Document any dependencies
-
File Access
- Use appropriate expiration periods
- Set longer expiration for frequently accessed files
- Use “never” expiry only when necessary
- Regularly review public files
-
Content Management
- Keep file sizes reasonable
- Use append for logs and similar data
- Regular cleanup of outdated files
- Maintain backup copies of critical files
-
Security
- Review access logs regularly
- Use shortest practical expiration periods
- Don’t store sensitive data
File Access and Security
Access Control
- Files are accessible via signed URLs
- URLs expire based on the
file_links_expire_in_days
setting - Access history is maintained in the
accessList
Monitoring and Tracking
- Each file maintains an access log
- Log entries include:
- Action performed
- Provider ID (user id)
- Timestamp
- Full history available through metadata endpoint