How to source and then DM your competitors on Instagram.

Instagram Automation: Scraping Usernames and Sending Personalized Messages.

You are a small music studio that needs more artists to record. As a new studio in town, getting your name out there is crucial for your success. To expand your reach, you decide to employ TaskMagics How to Scrape Many Searches Using Variables. tool to explore potential opportunities.

 

Upon using the tool, you discover a local music studio in your area. Curious about their online presence, you find that they have an impressive following of 398 users on Instagram. The thought strikes you that reaching out to these 398 followers with a special discount offer for your grand opening could be a fantastic way to introduce them to your studio. In this tutorial, we will demonstrate how to transform this ambitious task into something magical.

Here is the video tutorial on how to do this step by step.

Or follow the step by step guide:

For this strategy to succeed, it is essential to have a Google Sheet set up, complete with at least one header in column A. In this case I have 3 just because I like to keep myself organized.

Notion image
 

For this first part, all we need is the Google Sheet.

 

Once we've got the Google Sheet ready, it's time to head over to the workspace where you want to add the two automations we’ll be using.

 
Notion image

First we star with the scrape username automation.

 

First, we are going to capture these steps.

Notion image
 

Log into Instagram like you normally would on any browser.

 
Notion image
 

Click on “Turn on” or “Allow” on any pop up you see, I’ll show you how to fix them later.

 
Notion image
 

Enter the URL of the page of your competitor, or the page you want to scrape the usernames of. In this case it’ll be https://instagram.com/estudio.fbl

 
Notion image
 

Once we are in the URL of the profile, let’s click on “followers”.

 
Notion image
 

When we have the list of followers, we can start to scrape the usernames, the profile link and even their names (we’re going to be using the names in a personalized message.)

 
Notion image
 

So when we click on some “List” element. They sometimes come with a link, in this case it was with the users profile link. We want both so we can select text first, then we scrape the username again and then select URL to get both the username in text and URL form.

 
Notion image
 

Once you’ve scraped the information you needed, you can stop the automation.

 
Notion image
 

Once you finish recording, a pop -up will show up asking you if you want to send the scraped data to a Webhook or to a Google Sheet. In this case a google sheet if more than enough.

 
Notion image

Connect to Google Sheets

Next, we’ll get a “connect to Google Sheets” pop-up. We'll link it to the Google Sheet with at least one header. In this case we have 3. If all the information look correct. Click on “Looks good”

 
Notion image
 

To connect with a Google Sheet URL, here's what you gotta do:

 
Notion image
 

Go to your Google Sheet page and spot that share button at the top right corner.

Notion image

In the pop-up, there's a link icon at the bottom left—click it to copy the link. Also, don't forget to share the automation with automations@taskmagic.com

 
Notion image

Alright, once you've handled those steps, you can come back to TaskMagic. Take a quick peek at your sheet, and if everything's looking good, hit the "Looks good" button.

Notion image
 

Once you’ve connected your sheets, we have to go edit the pop-ups. Go to all the first steps (I do step 1-7, in this case 7 is the last pop-up I get) and click on the 3 dots. That will take you to the edit step menu. In this menu you’ll see a “Allow error” checkbox, that will avoid the automation from failing in case the pop-up doesn't show up.

 
Notion image
 

Because we went to a URL to scrape the Instagram page, we need to manually add this step in our workflow. Before the step where we clicked on the followers, we need to add this URL. In this case https://instagram.com/estudio.fbl. Click on the green + button and you’ll see a drop down.

 
Notion image
 

From this dropdown, select URL.

 
Notion image
 

Once you click on URL, you’ll see a pop up, here you’ll input the URL.

 
Notion image
 

That is all we have to edit from the steps. After we’ve done all that, we can now play the steps and get to scraping.

 
Notion image
 

This might take a minute so let the app do its thing.

 
Notion image
 

If you see a green message on the bottom left of your screen you can now go to your google sheet and you’ll see the username, profile link and user names in this sheet.

 
Notion image
 

That will be all for this first part of this two step automation.

Second step, send Instagram DM’s.

 

We are going to start a new automation, you can call it whatever you like.

 
Notion image
 

The beginning is almost the same as the first part. Let’s capture our steps.

 
Notion image
 

Log into Instagram just like you normal would.

 
Notion image
 

Accept all pop-up, just like the first step.

 
Notion image
 

After we’re done with the usual set up process, we now want to go to our DM’s. We’re going to be using a URL instead of a icon click, but at times its hard to know where the URL goes, so let’s click on the Messenger icon but just as a placeholder.

 
Notion image
 

Once we’re in out DM’s. Lets click on the “New message” button.

 
Notion image
 

Once we’re inside this pop-up, lets type a message and select a user like we normally would on our day to day basis. It is important that for this to work properly, you click on the div I am choosing in order to send a message. Its the green rectangle where it says “CLICK WHERE I CLICK”, that is the shared div.

 
Notion image
 

Once you have your user selected, click on “Chat” to send a message.

 
Notion image
 

Once you click on chat, you’ll see the DM page. Here is where you’re going to write your message and where we’re going to send this message. Just like you normally would on the browser. Once you are done with the your message, you can click on the red “Stop” button.

 
Notion image
 

