slackblocks
is a part of slackverse
slackcalls |
||
slackreprex |
slackteams |
slackblocks |
slackthreads |
||
NA |
The goal of slackblocks is to build Slack block elements in R
.
# install.packages("remotes")
remotes::install_github("yonicd/slackblocks")
This is a basic example which shows you how to solve a common problem:
library(slackblocks)
block_text('my text')
#> {
#> "type": "mrkdwn",
#> "text": "my text"
#> }
image_element('url_to_image')
#> {
#> "type": "image",
#> "image_url": "url_to_image",
#> "alt_text": "image"
#> }
(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:')
)
))
#> {
#> "type": "section",
#> "text": {
#> "type": "mrkdwn",
#> "text": "A message *with some bold text* and _some italicized text_."
#> },
#> "fields": [
#> {
#> "type": "mrkdwn",
#> "text": "*Priority*"
#> },
#> {
#> "type": "mrkdwn",
#> "text": "*Type*"
#> },
#> {
#> "type": "mrkdwn",
#> "text": "High"
#> },
#> {
#> "type": "mrkdwn",
#> "text": ":heavy_check_mark:"
#> }
#> ]
#> }
post_block(b, channel = 'CHANNELID')