files_slack: Interact with File API

View source: R/generics.R

files_slackR Documentation

Interact with File API

Description

upload/info/list/delete files

Usage

files_slack(
  slack_method = "files.upload",
  ...,
  token = Sys.getenv("SLACK_API_TOKEN"),
  rate_limit
)

Arguments

slack_method

character, method to invoke, Default: 'files.upload'

...

arguments to pass to chat methods

token

Character. Your Slack API token.

rate_limit

Integer. The maximum number of calls to make to this function per minute. If NULL, calls will not be rate-limited. If unset, calls will be limited per the rate limit guides in the Slack api method documentation, if known. Note: If a limit is set for this method in any call in this session, that rate limit will be respected until rate_limit is set to NULL. Default: None.

Details

files methods available to post to

  • files.upload

  • files.delete

  • files.info

  • files.list

For a full list of chat methods see here

Value

httr response

Examples

## Not run: 
files_slack(
  method = 'files.upload',
  channel = "general",
  token = Sys.getenv('SLACK_API_TOKEN'),
  content = 'wow'
)

tf <- tempfile(fileext = '.r')
cat(
  utils::capture.output(utils::sessionInfo()),
  file = tf,
  sep = '\n'
)

files_slack(
  method = 'files.upload',
  channel = "general",
  token = Sys.getenv('SLACK_API_TOKEN'),
  file = tf,
  filename = 'sessionInfo.R',
  filetype = 'r',
  initial_comment = 'here is my session info',
  title = 'R sessionInfo'
)

unlink(tf)


## End(Not run)

yonicd/slackcalls documentation built on March 12, 2023, 4:38 p.m.