R/create_slack_channel.R

Defines functions create_slack_channel

Documented in create_slack_channel

#' Create a new slack channel
#'
#' @param channel channel name
#' @param token slack API token
#'
#' @return channel name as character
#' @export
#'
create_slack_channel <- function(channel,token=Sys.getenv("SLACK_API_TOKEN")){

  res <- httr::POST(url="https://slack.com/api/conversations.create",
                    body=list( token=token,
                               name=tolower(channel)))
  # print(httr::content(res))
  # Sys.sleep(1)
  invisible(channel)
}
VincentGuyader/slack documentation built on July 6, 2023, 2:21 p.m.