A bot that efficiently handles message sending on Instagram.
I have programmed a message bot that works specifically for Instagram. The bot was designed in Python 3.7.6 making use of
webscraping techniques. This bot aims to automate the process of sending a message (text/image) to a receiver without the
involvement of the user/host.
Video Demonstration: Working of the Bot
Link to code: Instagram_Message_Bot.py
The following system requirements must be met. To install a requirement, you can download from the link mentioned on the side.
- Python 3 and above. Download Python
- PIP for Python in Windows PIP Installation Guide
- Chrome Webdriver Chrome Webdriver Installation
This bot works on the concept of webscraping. Thus, to run this bot, certain modules will have to be installed.
- selenium : For accessing web-browser.
- PIL : For sending images.
- tk : Short form for tkinter, used for opening a dialog box that allows users to select images.
- getpass : Hides password when it's being typed.
To install these modules, open up CMD and type in: pip3 install <modulename>
After the requirements have been met, follow the below steps to run the program.
- Open CMD (command-prompt), navigate to the working directory. Type in:
python Instagram_Message_Bot.py
- If you're getting an error, check the python version you're using by typing
python --version
in CMD. Make sure you are using python 3 and above. If the error still pops up, check if the modules were installed correctly. - After the program executes, it will ask for certain necessary details such as host account details, Instagram ID of the receiver
and the message (text/image) to be sent as shown below.
- If the message type is Text, you will be required to type in the message.
- However, if you choose to send an image, a dialog box will open from where you can choose your image.
- This bot only works in Windows (due to directory address configurations which differ in other OS'es.)
- This bot contains 2 .py files (main file and imageSelection.py). It is necessary to keep these files in the same directory.
- After the installation of the Chrome Webdriver, it is important to replace the driver address in line number 13 in Instagram_Message_Bot.py with the address of your Webdriver's location address. After changing the address, if you receive an error, just convert all the single back-slashes into double back-slashes in the address. Eg: "\" becomes "\\". Line 13:
- The password will not be visible (and won't be stored) when being typed.
After the provision of these details, the bot takes over and the user can go away from keyboard.