Send Messages to Friends & Followers On Instagram Using Python

Do you know you can send messages, photos, videos, or follow someone on instagram even without opening your Instagram account? In this article we are going to see how we can automate our instagram account with few lines of python code!

Jayeeta Mondal
2 min readNov 17, 2021

Sometimes it’s quite boring to send same messages to all friends. Specially if you have large number of followers, it’s become time consuming also. Python instabot module is a saviour in this situation. You can automate your instagram account and send messages to all within few minutes by using this python module. To know more about instabot, click here.

To send instagram messages using python, you need to have your instagram account. Because username & password will be necessary to login into your account.

First you need to install instabot library in your python virtual environment. To install instabot library you need to enter the below command.

pip install instabot

Now It’s Time For Coding

from instabot import Bot

bot = Bot()

bot.login(username=”Your_Username”, password=”Your_Password”)

urer_ids = [“username1”, “username2”]

messages = “I like GFG”

bot.send_messages(messages, urer_ids)

First we import the Bot from the Instabot library and make a variable bot. Then we need to login into our account using the bot. After that we have to make a list of friends/followers to whom we want to send messages. Then write the message you want to send. Now send the message. To send messages to more person use the send_messages function and to send messages to a single person send_message function.

Note: Youn may face difficulties sometimes while rerunning the program because you may get login errors. To avoid this you need to delete a config folder that is auto-created after running the program once.

I hope you find this article useful. If you have any question feel free to ask in the comment section below.

--

--

Jayeeta Mondal
Jayeeta Mondal

Written by Jayeeta Mondal

Data Scientist || Freelancer || Open Source Contributor

No responses yet