twitter-greet-followers-bot

A simple twitter bot to send your new followers a nice greeting message.

Usage no npm install needed!

<script type="module">
  import twitterGreetFollowersBot from 'https://cdn.skypack.dev/twitter-greet-followers-bot';
</script>

README

A simple twitter bot to send your new followers a nice greeting message.

demo

Requirements

Credentials for the twitter api

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:

twitter-credentials

Heroku account

If you do not have a heroku account, set one up and install the heroku cli .

Set up your bot

  1. Clone the repository:
git clone https://github.com/justadudewhohacks/twitter-greet-followers-bot
cd twitter-greet-followers-bot
  1. Create a heroku app:
heroku app:create mytwitterbot1234
  1. 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
  1. Edit greeting.js and insert your greeting message

greeting

  1. Commit the changes and push to heroku
git add .
git commit -m "changed the greeting message"
git push heroku master
  1. Stop the web dyno (default) and start your app in a worker dyno:
heroku ps:scale web=0 worker=1
  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.

Trouble Shooting

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:

heroku-log

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.