-
Notifications
You must be signed in to change notification settings - Fork 5
Add Slack file upload APIs #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements Slack's external file upload workflow, enabling modules to upload files to Slack channels through a three-step process: obtaining an upload URL, uploading file content, and completing the upload.
Key Changes:
- Added three new STL functions (
get_file_upload_url,upload_file,complete_file_upload) to support the complete file upload flow - Implemented runtime methods with proper HTTP request handling and error management for each upload step
- Registered new functions in the runtime's function registry with appropriate test mode restrictions
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| runtime/plaid/src/functions/api.rs | Registers the new Slack file upload functions in the runtime's function registry |
| runtime/plaid/src/apis/slack/api.rs | Implements the runtime methods for handling file upload requests with proper HTTP clients and error handling |
| runtime/plaid-stl/src/slack/mod.rs | Defines STL public API functions and data structures for the file upload workflow |
Comments suppressed due to low confidence (1)
runtime/plaid/src/apis/slack/api.rs:1
- The documentation comment for
lengthhas inconsistent punctuation compared to other fields. Thebotfield comment doesn't end with a period, whilelengthandfilenamedo. Consider removing the period fromlengthandfilenamecomments for consistency, or add one to thebotcomment.
use std::sync::Arc;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if !p.url.starts_with("https://files.slack.com/upload") { | ||
| return Err(ApiError::BadRequest); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love us passing information to the rule which we then need to re-verify. Should this just be abstracted behind a single API that uploads a file? What would be the use case for rules to do these individually?
Summary
Implements support for Slack's external file upload workflow, which allows modules to upload files to Slack channels using the
files.getUploadURLExternal, file upload, andfiles.completeUploadExternalAPIs. This provides a complete three-step file upload flow: obtaining an upload URL, uploading the file content, and finalizing the upload to share in channels.Changes
get_file_upload_url,upload_file, andcomplete_file_uploadfunctions inplaid-stl/src/slack/mod.rsget_file_upload_url,upload_file, andcomplete_file_uploadmethods inruntime/plaid/src/apis/slack/api.rswith proper error handling and HTTP client integration