Automated Instagram Post Liker using Phantombuster and SharePoint - n8n Workflow

Use this advanced n8n workflow to automatically scrape and like Instagram posts from target profiles via Phantombuster, featuring intelligent cookie rotation via OpenAI and duplicate checking using SharePoint.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Social Media Managers needing automated interaction.

  • Marketing professionals running growth experiments.

  • Users looking for advanced examples of state management (duplicate checking) within an n8n template.

  • Developers interested in combining external scraping agents (Phantombuster) with core n8n node logic.

Overview

This robust n8n workflow provides a sophisticated solution for automating Instagram interactions, ensuring account safety and data integrity. The core problem this automation solves is the need for consistent, rate-limited engagement with fresh content from specific profiles, while intelligently rotating login credentials (session cookies) and preventing the system from liking the same post twice. This advanced n8n template leverages Microsoft SharePoint for storing critical data (profiles to scrape, used cookies, and already-liked posts) and uses the Phantombuster platform to handle the heavy lifting of scraping and liking. Furthermore, an innovative AI LangChain n8n node is used to implement a time-slice logic for rotating session cookies, adding a layer of intelligence and resilience to the overall n8n workflow.

How it Works

The entire process is initiated by an n8n trigger, specifically a Schedule Trigger, running every two hours and fifteen minutes.


  1. Credential Selection: The n8n workflow first retrieves a list of Instagram session cookies stored in SharePoint. A specialized LangChain Agent n8n node analyzes the current time and deterministically selects a cookie for the current execution cycle, providing intelligent rotation.

  2. Scraping Initiation: The workflow identifies the target Instagram profiles from a list stored in a SharePoint CSV. It then launches the Phantombuster Profile Extractor Agent using the selected session cookie to scrape the latest posts from those profiles.

  3. Data Retrieval & Selection: After a mandated Wait period, the n8n node logic fetches the resulting data (post URLs) from Phantombuster. A Code n8n node then selects a single random post URL from the scraped list to be liked.

  4. Duplicate Check: The n8n workflow downloads a master CSV file from SharePoint containing all previously liked posts. Custom Code n8n node logic checks if the randomly selected post URL is already present. If it is a duplicate, the process restarts the selection or ends the current run using an If n8n node.

  5. State Update: If the post is new, the URL is appended to the master 'liked' file, which is then converted to CSV and re-uploaded to SharePoint, ensuring permanent state tracking.

  6. Liking Action: A new, temporary one-row CSV containing only the target post URL is generated and uploaded to SharePoint. The Phantombuster Autoliking Agent is then launched, configured to use this newly uploaded single-post CSV link as its input, thereby instructing it to like the specified post. This completes the action for this execution of the n8n workflow.

Installation Guide

To deploy this comprehensive n8n workflow, follow these steps:


  1. Import: Copy the provided JSON data and paste it into your n8n instance using the 'New' -> 'Import from JSON' function.

  2. Credentials Setup:

Microsoft SharePoint OAuth2: Set up credentials for accessing your SharePoint environment where the Instagram cookie list, profile list, and liked post history CSV files are stored.
Phantombuster API: Provide your Phantombuster API key credentials.
OpenAI API: Provide OpenAI credentials, as the Select Cookie n8n node uses a LangChain Agent which relies on an OpenAI model for its decision-making logic.

  1. File Configuration: Ensure the following files exist in your designated SharePoint folder (as referenced in the SharePoint n8n node parameters):

instagramsessioncookies.txt (JSON array of cookies for rotation).
instagramprofilestoscrape.csv (List of profile URLs the workflow should target).
instagram
postsalreadyliked.csv (The persistent history log).

  1. Activation: Once credentials and file paths are correctly configured within each relevant n8n node, activate the n8n workflow. The Schedule Trigger will handle the rest, ensuring the automation runs periodically.

Node Details

Schedule Trigger (n8n trigger): Initiates the n8n workflow execution every 2 hours and 15 minutes, maintaining safe operational pacing.
Get Available Session Cookies (Microsoft SharePoint n8n node): Downloads the file containing Instagram session cookies from SharePoint.
Select Cookie (LangChain Agent n8n node): Uses a complex time-based logic, powered by OpenAI, to select one session cookie from the list for the current run, crucial for account security in this n8n template.
Get Profile Extractor Agent (Phantombuster n8n node): Retrieves the specific agent ID needed to scrape Instagram profiles.
Launch Agent (Phantombuster n8n node): Starts the profile scraping operation, passing the required sessionCookie and the SharePoint URL of the target profile list.
Prepare Posts (Code n8n node): Custom JavaScript logic within this n8n node cleans and transforms the raw result data from Phantombuster into usable JSON items.
Get Random Post (Code n8n node): Selects a single, random post URL from the scraped results, ensuring varied engagement.
Download file / Extract from File (SharePoint & CSV n8n nodes): These nodes manage the history log, fetching and parsing the list of previously liked posts.
Check if in List / If (Code & If n8n nodes): Core logic n8n nodes that verify if the selected post is a duplicate, preventing repeated actions, which is a vital feature of this n8n workflow.
Create CSV Binary (Code n8n node): Generates a temporary, single-row CSV file containing only the URL of the post to be liked.
Upload CSV (Microsoft SharePoint n8n node): Uploads the single-post CSV to SharePoint so the Phantombuster Autoliker can access the input via URL.
Launch AL Agent (Phantombuster n8n node): Executes the actual liking action using the new input CSV and the rotated session cookie, demonstrating the power of this comprehensive n8n template.

Related n8n Workflows

Free

Nodes: 13 Nodes
Updated: December 26 2025
View all
Created by

Hi, I'm Gerhard from Plemeo. At plemeo.ai, we focus on AI-driven automation and workflow optimization. Our deep expertise with n8n enables us to streamline processes and boost efficiency in software development. This allows us to deliver real, measurable improvements. Curious how plemeo.ai and n8n can benefit your business? Reach out at [email protected] or visit plemeo.ai.

Featured*