Slack v0.23.5 Slack.Web.Files View Source

Link to this section Summary

Functions

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

Link to this section Functions

Link to this function

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.
Link to this function

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 deleted
  • file_not_found - Value passed for file was invalid
Link to this function

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 files

  • posts - Posts

  • snippets - Snippets

  • images - Image files

  • gdocs - Google docs

  • zips - Zip files

  • pdfs - 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 for types was invalid
  • user_not_found - Value passed for user was invalid
Link to this function

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 for file was invalid
Link to this function

shared_public_url(file, optional_params \\ %{}) View Source

Enables a file for public/external sharing.

Required Params

  • file - File to share

Errors the API can return:

  • file_not_found - Value passed for file was invalid
  • not_allowed - Public sharing has been disabled for this team
Link to this function

upload(file, filename, optional_params \\ %{}) View Source

Uploads or creates a file.

Required Params

  • file - File contents via multipart/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 invalid
  • posting_to_general_channel_denied - An admin has restricted posting to the #general channel.