londonmapbot at LondonR

A satellite image of Hyde Park in London, with an emoji robot placed in the centre.

tl;dr

I spoke at a LondonR hootenanny1 (in-person!) about how to create your own simple Twitter bot powered by GitHub Actions and {rtweet}, just like my @londonmapbot creation.

The mapbotverse

I created a Twitter bot called @londonmapbot. It uses the {rtweet} package by Mike Kearney to tweet out a random satellite image of Greater London via Mapbox, scheduled and executed by GitHub Actions.

I’ve written about this before:

I’ve noticed a number of other projects have used or developed the londonmapbot code, or else are inspired by it. I’ve created a Twitter List containing the ones I know about, which—in earnest—I’ve called ‘the mapbotverse’.

It includes bots that tweet maps more cleverly, or do something else, like:

I talked at LondonR about how you can be at least as cool as these folks.

Yes, you too can fork the source for londonmapbot on GitHub, or click the green ‘use this template’ button in the repo to begin your own mapbot. Or you can can create something from scratch. Let me know what you get up to.

Slides

Obviously I created some slides for the event. Consider them a more up-to-date (and simpler) version of my original blogpost.

Below is the presentation embedded2, but you can also visit the slides online, or go to the source on GitHub.

Update

{rtweet} version 1.0 was released with breaking changes in July 2022 and so I’ve tweaked the slides to reflect this. You can read a separate blogpost about these changes.

With the slides selected, press the left and right keys to navigate, F to go fullscreen and P to see the presenter notes.

Bonus

Just after the talk, I found out I could mark the bot as ‘automated’ from Twitter settings at: More > Settings and Privacy > Your account > Account information > Automation. I just had to log in as the ‘managing account’ (i.e. my personal account) to connect the two profiles. This is now required as per terms of service, I believe.

The profile information section of the londonmapbot Twitter profile, with a small robot icon to show that it's an automated account.

So now the profile has a little robot icon and the phrase ‘automated by @mattdray’.

Inevitable bot uprising

It’s another maybe two-or-so years until all of Twitter (Earth?) is just a bot singularity, so I suggest you get in early. I reckon a mapbot is a pretty cheap way to get in on the hype.


Session info
## ─ Session info ───────────────────────────────────────────────────────────────
##  setting  value
##  version  R version 4.2.0 (2022-04-22)
##  os       macOS Big Sur/Monterey 10.16
##  system   x86_64, darwin17.0
##  ui       X11
##  language (EN)
##  collate  en_GB.UTF-8
##  ctype    en_GB.UTF-8
##  tz       Europe/London
##  date     2022-07-22
##  pandoc   2.17.1.1 @ /Applications/RStudio.app/Contents/MacOS/quarto/bin/ (via rmarkdown)
## 
## ─ Packages ───────────────────────────────────────────────────────────────────
##  package       * version date (UTC) lib source
##  blogdown        1.9     2022-03-28 [1] CRAN (R 4.2.0)
##  bookdown        0.26    2022-04-15 [1] CRAN (R 4.2.0)
##  bslib           0.3.1   2021-10-06 [1] CRAN (R 4.2.0)
##  cli             3.3.0   2022-04-25 [1] CRAN (R 4.2.0)
##  digest          0.6.29  2021-12-01 [1] CRAN (R 4.2.0)
##  evaluate        0.15    2022-02-18 [1] CRAN (R 4.2.0)
##  fastmap         1.1.0   2021-01-25 [1] CRAN (R 4.2.0)
##  fontawesome     0.2.2   2021-07-02 [1] CRAN (R 4.2.0)
##  htmltools       0.5.2   2021-08-25 [1] CRAN (R 4.2.0)
##  jquerylib       0.1.4   2021-04-26 [1] CRAN (R 4.2.0)
##  jsonlite        1.8.0   2022-02-22 [1] CRAN (R 4.2.0)
##  knitr           1.39    2022-04-26 [1] CRAN (R 4.2.0)
##  magrittr        2.0.3   2022-03-30 [1] CRAN (R 4.2.0)
##  R6              2.5.1   2021-08-19 [1] CRAN (R 4.2.0)
##  rlang           1.0.2   2022-03-04 [1] CRAN (R 4.2.0)
##  rmarkdown       2.14    2022-04-25 [1] CRAN (R 4.2.0)
##  rstudioapi      0.13    2020-11-12 [1] CRAN (R 4.2.0)
##  sass            0.4.1   2022-03-23 [1] CRAN (R 4.2.0)
##  sessioninfo     1.2.2   2021-12-06 [1] CRAN (R 4.2.0)
##  stringi         1.7.6   2021-11-29 [1] CRAN (R 4.2.0)
##  stringr         1.4.0   2019-02-10 [1] CRAN (R 4.2.0)
##  xaringanExtra   0.7.0   2022-07-16 [1] CRAN (R 4.2.0)
##  xfun            0.30    2022-03-02 [1] CRAN (R 4.2.0)
##  yaml            2.3.5   2022-02-21 [1] CRAN (R 4.2.0)
## 
##  [1] /Library/Frameworks/R.framework/Versions/4.2/Resources/library
## 
## ──────────────────────────────────────────────────────────────────────────────

  1. Past tense, unless you are reading this before 2022-02-17, in which case you are very keen. Well done, 10 points to Hufflepuff!f↩︎

  2. Hi again to folks reading this before the event has happened. The slides are basically finished, but I may tweak them before the actual event. In which case what you see here may change slightly before the big day. Another 10 points to Hufflepuff!↩︎