Phantombuster + SharePoint: smarter Instagram comments
You try to keep up with Instagram comments for “engagement,” but it turns into a daily chore. You bounce between posts, repeat yourself, and still miss good moments to show up.
This hits social media managers first, honestly. But influencers and small marketing teams feel the same squeeze, especially when you want Instagram comment automation that doesn’t look spammy.
This workflow uses Phantombuster to comment, and SharePoint to track what was already handled, so you can scale replies without repeating yourself. You’ll see how it works, what you need, and what to tweak so it fits your brand voice.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Phantombuster + SharePoint: smarter Instagram comments
flowchart LR
subgraph sg0["Schedule Flow"]
direction LR
n0@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model", pos: "b", h: 48 }
n1@{ icon: "mdi:cog", form: "rounded", label: "Wait1", pos: "b", h: 48 }
n2["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Get Random Post"]
n3@{ icon: "mdi:robot", form: "rounded", label: "Create Comment", pos: "b", h: 48 }
n4["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Create CSV Binary"]
n5@{ icon: "mdi:cog", form: "rounded", label: "Upload CSV", pos: "b", h: 48 }
n6["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/phantombuster.png' width='40' height='40' /></div><br/>Get Autocomment Agent"]
n7["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/phantombuster.png' width='40' height='40' /></div><br/>Launch AC Agent"]
n8["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/phantombuster.png' width='40' height='40' /></div><br/>Get Response"]
n9@{ icon: "mdi:swap-vertical", form: "rounded", label: "Set ENV Variables", pos: "b", h: 48 }
n10@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger", pos: "b", h: 48 }
n11@{ icon: "mdi:cog", form: "rounded", label: "Update file", pos: "b", h: 48 }
n12@{ icon: "mdi:cog", form: "rounded", label: "Download file", pos: "b", h: 48 }
n13["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Check if in List"]
n14@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If", pos: "b", h: 48 }
n15@{ icon: "mdi:cog", form: "rounded", label: "Wait2", pos: "b", h: 48 }
n16["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Prepare Updated Data"]
n17@{ icon: "mdi:cog", form: "rounded", label: "Extract from File", pos: "b", h: 48 }
n18@{ icon: "mdi:cog", form: "rounded", label: "Convert to File", pos: "b", h: 48 }
n19@{ icon: "mdi:cog", form: "rounded", label: "Get Available Session Cookies", pos: "b", h: 48 }
n20@{ icon: "mdi:cog", form: "rounded", label: "Extract Cookies", pos: "b", h: 48 }
n21@{ icon: "mdi:robot", form: "rounded", label: "Select Cookie", pos: "b", h: 48 }
n22@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model2", pos: "b", h: 48 }
n23["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/phantombuster.png' width='40' height='40' /></div><br/>Get Profile Extractor Agent"]
n24@{ icon: "mdi:cog", form: "rounded", label: "Get List of Accounts", pos: "b", h: 48 }
n25@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If Empty", pos: "b", h: 48 }
n26["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>HTTP Request"]
n27["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>HTTP Request1"]
n28["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Prepare Posts"]
n29@{ icon: "mdi:cog", form: "rounded", label: "Wait3", pos: "b", h: 48 }
n30["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/phantombuster.png' width='40' height='40' /></div><br/>Launch Agent1"]
n14 --> n15
n14 --> n16
n1 --> n8
n15 --> n2
n29 --> n26
n25 --> n15
n5 --> n6
n11 --> n3
n26 --> n27
n12 --> n17
n27 --> n28
n30 --> n29
n28 --> n25
n21 --> n9
n3 --> n4
n18 --> n11
n20 --> n21
n2 --> n12
n7 --> n1
n13 --> n14
n10 --> n19
n4 --> n5
n17 --> n13
n0 -.-> n3
n9 --> n23
n22 -.-> n21
n24 --> n30
n16 --> n18
n6 --> n7
n23 --> n24
n19 --> n20
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n10 trigger
class n3,n21 ai
class n0,n22 aiModel
class n14,n25 decision
class n26,n27 api
class n2,n4,n13,n16,n28 code
classDef customIcon fill:none,stroke:none
class n2,n4,n6,n7,n8,n13,n16,n23,n26,n27,n28,n30 customIcon
The Problem: Scaling comments without looking repetitive
Commenting is one of the easiest ways to stay visible on Instagram, but doing it manually gets messy fast. You open a profile, skim posts, think of something “unique,” then do it again on the next post and the next account. After a week, you can’t remember what you already commented on, so you either double-comment (awkward) or hesitate and do nothing (wasted opportunity). And when multiple people touch the same accounts, duplicate replies become almost guaranteed. It’s not hard work. It’s draining work.
The friction compounds. Here’s where it usually breaks down.
- Picking posts by hand burns time, because you’re scrolling just to find something worth replying to.
- Without a shared log, you will eventually comment twice on the same post and it makes the account look careless.
- Team members can’t coordinate reliably, so you either slow down to “be safe” or accept the mistakes.
- Generic comments feel like automation, which means you end up rewriting everything anyway.
The Solution: Phantombuster comments + SharePoint “already done” tracking
This n8n workflow runs on a schedule (every 2 hours) and comments on posts from Instagram profiles you choose, pulled from a simple CSV list. It uses Phantombuster to fetch recent posts, then randomly selects one so you’re not hammering the same content repeatedly. Before it posts anything, it checks a SharePoint file that acts like a memory: a running list of Instagram post URLs that have already been commented on. If the post is already in that list, the workflow skips it and moves on. If it’s new, OpenAI (GPT-4o) generates a short reply (under 150 characters) in your chosen language, builds a CSV for Phantombuster’s commenting agent, posts the comment, and then logs the post URL back to SharePoint so it won’t be touched again.
The workflow starts with a scheduled trigger and a rotating set of Instagram session cookies (also stored in SharePoint) to stay within platform limits. Then it extracts posts, filters duplicates using the SharePoint “already commented” file, generates a brand-safe comment, and lets Phantombuster publish it. Finally, it updates the SharePoint log so the next run stays clean.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you track 10 Instagram profiles and you normally comment on 2 posts per profile per week. Manually, even if you spend only 5 minutes to find a post and write something decent, that’s about 100 minutes weekly. With this workflow, you spend maybe 20 minutes once setting up the profile list, cookies, and prompt, then each run is automatic (the waiting/processing happens in the background). In practice, most teams go from “we’ll do it when we can” to steady commenting without babysitting it.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Phantombuster to run the Instagram AutoComment agent.
- Microsoft SharePoint to store CSVs and the “already commented” log.
- OpenAI API key (get it from your OpenAI API dashboard).
Skill level: Intermediate. You’ll connect accounts, upload a few CSV files, and adjust a prompt, but you don’t need to write code from scratch.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A scheduled run kicks things off. The workflow starts with a schedule trigger set to run every 2 hours, so your commenting cadence stays consistent without daily reminders.
It loads your inputs from SharePoint. n8n downloads your tracked profile list (profiles_instagram.csv) and also pulls a cookie file used for Instagram sessions, then selects one cookie to use for this run.
Posts get collected, filtered, and chosen. Phantombuster extracts recent posts (up to 20 per profile), the workflow prepares the post links, and then checks your SharePoint “already commented” CSV to avoid duplicates. If everything is already handled, it pauses and tries again later.
AI writes the comment, and Phantombuster publishes it. GPT-4o generates a short comment in your chosen language, n8n builds the CSV Phantombuster expects, and the AutoComment agent posts it. After that, the workflow updates the SharePoint log with the post URL so it stays “one comment per post” going forward.
You can easily modify the comment prompt and language to match your brand voice based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Scheduled Run Trigger
Set the workflow timing so it runs automatically every two hours at the half-hour mark.
- Add and open Scheduled Run Trigger.
- Set the schedule rule to Hours Interval with
2and Trigger At Minute to30. - Ensure Scheduled Run Trigger connects to Load Session Cookies.
Step 2: Connect SharePoint data sources and files
These nodes load session cookies, profile lists, and previously commented posts, then update the tracking file.
- Open Load Session Cookies and select the file
instagram_session_cookies.txtin your SharePoint site and folder. - Credential Required: Connect your
microsoftSharePointOAuth2Apicredentials in Load Session Cookies. - Open Retrieve Account List and confirm File Name is
instagram_profiles_to_scrape.csv. - Credential Required: Connect your
microsoftSharePointOAuth2Apicredentials in Retrieve Account List. - Open Download Commented File and select
instagram_posts_already_commented.csv. - Credential Required: Connect your
microsoftSharePointOAuth2Apicredentials in Download Commented File and Update Commented File.
⚠️ Common Pitfall: Ensure the SharePoint folders and file IDs match across Load Session Cookies, Retrieve Account List, Download Commented File, and Update Commented File to avoid file-not-found errors.
Step 3: Set up session cookie selection and environment variables
This section extracts the cookies and selects one based on Berlin time, then stores values for downstream agents.
- Open Extract Cookie Text and set Operation to
text. - Open Choose Session Cookie and verify the prompt includes the expressions
{{ $now.setZone('Europe/Berlin').format('DD HH:mm:ss') }},{{ $now.setZone('Europe/Berlin').format('HH') }}, and{{ $json.data }}. - Open Assign ENV Values and set ENV_SESSION_COOKIE to
{{ $('Choose Session Cookie').first().json.output.parseJson().session_cookie }}. - In Assign ENV Values, set ENV_COMMENT_PROMPT to
Erstelle einen ansprechenden Instagram-Kommentar basierend auf dem gegebenen Post-Inhalt.and ENV_COMMENT_LANGUAGE toDeutsch.
Credential Required: Connect your openAiApi credentials in OpenAI Chat Engine B. This model is linked to Choose Session Cookie, so credentials must be added to the parent model node.
Step 4: Configure Phantombuster extractor and post list retrieval
This chain fetches a profile extractor, runs it, waits, and downloads a filtered list of post URLs.
- Open Fetch Profile Extractor and set Agent ID to your Phantombuster agent ID (replace
[YOUR_ID]). - Credential Required: Connect your
phantombusterApicredentials in Fetch Profile Extractor, Run Extractor Agent, Primary API Request, and Secondary API Request. - Open Run Extractor Agent and ensure Agent ID is set to
{{ $('Fetch Profile Extractor').item.json.id }}. - In Run Extractor Agent, verify Arguments JSON includes
"spreadsheetUrl": "{{$('Retrieve Account List').item.json['@content.downloadUrl']}}"and"sessionCookie": "{{$('Assign ENV Values').item.json.ENV_SESSION_COOKIE}}". - Open Pause Gate 3 and set Amount to
30seconds. - Open Primary API Request and set URL to
https://api.phantombuster.com/api/v2/agents/fetch?id=[YOUR_ID]. - Open Secondary API Request and set URL to
=https://phantombuster.s3.amazonaws.com/{{ $json.data?.orgS3Folder || $json.orgS3Folder }}/{{ $json.data?.s3Folder || $json.s3Folder }}/filtered_result.csv. - Open Prepare Post Links and confirm the code parses the CSV into
{ postUrl }objects. - Open Empty List Check and ensure the condition is
{{ $json.isEmpty() }}equalstrueto skip empty lists.
⚠️ Common Pitfall: If the filtered CSV is empty, Empty List Check routes back to Pause Gate 2 and no comment is posted. Verify your extractor agent produces URLs.
Step 5: Prevent duplicates and update the commented posts list
This block avoids commenting on posts that were already processed, and updates the tracking CSV after new comments.
- Open Download Commented File and ensure it loads
instagram_posts_already_commented.csv. - Open Parse File Records and keep Header Row enabled.
- Open Detect Duplicate Post and confirm it compares
{{ $('Pick Random Post').first().json.postUrl }}against existing records. - Open Duplicate Check Gate and ensure the condition is
{{ $('Detect Duplicate Post').first().json.isDuplicate }}equalstrue. - Open Assemble Updated List to append the new post URL to the list.
- Open Convert Records File then Update Commented File and confirm File Name is
instagram_posts_already_commented.csvwith Change File Content enabled.
Step 6: Generate the comment and prepare the upload CSV
These nodes generate a short German comment, then turn it into a clean one-row CSV file for the Phantombuster comment agent.
- Open Pick Random Post and keep the code that selects
postUrlanddescriptionfrom the list. - Open Generate Comment and keep the prompt text using
{{ $('Assign ENV Values').first().json.ENV_COMMENT_PROMPT }},{{ $('Assign ENV Values').first().json.ENV_COMMENT_LANGUAGE }}, and{{ $('Pick Random Post').first().json.description }}. - Credential Required: Connect your
openAiApicredentials in OpenAI Chat Engine. This model is linked to Generate Comment, so credentials must be added to the parent model node. - Open Build CSV Binary and confirm the output file name is
phantombuster_clean.csv.
Step 7: Upload CSV and run the AutoComment agent
This section uploads the CSV to SharePoint, runs the comment agent, and retrieves its output after a short wait.
- Open Upload CSV File and set File Name to
instagram_post_to_comment.csvwith Operationupload. - Credential Required: Connect your
microsoftSharePointOAuth2Apicredentials in Upload CSV File. - Open Fetch AutoComment Agent and set Agent ID to your Phantombuster agent ID (replace
[YOUR_ID]). - Open Run AutoComment Agent and confirm Arguments JSON uses
{{ $('Assign ENV Values').first().json.ENV_SESSION_COOKIE }}and{{ $('Upload CSV File').item.json['@content.downloadUrl'] }}. - Open Pause Gate 1 and keep Amount at
30seconds before Retrieve Agent Output. - Credential Required: Connect your
phantombusterApicredentials in Fetch AutoComment Agent, Run AutoComment Agent, and Retrieve Agent Output.
Step 8: Test & Activate Your Workflow
Validate the end-to-end flow before scheduling it for production use.
- Click Execute Workflow and confirm that Scheduled Run Trigger starts the run and Load Session Cookies loads the cookie file.
- Check that Generate Comment returns an output string and Build CSV Binary creates
phantombuster_clean.csv. - Verify Upload CSV File uploads
instagram_post_to_comment.csv, and Run AutoComment Agent runs successfully. - Confirm Update Commented File updates
instagram_posts_already_commented.csvafter a successful comment cycle. - When satisfied, toggle the workflow to Active to enable the scheduled runs.
Common Gotchas
- Microsoft SharePoint credentials can expire or need specific permissions. If things break, check the SharePoint connection in n8n credentials and confirm the site/library access first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Frequently Asked Questions
About 45 minutes if your SharePoint and Phantombuster accounts are ready.
No. You’ll mostly connect accounts and edit a couple of CSV files and prompts.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API costs, which are usually only a few dollars a month at low volume.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, but plan it upfront. The quickest way is to duplicate the workflow and change the values in Assign ENV Values (language, prompt, and any brand rules), then point each version to its own SharePoint log file so brands never collide. If you want it in a single workflow, store brand settings in your profiles_instagram.csv and map them into the comment prompt before Generate Comment runs. Most people also add a short “do not mention” list so the AI avoids sensitive topics.
Usually it’s an expired or rotated API token in n8n, or the agent you’re calling was deleted or moved in Phantombuster. Also check the cookie source file in SharePoint, because invalid Instagram cookies can look like “Phantombuster is broken” when it’s really the session failing. If it dies right after running, increase the wait time before Retrieve Agent Output so the agent has time to finish.
It fetches up to 20 posts per profile each run, and the schedule is set to every 2 hours.
Often, yes, because this is not a simple two-step “when X then Y” zap. You’re juggling file parsing, duplicate detection, cookie rotation, waits, and a Phantombuster run that needs follow-up retrieval. n8n handles branching and code-heavy glue without punishing you for every extra step. Zapier or Make can still work if you simplify the workflow (for example, no duplicate log, no cookie rotation, and no agent output retrieval), but you’ll give up reliability. If you want the best fit for your volume and risk tolerance, Talk to an automation expert.
Set this up once and your commenting stops living in someone’s head. The workflow handles the repetitive parts, and you keep control over voice, pacing, and what gets logged.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.