Learn R Programming

slackr (version 2.3.0)

text_slackr: text_slackr

Description

Sends basic text to a slack channel. Calls the chat.postMessage method on the Slack Web API. Information on this method can be found here: https://api.slack.com/methods/chat.postMessage

Usage

text_slackr(
  text,
  ...,
  preformatted = TRUE,
  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")
)

Arguments

text

The character vector to be posted

...

Optional arguments such as: parse, unfurl_links, etc.

preformatted

Should the text be sent as preformatted text. Defaults to TRUE

channel

The name of the channels to which the DataTable should be sent. Prepend channel names with a hashtag. Prepend private-groups with nothing. Prepend direct messages with an @

username

what user should the bot be named as (chr)

icon_emoji

what emoji to use (chr) "" will mean use the default

bot_user_oauth_token

your full Slack bot user OAuth token

Value

httr response object (invisibly)

References

https://github.com/mrkaye97/slackr/pull/11

See Also

https://api.slack.com/methods/chat.postMessage

Examples

Run this code
# NOT RUN {
slackr_setup()
text_slackr("hello world", as_user = TRUE)
# }

Run the code above in your browser using DataLab