Sam Gilbert
Sam Gilbert

Reputation: 1702

Unable to send files to slack from R using slackrUpload

I am trying to use slackr package to push messages and files from R to slack.

I am able to send messages successfully using slackr, but have been unable to get the function slackrUpload working. Any suggestions would be appreciated

I first set up an incoming webhook in slack. I was then able to get the below working (this sends "Test message" to the channel "solutions":

> library(slackr)

> slackrSetup(channel = "#solutions",
              icon_emoji = ":information_source:",
              incoming_webhook_url ="https://hooks.slack.com/services/T.../B.../I...",
              api_token = "...-...-...")

> slackr("Test message")

...but when I try to use slackrUpload the function errors:

> html_file <- "url_path/checks.html"

> slackrUpload(filename = html_file)

Error returned:

Error in data.frame(id = x$id, name = x$name, real_name = x$real_name) : 
  arguments imply differing number of rows: 1, 0

(I have tested that the path to the html is correct)

R Session information:

> sessionInfo()
R version 3.2.1 RC (2015-06-10 r68509)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] slackr_1.2       ggplot2_2.1.0    data.table_1.9.6 jsonlite_0.9.19  httr_1.1.0      

loaded via a namespace (and not attached):
 [1] colorspace_1.2-6 scales_0.4.0     plyr_1.8.3       R6_2.1.2         tools_3.2.1      gtable_0.2.0     curl_0.9.6       Rcpp_0.12.3      grid_3.2.1       chron_2.3-47     munsell_0.4.3 

Upvotes: 0

Views: 583

Answers (1)

griverorz
griverorz

Reputation: 697

It seems to be a common issue with old versions of slackr. Upgrading to at least 1.2.3 should fix the problem.

Upvotes: 1

Related Questions