Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yonicd/slackblocks

Slack Blocks in R
https://github.com/yonicd/slackblocks

r slack slackapi

Last synced: about 2 months ago
JSON representation

Slack Blocks in R

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# slackblocks

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![Covrpage Summary](https://img.shields.io/badge/covrpage-Last_Build_2023_02_27-brightgreen.svg)](http://tinyurl.com/tf2xf4d)
[![R-CMD-check](https://github.com/yonicd/slackblocks/actions/workflows/r-cmd-check.yml/badge.svg)](https://github.com/yonicd/slackblocks/actions/workflows/r-cmd-check.yml)
[![Codecov test coverage](https://codecov.io/gh/yonicd/slackblocks/branch/master/graph/badge.svg)](https://codecov.io/gh/yonicd/slackblocks?branch=master)

`slackblocks` is a part of `slackverse`

```{r,echo = FALSE, eval = TRUE}
pkgs <- sprintf('slack%s',c('calls','teams','posts','blocks','threads','reprex'))

badges <- sprintf('%s
[![](https://github.com/yonicd/%s/actions/workflows/r-cmd-check.yml/badge.svg)](https://github.com/yonicd/%s)',pkgs,pkgs,pkgs)

names(badges) <- pkgs

```

||||
|:-:|:-:|:-:|
||`r badges[pkgs[1]]`||
|`r badges[pkgs[5]]`|`r badges[pkgs[2]]`|`r badges[pkgs[3]]`|
|||`r badges[pkgs[4]]`|
|||`r badges[pkgs[6]]`|

The goal of slackblocks is to build Slack block elements in `R`.

## Installation

``` r
# install.packages("remotes")
remotes::install_github("yonicd/slackblocks")
```
## Example

This is a basic example which shows you how to solve a common problem:

```{r example}
library(slackblocks)
```

```{r}
block_text('my text')
```

```{r}
image_element('url_to_image')
```

```{r}
(b <- section_block(
text = block_text(
text = 'A message *with some bold text* and _some italicized text_.'),
fields = list(
block_text('*Priority*'),
block_text('*Type*'),
block_text('High'),
block_text(':heavy_check_mark:')
)
))
```

## Posting Blocks to Slack

```{r,eval=FALSE}
post_block(b, channel = 'CHANNELID')
```

```{r,echo=FALSE}
knitr::include_graphics('man/figures/sections.png')
```