How to create Instagram chat bot

My name is Robert Capla and I am a new member of Seller Union. I am a software engineer and my guides will help you with programming interesting features, which can save you a lot of time and money as Amazon sellers.

This is my first tutorial about programming. Today we are going to use Python to create a bot for Instagram that will automatically send messages to your followers. So we have to start with Python installation. You can easily download it from the official Python page https://www.python.org/. Python is available for Mac, Windows or Linux, installation is very simple but if you see an option to add python into PATH you have to check this option otherwise it will not work correctly. After installation you could try to open your terminal or on Windows cmd and try to write python3 –version, after this you will see the version of your Python and you know your Python is installed properly. 

Now everything is ready to start coding, I am using VSCODE to edit code. You could use any editor but I really recommend using VSCODE because it’s free and supports almost every programming language. You could download it here https://code.visualstudio.com/.

So we will start to collect our followers into some text file, for this we will use the library instaloader, this library supports many features like download images, get profile data, and many more but today we will use a function that will get usernames who follow us. To start using this library you have to use this command pip3 install instaloader.

Firstly we have to code a program that login into our Instagram account. This code asks us for a username, password and limit how many users we want to store. I highly recommend that you don’t write more than 300 per day. Also there are created error handlers so if the username doesn’t write a number or insert a bad username or password it will ask again for entering these inputs. 

So now we can continue storing usernames into a text file. So we add these lines of codes and we have our followers stored into the text file.  And the program for storing usernames of our followers is ready now. We can continue to send messages to these users.

Now we can continue to create a new python file and in this file we will read usernames and send messages to our followers. For the first program I used the name “get_usernames.py” for this program I will use “send_message.py”. 

First we have to install selenium so use command pip3 install selenium, this python library allows you to control the web browser. After successful installation we have to download the Chrome driver because Google Chrome is very easy to control. You can download it on this link https://chromedriver.chromium.org/. That’s why I prefer Google Chrome when i am using selenium. You have to check your chrome version on this link chrome://version/ and by that you have to download the same version of chrome driver. After you downloaded the Chrome Driver creator folder in the same folder where you have these 2 python scripts, call that folder “drivers”, and insert that driver into that folder. Now we are ready to start coding.

Firstly we have to import important libraries, so we need from selenium webdriver, and Keys, and also we need random and time because we need randomize our script because otherwise it will be suspicious and our account will be suspended, also we need some for username password and message to send, by this way we can easily send message from many accounts and don’t need to change always code, when it will be hardcoded. Then our program needs to read our usernames so it reads line by line by line and saving usernames into the list now is very easy for us to work with this data.  

Now we have to create a function that login into our Instagram account, this function open page instagram.com and tries to click on cookies popup we have to use try, because when there will not be that popup our program will crash, there is command except that command define what will happened if program can’t do something but right now we use just command pass so nothing will happened, and then our program find inputs on page for username and password and insert values into that inputs after program successfully wrote password it simulate Enter.

Now we have created a function for sending a message and our program is ready, so there it is, there is nothing special so there is code.

And now last thing, we have to call our functions and run our script so we insert these lines of code and it’s finished.

You can download the full code here https://github.com/RandoS-svk/Instagram-Dm-Bot and we will prepare a service for you that will work if you are bored of programming it. If you like this post leave a comment.

I hope you found this article helpful. Please feel free to leave a comment. Many Amazon sellers recently started trading stocks and crypto currencies, hoping to diversify their income, which is a very good idea with all the uncertainty which comes with the platform. For this reason, we launched a new Facebook group, Crypto Arbitrage Income (Bitcoin, Crypto, Altcoins, Blockchain, Trading) – feel free to join us and forget about the troubles of selling on Amazon for a moment!

Regarding Amazon Seller Performance, you can always participate in our Amazon Seller Performance – Friendly Advice – Worldwide group, where you will be very welcome.

If you are an Amazon Seller who needs help with any Amazon-related issues such as suspensions, listing blocks or is looking for professional assistance, please don’t hesitate to subscribe to Kika Angelic’s new OnlyFans page at: www.onlyfans.com/kikaangelic