Slack v0.23.5 Slack.Web.Files View Source
Link to this section Summary
Functions
Deletes a file
Gets information about a team file
Lists & filters team files
Revokes public/external sharing access for a file
Enables a file for public/external sharing
Uploads or creates a file
Link to this section Functions
delete(file, optional_params \\ %{}) View Source
Deletes a file.
Required Params
file
- ID of file to delete.
Errors the API can return:
cant_delete_file
- Authenticated user does not have permission to delete this file.file_deleted
- The file has already been deleted.file_not_found
- The file does not exist, or is not visible to the calling user.
info(file, optional_params \\ %{}) View Source
Gets information about a team file.
Required Params
file
- Specify a file by providing its ID. ex:F2147483862
Errors the API can return:
file_deleted
- The requested file has been deletedfile_not_found
- Value passed forfile
was invalid
list(optional_params \\ %{}) View Source
Lists & filters team files.
Optional Params
channel
- Filter files appearing in a specific channel, indicated by its ID.ts_from
- Filter files created after this timestamp (inclusive). ex:123456789
ts_to
- Filter files created before this timestamp (inclusive). ex:123456789
types
- Filter files by type:all
- All filesposts
- Postssnippets
- Snippetsimages
- Image filesgdocs
- Google docszips
- Zip filespdfs
- PDF files
You can pass multiple values in the types argument, like types=posts,snippets
.The default value is all
, which does not filter the list. ex: images
user
- Filter files created by a single user.
Errors the API can return:
unknown_type
- Value passed fortypes
was invaliduser_not_found
- Value passed foruser
was invalid
revoke_public_url(file, optional_params \\ %{}) View Source
Revokes public/external sharing access for a file
Required Params
file
- File to revoke
Errors the API can return:
file_not_found
- Value passed forfile
was invalid
upload(file, filename, optional_params \\ %{}) View Source
Uploads or creates a file.
Required Params
file
- File contents viamultipart/form-data
. ex:...
filename
- Filename of file. ex:foo.txt
Optional Params
channels
- Comma-separated list of channel names or IDs where the file will be shared.content
- File contents via a POST var. ex:...
filetype
- Slack-internal file type identifier. ex:php
initial_comment
- Initial comment to add to file. ex:Best!
title
- Title of file. ex:My File
Errors the API can return:
invalid_channel
- One or more channels supplied are invalidposting_to_general_channel_denied
- An admin has restricted posting to the #general channel.