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.
Usage
slackr(
...,
channel = Sys.getenv("SLACK_CHANNEL"),
username = Sys.getenv("SLACK_USERNAME"),
icon_emoji = Sys.getenv("SLACK_ICON_EMOJI"),
token = Sys.getenv("SLACK_TOKEN"),
thread_ts = NULL,
reply_broadcast = FALSE
)
Arguments
- ...
expressions to be sent to Slack.
- channel
Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See the chat.postMessage endpoint documentation for details.
- username
what user should the bot be named as (chr).
- icon_emoji
what emoji to use (chr)
""
will mean use the default.- token
Authentication token bearing required scopes.
- thread_ts
Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
- reply_broadcast
Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to FALSE.
Details
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 slackr_setup()
first.
Note
You need a https://www.slack.com account and will also need to set up an API token https://api.slack.com/
Examples
if (FALSE) { # \dontrun{
slackr_setup()
slackr("iris info", head(iris), str(iris))
} # }