A Twitter bot with rtweet, Mapbox and GitHub Actions

Tags: #<Tag:0x00007f5a8d4f2498> #<Tag:0x00007f5a8d4f2330> #<Tag:0x00007f5a8d4f2150> #<Tag:0x00007f5a8d4f2010> #<Tag:0x00007f5a8d4f1f48>

rOpenSci package or resource used*


What did you do?

I set up a GitHub Action that includes R code that generates random coordinates in greater London, queries the Mapbox API for a satellite image and uses the Twitter API via {rtweet} to post the image to the @londonmapbot Twitter account.

URL or code snippet for your use case*


More images at the @londonmapbot account.



Field(s) of application

geography, geospatial, communications, social studies, sociology

Twitter handle


I can add something here because I did some very similar to Matt’s case study.

I wanted to set something up to do some regular tweeting to promote content for my business, R for the Rest of Us. I use rtweet in a very similar way to Matt. The one piece I do in addition is to query a Google Sheet, from which I draw tweets and then post them. I did this using googlesheets4.

You can see the code I used here and the GH Action here.