Skip to content

Instantly share code, notes, and snippets.

@russellpierce
Created September 10, 2016 21:29
Show Gist options
  • Save russellpierce/adc05f5ca26a5ae75477ccbd7991b44b to your computer and use it in GitHub Desktop.
Save russellpierce/adc05f5ca26a5ae75477ccbd7991b44b to your computer and use it in GitHub Desktop.
Use Zapier to Send a Slack Message
#' Send a message to Slack
#'
#' To use, set options(zapier_slack_webhook="yourZapierPostWebhookHere")
#'
#' @param message
#' @param channel
#' @param bot_name
#' @param bot_icon_url
#' @param image_url
#' @param emoji
#'
#' @return
#' @export
send_slack_message <- function(
message = "",
channel = "#testing",
bot_name = NULL,
bot_icon_url = NULL,
image_url = NULL,
emoji = NULL
) {
httr::POST(
url = getOption('zapier_slack_webhook'),
body = list(
message = message,
channel = channel,
bot_name = bot_name,
bot_icon_url = bot_icon_url,
image_url = image_url,
emoji = emoji),
encode = "json")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment