https://github.com/yonicd/slackposts
Interact with chats and files methods of Slack API in R
https://github.com/yonicd/slackposts
Last synced: 3 months ago
JSON representation
Interact with chats and files methods of Slack API in R
- Host: GitHub
- URL: https://github.com/yonicd/slackposts
- Owner: yonicd
- License: other
- Created: 2020-09-05T17:24:08.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-01T13:20:25.000Z (8 months ago)
- Last Synced: 2025-01-03T10:51:32.066Z (4 months ago)
- Language: R
- Homepage: https://yonicd.github.io/slackposts/
- Size: 158 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - yonicd/slackposts - Interact with chats and files methods of Slack API in R (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# slackposts
[](https://www.tidyverse.org/lifecycle/#experimental)
[](https://tinyurl.com/2lxgjyzn)
[](https://github.com/yonicd/slackposts/actions/workflows/r-cmd-check.yml)
[](https://codecov.io/gh/yonicd/slackposts?branch=master)`slackposts` 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)',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]]`|`slackposts` is an `R` package that allows the user to interact with slack API chat messages, snippets and files from R.
## Installation
``` r
remotes::install_github("yonicd/slackposts")
```## Usage
### Token
First you need a Slack API Token, to learn how to create one go to [slackteams](https://github.com/yonicd/slackteams) or set it directly as the environment variable `Sys.setenv('SLACK_API_TOKEN')`.
### Load
``` r
library(slackposts)
```### Chats
#### Post a message
``` r
chat_post(
channels = "general",
text = 'my message'
)
```#### Update a message
``` r
chat_update(
post = slackposts::post_last(),
text = 'my updated message'
)
```#### Delete Message
``` r
chat_delete(
post = slackposts::post_last()
)
```### Files
#### Create a temp file
```r
tf <- tempfile(fileext = '.r')
cat(
utils::capture.output(utils::sessionInfo()),
file = tf,
sep = '\n'
)
```#### Post the file
``` rfile_post(
channels = "general",
file = tf,
filename = 'sessionInfo.R',
filetype = 'r',
title = 'R sessionInfo'
)
```# Delete the file
``` r
file_delete(file_last())
```