Giter Site home page Giter Site logo

slackr's Introduction

CRAN_Status_Badge

slackr - a package to send full & webhook API messages to Slack.com channels/users

Slackr contains functions that make it possible to interact with the Slack messaging platform. When you need to share information/data from R, rather than resort to copy/paste in e-mails or other services like Skype, you can use this package to send well-formatted output from multiple R objects and expressions to all teammates at the same time with little effort. You can also send images from the current graphics device, R objects (as RData), and upload files.

News

  • Version 1.3.1.9001 Forgot bind_rows in pkg imports
  • Version 1.3.1.9000 Removed data.table dependency (replaced with dplyr); added access to im.list (https://api.slack.com/methods/im.list) thx to PR from Quinn Weber
  • Version 1.3.0.9000 Radically changed how slackr works. Functions have camelCase and under_score versions
  • Version 1.2.3 added more parameter error cheking, remobved the need for ending ? on webhook URL and added defaults for missing setup parameters.
  • Version 1.2.2 fixed issue (bug in 1.2.1 fix)
  • Version 1.2.1 fixed issue when there are no private groups defined
  • Version 1.2 re-introduced ggslackr() (first CRAN version)
  • Version 1.1.1 fixed a bug in the new full API slackr() function
  • Version 1.1 added graphics & files capability
  • Version 1.0 released

Many thanks to:

for their contributions to the package!

The following functions are implemented:

  • slackr_setup : initialize necessary environment variables
  • slackr : send stuff to slack.com (full API token - i.e. not wehbook - required)
  • slackr_bot : send stuff to slack.com using the incoming webhook API/token
  • dev_slackr : send the graphics contents of the current device to a to slack.com channel (full API token - i.e. not wehbook - required)
  • ggslackr : send a ggplot object to a slack.com channel (no existing device plot required, useful for scripts) (full API token - i.e. not wehbook - required)
  • save_slackr : save R objects to an RData file on slack.com (full API token - i.e. not wehbook - required)
  • slackr_upload : upload any file to slack.com (full API token - i.e. not wehbook - required)
  • slackrUsers : get a data frame of slack.com users (full API token - i.e. not wehbook - required)
  • slackrChannels : get a data frame of slack.com channels (full API token - i.e. not wehbook - required)
  • slackrGroups : get a data frame of slack.com groups (full API token - i.e. not wehbook - required)

The slackr_setup() function will try to read setup values from a ~/.slackr (you can change the default) configuration file, which may be easier and more secure than passing them in manually (plus, will allow you to have multiple slackr configs for multiple Slack.com teams). The file is in Debian Control File (DCF) format since it really doesn't need to be JSON and R has a handy read.dcf() function since that's what DESCRIPTION files are coded in. Here's the basic format for the configuration file:

token: YOUR_INCOMING_WEBHOOK_TOKEN
channel: #general
username: slackr
incoming_webhook_url: https://YOUR_TEAM.slack.com/services/hooks/incoming-webhook?
api_token: YOUR_FULL_API_TOKEN

You can also change the default emoji icon (from the one you setup at integration creation time) with icon_emoji.

Installation

# stable/CRAN
install.packages("slackr")

# bleeding edge
devtools::install_github("hrbrmstr/slackr")

Usage

library(slackr)

# current verison
packageVersion("slackr")


slackrSetup(channel="#code", 
            url_prefix="http://myslack.slack.com/services/hooks/incoming-webhook?")

slackr(str(iris))

# send images
library(ggplot2)
qplot(mpg, wt, data=mtcars)
dev.slackr("#results")

barplot(VADeaths)
dev.slackr("@jayjacobs")

ggslackr(qplot(mpg, wt, data=mtcars))

Test Results

library(slackr)
library(testthat)

date()
#> [1] "Thu Jul 30 17:55:48 2015"

test_dir("tests/")
#> testthat results ========================================================================================================
#> OK: 0 SKIPPED: 0 FAILED: 0
#> 
#> DONE

slackr's People

Contributors

hrbrmstr avatar jefferis avatar qsweber avatar uribo avatar konradjk avatar

Watchers

Adam Brady avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.