londonmapbot at LondonR

event
github-actions
londonmapbot
mapbox
r
rtweet
talk
twitter
Author
Published

February 12, 2022

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.

Note

The bot no longer runs on Twitter. You can read about how I ported it to Mastodon at @londonmapbot@botsin.space.

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.

Note

{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.

Environment

Session info
Last rendered: 2023-07-17 18:16:49 BST
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.2.1

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/London
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] htmlwidgets_1.6.2   compiler_4.3.1      fastmap_1.1.1      
 [4] cli_3.6.1           tools_4.3.1         htmltools_0.5.5    
 [7] xaringanExtra_0.7.0 rstudioapi_0.15.0   yaml_2.3.7         
[10] rmarkdown_2.23      knitr_1.43.1        jsonlite_1.8.7     
[13] xfun_0.39           digest_0.6.31       rlang_1.1.1        
[16] fontawesome_0.5.1   evaluate_0.21      

Footnotes

  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!↩︎

Reuse

CC BY-NC-SA 4.0