4

I'm trying to set up some automatized slack channels. All the content is ready and automation should work but I'm having problems with setting up slackr. There is a nice tutorial on slackr here but it is outdated as slack has changed its token styles.

dcf_file <- "api_token: [Verification Token]
channel: #bot
username: coronapush
incoming_webhook_url: [webhook_url]
write.dcf(dcf_file, file = "slackr.dcf", )
slackr_setup(config_file = "slackr.dcf", echo = T)

However this gives me:

{
  "SLACK_CHANNEL": ["NA"],
  "SLACK_USERNAME": ["NA"],
  "SLACK_ICON_EMOJI": ["NA"],
  "SLACK_INCOMING_URL_PREFIX": ["NA"],
  "SLACK_API_TOKEN": ["NA"]
} 

and

slackr_channels()
NULL

Thx for your help!

1 Answer 1

1

Found my way. You have to create a .txt file called ".xxx" with the following lines:

api_token: xxx
channel: xxx
username: xxx
incoming_webhook_url: xxx

Then slackr_setup(config_file ="[path/]xxx", echo =T) should give you something like this:

{
  "SLACK_CHANNEL": ["#general"],
  "SLACK_USERNAME": ["slackr"],
  "SLACK_ICON_EMOJI": [""],
  "SLACK_INCOMING_URL_PREFIX": [""],
  "SLACK_API_TOKEN": [""]
} 

Most important: slackr_msg() does not work. You have to use slackr_bot(). That is a bit annoying if it takes you forever to find it out like it did for me. Probably you (if you read this far =)) and I should just learn to work with the API directly.

3
  • 1
    Did you ever get slack_bot to post to a channel that the original webhook did not point to? For me it ignores the slack channel argument and just posts directly to me which is how I set up the webhook. Oct 2, 2020 at 21:22
  • I'm having the same issue @LionelDuarte
    – nak5120
    Oct 13, 2020 at 16:19
  • I think you have to set up a new webhook for every channel. Oct 13, 2020 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.