Slack.Web.Files.Remote (SlackKit v1.0.0-alpha.0)

View Source

Summary

Functions

Retrieve information about a remote file added to Slack

Retrieve information about a remote file added to Slack

Remove a remote file.

Share a remote file into a channel.

Updates an existing remote file.

Functions

add(external_id, external_url, title, optional_params \\ %{})

Adds a file from a remote service

API reference

Rate limit: Tier 2: 20+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • external_id - Creator defined GUID for the file. ex: 123456
  • external_url - URL of the remote file. ex: http://example.com/my_cloud_service_file/abc123
  • title - Title of the file being shared. ex: Danger, High Voltage!

Optional Params

  • filetype - type of file ex: doc
  • indexable_file_contents - A text file (txt, pdf, doc, etc.) containing textual search terms that are used to improve discovery of the remote file. ex: ...
  • preview_image - Preview of the document via multipart/form-data. ex: ...

Errors the API can return:

  • bad_image - The uploaded image could not be processed - try passing a JPG or PNG
  • bad_title - The title provided is too long.
  • bot_user_required - bot user token is required
  • invalid_external_id - The external_id provided is too long.
  • too_large - The uploaded image had excessive dimensions

See the Common Errors guide for errors returned by every Web API method.

info(optional_params \\ %{})

Retrieve information about a remote file added to Slack

API reference

Rate limit: Tier 2: 20+ per minute
Scopes:

View on docs.slack.dev ↗

Optional Params

  • external_id - Creator defined GUID for the file. ex: 123456
  • file - Specify a file by providing its ID. ex: F2147483862

Errors the API can return:

  • file_not_found - Value passed for file or external_id was invalid
  • invalid_args - Invalid arguments passed to endpoint
  • no_bot_user_for_app - Cannot call the Remote Files endpoints unless app has associated bot user
  • too_many_ids - The request specified both an external_id and a file, only one may be specified

See the Common Errors guide for errors returned by every Web API method.

list(optional_params \\ %{})

Retrieve information about a remote file added to Slack

API reference

Rate limit: Tier 2: 20+ per minute
Scopes:

View on docs.slack.dev ↗

Optional Params

  • channel - Filter files appearing in a specific channel, indicated by its ID.
  • cursor - Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail. ex: dXNlcjpVMDYxTkZUVDI=
  • limit - The maximum number of items to return. ex: 20
  • ts_from - Filter files created after this timestamp (inclusive). ex: 123456789
  • ts_to - Filter files created before this timestamp (inclusive). ex: 123456789

Errors the API can return:

  • invalid_cursor - Value passed for cursor was not valid or is no longer valid.
  • no_bot_user_for_app - Cannot call the Remote Files endpoints unless app has associated bot user

See the Common Errors guide for errors returned by every Web API method.

remove(optional_params \\ %{})

Remove a remote file.

API reference

Rate limit: Tier 2: 20+ per minute
Scopes:

View on docs.slack.dev ↗

Optional Params

  • external_id - Creator defined GUID for the file. ex: 123456
  • file - Specify a file by providing its ID. ex: F2147483862

Errors the API can return:

  • bot_user_required - bot user token is required
  • file_not_found - Value passed for file or external_id was invalid
  • file_under_review - File passed is tombstoned for DLP review
  • invalid_args - Invalid arguments passed to endpoint
  • too_many_ids - The request specified both an external_id and a file, only one may be specified

See the Common Errors guide for errors returned by every Web API method.

share(channels, optional_params \\ %{})

Share a remote file into a channel.

API reference

Rate limit: Tier 2: 20+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • channels - Comma-separated list of channel IDs where the file will be shared.

Optional Params

  • external_id - The globally unique identifier (GUID) for the file, as set by the app registering the file with Slack. Either this field or file or both are required. ex: 123456
  • file - Specify a file registered with Slack by providing its ID. Either this field or external_id or both are required. ex: F2147483862

Errors the API can return:

  • channel_not_found - At least one of the values passed for channels was invalid.
  • file_not_found - No file with the requested ID found.
  • invalid_args - Invalid arguments passed to endpoint
  • no_bot_user_for_app - Cannot call the Remote Files endpoints unless app has associated bot user
  • not_in_channel - Authenticated user is not in at least one of the the provided channels.

See the Common Errors guide for errors returned by every Web API method.

update(optional_params \\ %{})

Updates an existing remote file.

API reference

Rate limit: Tier 2: 20+ per minute
Scopes:

View on docs.slack.dev ↗

Optional Params

  • external_id - Creator defined GUID for the file. ex: 123456
  • external_url - URL of the remote file. ex: http://example.com/my_cloud_service_file/abc123
  • file - Specify a file by providing its ID. ex: F2147483862
  • filetype - type of file ex: doc
  • indexable_file_contents - File containing contents that can be used to improve searchability for the remote file. ex: ...
  • preview_image - Preview of the document via multipart/form-data. ex: ...
  • title - Title of the file being shared. ex: Danger, High Voltage!

Errors the API can return:

  • bad_image - The uploaded image could not be processed - try passing a JPG or PNG
  • bot_user_required - bot user token is required
  • failed_to_unshare - The file was either not found or it has been unshared already.
  • file_not_found - Could not find the file to update.
  • invalid_title - invalid title provided
  • invalid_type - invalid type provided
  • invalid_url - invalid url provided
  • too_large - The uploaded image had excessive dimensions

See the Common Errors guide for errors returned by every Web API method.