Takes an expr
, evaluates it and sends the output to a Slack
chat destination. Useful for logging, messaging on long compute tasks or
general information sharing.
slackr_msg(
txt = "",
channel = Sys.getenv("SLACK_CHANNEL"),
username = Sys.getenv("SLACK_USERNAME"),
icon_emoji = Sys.getenv("SLACK_ICON_EMOJI"),
bot_user_oauth_token = Sys.getenv("SLACK_BOT_USER_OAUTH_TOKEN"),
...
)slackrMsg(
txt = "",
channel = Sys.getenv("SLACK_CHANNEL"),
username = Sys.getenv("SLACK_USERNAME"),
icon_emoji = Sys.getenv("SLACK_ICON_EMOJI"),
bot_user_oauth_token = Sys.getenv("SLACK_BOT_USER_OAUTH_TOKEN"),
...
)
text message to send to Slack. If a character vector of length > 1 is passed in, they will be combined and separated by newlines.
which channel to post the message to (chr)
what user should the bot be named as (chr)
what emoji to use (chr) ""
will mean use the default
Slack bot user OAuth token
other arguments passed to the Slack API chat.postMessage
call
By default, everything but expr
will be looked for in a "SLACK_
"
environment variable. You can override or just specify these values directly instead,
but it's probably better to call slackrSetup
first.
slackr_setup
, slackr_bot
, dev_slackr
,
save_slackr
, slackr_upload
# NOT RUN {
slackr_setup()
slackr_msg("Hi")
# }
Run the code above in your browser using DataLab