edit_slackr: edit a message on a slack channel. Calls the chat.update...

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/edit_slackr.R

Description

edit a message on a slack channel. Calls the chat.update method on the Slack Web API. Information on this method can be found here: https://api.slack.com/methods/chat.update

Usage

1
2
3
4
5
edit_slackr(text, pattern = NULL, idx = 1, hs = NULL, ...,
  preformatted = TRUE, channel = Sys.getenv("SLACK_CHANNEL"),
  username = Sys.getenv("SLACK_USERNAME"),
  icon_emoji = Sys.getenv("SLACK_ICON_EMOJI"),
  api_token = Sys.getenv("SLACK_API_TOKEN"))

Arguments

text

The character vector to be posted

pattern

Filter messages by regex (grepl), Default: NULL

idx

Index of message to edit (descending order), Default: 1

hs

History of slack channel (if NULL a request to slacka api will be made), Default=NULL

...

Optional arguments such as: as_user, 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

api_token

your full Slack API token

Value

httr response object (invislbly)

Note

You can pass in add_user=TRUE as part of the ... parameters and the Slack API will post the message as your logged-in user account (this will override anything set in username)

Author(s)

Jonathan Sidi [aut]

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
slackr_setup()

text_slackr('hello world')
text_slackr('hello new world')

edit_slackr('another new world')
edit_slackr('goodbye new world',pattern='world',idx=2)


## End(Not run)

hrbrmstr/slackr documentation built on May 18, 2018, 4:19 p.m.