Its been a long time since my last tutorial. Most of my free time now goes into app development for the Passvult App and a few others.
While this is awesome and rewarding its taken some time way from this blog which I am trying to get back into. Lets not be naive Marketing and PR play a big part in getting people to visit your blog and download your app and in some cases it may be more so a factor than the quality of what your are doing itself especially when you are starting out.
To solve this problem I tried to apply some of my technical knowhow to accomplish some of the marketing and promotion for this blog and some of my other ventures so I could spend some more time writing for this blog. To do this I grabbed some bot code from Github and jumped straight in.
The Bot / Code
After doing some research at OpenSource or at least freely available bot code I stumbled across instabot.py This is by far the best bot available for setting up some kind of automated instagram presence. Its easy to setup and use and gives you some decent customisation options, if you know your python its also easy to extend if you are that way inclined.
Originally i had this bit running on AWS, due to costs of running this on a t2.micro ec2 instance I eventually moved this to a raspberry pi that sits on my desk for simplicity and cost hence all the setup follows a debian/ubuntu like setup process.
To get the bot up and running you should run the following commands:
$ sudo apt-get git -y $ sudo apt-get python -y $ git clone https://github.com/instabot-py/instabot.py $ cd instabot.py $ sudo pip install -r requirements.txt
Modifications to make so it runs on your system
Next you have to make some mods so that the code will run on your system. you will need to create a script that is your bot the quickest way to do this is to copy the example.py script and modify it for your bot.
$ cp example.py mybot.py
Next you will need to modify the section that looks like this to house your bots username / credentials but also the hashtags you want your bot to follow and like posts from:
bot = InstaBot('login', 'password', like_in_day=1000, media_max_like=50, media_min_like=5, tag_list=['like', 'follow', 'f4f'], max_like_for_one_tag=50, log_mod=1) bot.auto_mod()
Now your bots ready for running but if your like me you wont want to run it manually.
The driver script which runs your bot on cron
If your like me you wont ever want to run this manually so this next section describes how to setup a driver script thats triggered everyday by cron.
# Run the instagram bots once a day at a random time # Output to log now=$(date) echo "------------------------------------------" >> /home/boto/instabot.py/bot_log.log echo "Bots started at : $now" >> /home/boto/instabot.py/bot_log.log #Security Sleuth Bot - sleep for a random time sleep $(( ($RANDOM % 120)*60 + ($RANDOM % 60) )) # Exiting sleep process at now=$(date) echo "Exiting random sleep at : $now" >> /home/boto/instabot.py/bot_log.log echo "Triggering Security Sleuth bot at : $now" >> /home/boto/instabot.py/bot_log.log # Run bot python /home/boto/instabot.py/sleuth.py # Run completed at now=$(date) echo "Bot run completed at : $now" >> /home/boto/instabot.py/bot_log.log echo "------------------------------------------" >> /home/boto/instabot.py/bot_log.log
Every day the script is run via cron off at about 5am my local time. as you can see above it will sleep for a random amount of time before liking a number of posts and following a number of accounts.
The bot has several modes - mine runs in the most basic which is like all posts in the hashtag range and follow everybody. you can setup some more complex behaviours like unfollowing people or unfollowing them if they don’t follow you back etc etc. I wont delve into that in this post, head to the source code and grab the instructions there if you are interested.
In the short time I had the bots running (roughly around 2 months) I managed to amass around 1000 Followers just simply by having this bot running with and probably posting less than a handful of things. But the deeper level of engagement I was looking for didn’t happen hence I would go so far to say that this activity wasn’t fruitful for new / emerging business PR.
This might be effective if your day job is posting photos on Instagram and you need to build up a large amount of followers so you can command better payments.
As always I hope you found this tutorial useful. Please let me know if you would like to see more bot or automation focused tutorials in the near future.
As always thanks for your support! Until next time,
The Security Sleuth