When you stop your recording, you’ll see a pop-up that is going to ask you if you want to play steps, or if you want to continue to edit. Lets continue to edit this automation.

 
Notion image
 

Let’s do the same thing as the first automation. We have to go edit the pop-ups. Go to all the first steps (I do step 1-7, in this case 7 is the last pop-up I get) and clock on the 3 dots. That will take you to the edit step menu. In this menu you’ll see a “Allow error” checkbox that will avoid the automation from failing in case the pop-up doesn't show up.

 
Notion image
 

Here is where the placeholder comes in play. On step 8 you can see it doesn't say “Messenger icon” or anything like that. So what we want to do is to put the direct link to our DM’s. In this case the URL we are going to be putting https://www.instagram.com/direct/inbox/. Let’s click on the green + button (that is now a white x button because tis active) and let’s click on URL.

 
Notion image
 

In the URL pop-up, we’re going to put https://www.instagram.com/direct/inbox/.

 
Notion image
 

After we’ve put the URL, we can now erase the “Messenger” icon placeholder.

 
Notion image
 

That is all we need to edit for now. The next step is to put our variables in to play. For this we’re going to need to click on “Setup trigger”.

 
Notion image
 

In the “Setup trigger” menu, you’ll see 4 options, the one we want is the “Loop though data” option.

 
Notion image
 

We now need to connect the google sheet where we scarped all the usernames.

 
Notion image
 

Connect to Google Sheets

We’re going to do the same thing we did on the first automation. Select your Google sheet page and check if the information is correct. If the headers are looking good, click on the “Looks good” button.

 
Notion image
 

To connect with a Google Sheet URL, here's what you gotta do:

 
Notion image
 

Go to your Google Sheet page and spot that share button at the top right corner.

Notion image

In the pop-up, there's a link icon at the bottom left—click it to copy the link. Also, don't forget to share the automation with automations@taskmagic.com

 
Notion image

Alright, once you've handled those steps, you can come back to TaskMagic. Take a quick peek at your sheet, and if everything's looking good, hit the "Looks good" button.

 
Notion image
 

The next option that will show is the Loop settings. Here you’ll determine on what user you want to start to message and how many message you’ll send on the automation run.

 

In this example, because the usernames start on row 2 (row 1 are headers) we choose row 2 on the first option. And because we only want to message the first 3 users, on the next option we write 3 (it’s only going to send a message to the next 3 users on the list)

Notion image
 
Notion image
 

You can set a schedule on this page but in this case I don't want any for the moment but if you want more information you can check: this article snippet here.

 
Notion image
 

And that is all we need to make this automation to work. But the last 2 steps are to put those automation into play and we also want to use their name in the message for a more personalized message. Let’s go down to step 11 (step 11 in this example is where I typed in the username to write him a message) and edit the username. Lets click on the username we typed in and you’ll see a pop-up after that.

 
Notion image
 

In the pop-up, you’ll see the headers “Usernames”, “Links” and “Name”.

 
Notion image
 

Because we want to search for a user and send a message, we choose the “Username” variable (the name depends on what you called your header).

 
Notion image
 

Once you’ve set the “Username” variable, we can now edit the message to also use the users actual name. Let’s go to step 14 (step 14 in this example is where I typed in the message I wanted to send) and edit the message. Lets click on the message we typed in and you’ll see a pop-up after that.

 
Notion image
 
 

You’ll see the same 3 headers “Usernames”, “Links” and “Name”.

 
Notion image
 

And now because we want to send a message with their name, we can use the “Name variable” like we did bellow..

 
Notion image
 

Nets step will be to edit the loop. We go to the step after we placed the URL in this step 9 (step 9 is when I click on the new message button in the DM page).

 
 
Notion image
 

All the way to the step button. In this example the “Send” button was the last step.

 
Notion image
 
 

So because we want to loop from the username search all the way to the send message action, we start the loop on step 9 (new message button) all the way to the “Send” button.

 
Notion image
 

Once you’ve set the loop. You can now play your automation and watch the magic happen.

 
Notion image
 

You’ll see the automation search for the users you have in your Google Sheet and watch the app select them.

 
Notion image
 

It’ll start to type the message and to send it to all the users.

 
Notion image

And that is all. You don't need more than that to make this repetitive task magical.

Now, if you've got a massive number of messages to send—let's say around 9,999 or more—then you might want to check out our article on What does “Manage loop trigger” do and how to use it? It's a game-changer for handling high volumes of messages like a breeze!

 

In conclusion, you've embarked on an incredible automation journey with TaskMagic. By leveraging the power of templates, Google Sheets, and clever tweaks, you've unlocked the potential to connect with your audience on Instagram like never before. With each message sent, your music studio's name is spreading far and wide, making an impact in the world of music.

As you continue exploring the vast possibilities of TaskMagic, remember that the only limit to your magical journey is your creativity. From spreading the word about your grand opening to nurturing meaningful connections with artists, you've mastered the art of automation and made it your own.

So, keep on automating, keep on spreading the magic, and most importantly, keep on making beautiful music! Cheers to your success and happy automating!

Did this answer your question?
😞
😐
🤩