This app publishes once a day a random progress of the virus using R, Docker, and Google Cloud Run. This also provides a great example of how to make a Twitter bot in R and deploy it.
The repository contains a few key files for running a RESTful API to control posting tweets. It uses R with the plumber package to do so, check out this blog series for more details on how to do it.
rest_controller.R
- the plumber RESTful API that receives the command to publish a tweet and does somain.R
- the command that starts the RESTful API.setup.R
- run when the package is built, this installs the R packages.Dockerfile
- this controls building the docker containertoken.rds
[missing] - this file has the rtweet credentials to post the tweet, but is not included in the repo for security purposes. Check out the rtweet documentation on how to make this.
Once you build the Docker image for your bot, you can upload it to Google Cloud Run. Once you've done that you can either have posting the tweets be controlled by an outside service hitting the API, or you can schedule it to happen automatically using Google Cloud Scheduler.