![]() This method has one big consequence, it was burning thorough my free dynos, aka credit on Heroku. This gives a very fast response, and is infrequent enough to comply with the Twitter API rules, as far as I can tell at least. Switching to 10 minute schedule for huge savingsīy default Sumedh Patkar Twitter Bot uses setInterval to trigger once every minute. For this I followed the Heroku documentation: Configuration and Config Vars I then configured the environment variables (my Twitter credentials) in Heroku. env file is present it loads the content into environment variables, accessible in NODE via process.env.Įnter fullscreen mode Exit fullscreen mode env file that I do not check into GitHub. As I wasn't familiar with how to use a config.js in a secure why while hosting my repo openly on GitHub, I went with what I know and used dotenv.įor local development I have a. The tutorial used a config.js method for providing the app with Twitter API keys, with a vague note not to leak your credentials. If you want to start from my final state, go right ahead and grab the code from GitHub: Of course I changed it enough so that it searched for #TesterOfTheDay. I have no intention of repeating anything from that tutorial, if you want to follow it, go read it. ![]() ![]() How to create a Twitter Bot using Node.js and Heroku You can find the tutorial I followed here: So I used the final state of the tutorial as my starting point. I am not ashamed to admit it, I wanted to make a Twitter bot, not learn how to make a Twitter bot. I started writing the Twitter bot by following a tutorial. !! Please note, Heroku are removing their free dynos, so you can no longer run a Twitter bot on Heroku for free. Originally posted on my learning journal:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |