A simple twitter bot to send your new followers a nice greeting message.
Create a twitter app for your twitter account and switch to the tab Keys and Access Tokens. If you do not have an access token yet click Create my access token. Now you should have all your credentials:
If you do not have a heroku account, set one up and install the heroku cli .
- Clone the repository:
git clone https://github.com/justadudewhohacks/twitter-greet-followers-bot
cd twitter-greet-followers-bot
- Create a heroku app:
heroku app:create mytwitterbot1234
- Set your twitter-api credentials as environment variables:
heroku config:set consumer_key=xxx
heroku config:set consumer_secret=xxx
heroku config:set access_token=xxx
heroku config:set access_token_secret=xxx
- Edit greeting.js and insert your greeting message
- Commit the changes and push to heroku
git add .
git commit -m "changed the greeting message"
git push heroku master
- Stop the web dyno (default) and start your app in a worker dyno:
heroku ps:scale web=0 worker=1
- Testing your bot:
If everything worked your bot should be running. You can test your bot by following: justapoliteguy, who will follow you back. Check if your greeting message was sent. You can retry as many times as you wish by unfollowing and following again.
In case your bot does not seem to work, you can open the heroku dashboard of your app and navigate to View logs by clicking the More button in the upper right corner:
If you see the output credentials ok — running bot, the bot should be up watching for new followers. As the log only displays a few lines, you can also dump the log to a text file:
heroku logs -a mytwitterbot1234 >> logs.txt
Another thing you might want to check is, whether your credentials are set up correctly. Navigate to the Settings tab and click Reveal Config Vars. Check and edit your credentials here.