How to make GitHub Actions send Tweets
- Published at
- Updated at
- Reading time
- 2min
There are many ways to set up a Twitter bot. My projects Tiny Helpers and Random MDN automatically share things with the world. They use different technologies.
First, the Tiny Helpers site exposes an RSS feed that includes the latest additions to the site. ITTT ("If that then that") consumes this feed, and a connected Twitter account shares new items. People can follow the latest tool additions via RSS and Twitter this way.
Random MDN is a Twitter bot that shares randomly picked MDN documentation pages several times a day. It's only for a while now, and it keeps surprising me how much functionality the web provides these days.
When I set the bot up, I decided to use the Serverless Framework because it allows configuring AWS Lambda functions that run on a schedule. The framework's purpose is to orchestrate complex applications based on serverless technologies. Random MDN uses exactly one scheduled function, and the framework is way too much for this tiny bit of functionality.
I wrote about how to use GitHub actions to schedule Netlify deploys previously. And it works beautifully!
Since I learned about this GitHub feature, it's on my TODO list to drop Random MDN's Serverless Framework/AWS dependency and handle the Tweets in GitHub only.
James Hibbard's post How to send Tweets with a JavaScript GitHub action will help me tackle this refactoring.
If you want to start writing Twitter bots, have a read. It's a good starter!
Yes? Cool! You might want to check out Web Weekly for more WebDev shenanigans. The last edition went out 12 days ago.
Related Topics
Related Articles
- A new method to validate URLs in JavaScript (2023 edition)
- How to remove all event listeners from a DOM element
- Copy an array and replace one element at a specific index with modern JavaScript
- How to prerender Tweets without using the official Twitter APIs
- How to use EventTarget as a web-native event emitter