Interact with 'Bluesky' Social

Collect data from and make posts on 'Bluesky' Social via the Hypertext Transfer Protocol (HTTP) Application Programming Interface (API), as documented at < https://atproto.com/specs/xrpc>. This further supports broader queries to the Authenticated Transfer (AT) Protocol < https://atproto.com/> which 'Bluesky' Social relies on. Data is returned in a tidy format and posts can be made using a simple interface.


bskyr

Lifecycle:stable Project Status: Active – The project has reached a stable, usablestate and is being activelydeveloped. Codecov testcoverage R-CMD-check CRANstatus bskyr statusbadge

bskyr provides an interface to the Bluesky Social API, allowing you to interact with Bluesky Social from R. To do this, we provide functions which match with the AT Protocol’s Lexicon, which is like using regular HTTP requests. Outputs from bskyr’s functions are primarily tibbles, allowing for easy analysis of the outputs from the API calls.

Installation

You can install the stable version of bskyr from CRAN with:

install.packages('bskyr')

You can install the development version of bskyr from GitHub with:

# install.packages('pak')
pak::pak('christopherkenny/bskyr')

Posting with bskyr

First, load the package:

library(bskyr)

Text posts can be made as follows:

bs_post(text = 'Your text goes here.')

If you have images to include, up to four can be included with the images argument:

bs_post(
  text = 'Your text goes here.', 
  images = c('path/to/image1.jpg', 'path/to/image2.png')
)

Alt text can be added to images with the images_alt argument:

bs_post(
  text = 'Your text goes here.', 
  images = c('path/to/image1.jpg', 'path/to/image2.png'), 
  images_alt = c('Alt text for image 1', 'Alt text for image 2')
)

To quote or reply to a post, use the quote and/or reply argument, respectively. These can take the link of an existing post. You can quote and reply to the same post, if you want.

bs_post(
  text = 'Your text goes here.', 
  quote = 'https://bsky.app/profile/chriskenny.bsky.social/post/3kepscxiljc22',
  reply = 'https://bsky.app/profile/chriskenny.bsky.social/post/3kepscxiljc22'
)

See the reference for additional features, including likes with bs_like() and reposts with bs_repost().

Authentication

To authenticate, you first need to make an App Password. To do this, go to https://bsky.app/settings. Under “Advanced” click App passwords and then “Add App Password.”

Once you have a password, you need to run:

set_bluesky_user('YOUR-USERNAME.bsky.social')
set_bluesky_pass('your-apps-pass-word')

If you want this to persist across sessions, set install = TRUE and r_env = file.path(Sys.getenv('HOME'), '.Renviron'). This will save your credentials in your R environment file.

Alternatively, you can set them manually using usethis::edit_r_environ() and adding lines like so:

BLUESKY_APP_USER='YOUR-USERNAME.bsky.social'
BLUESKY_APP_PASS='your-apps-pass-word'

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("bskyr")

0.4.0 by Christopher T. Kenny, a year ago


https://github.com/christopherkenny/bskyr, http://christophertkenny.com/bskyr/


Report a bug at https://github.com/christopherkenny/bskyr/issues


Browse source code at https://github.com/cran/bskyr


Authors: Christopher T. Kenny [aut, cre] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports cli, curl, dplyr, fs, httr2, lubridate, magick, mime, opengraph, purrr, rlang, stringi, stringr, tibble, tidyr

Suggests emoji, jsonlite, knitr, rmarkdown, spelling, testthat, vcr, withr


See at CRAN