🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Instagram + Google Sheets: DMs and posts, handled

Lisa Granqvist Partner Workflow Automation Expert

Instagram DMs come in fast, and the “I’ll reply later” pile gets ugly. Meanwhile, your content calendar lives in five places and somehow none of them are accurate.

This Instagram Sheets automation hits marketing managers hardest, but solo founders and small agency teams feel it too. You get quicker DM responses, fewer missed leads, and a Google Sheets plan that stays current without constant manual updates.

Below is what the workflow does, what it replaces, and how you can set it up in n8n without turning your week into a “debugging project.”

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: Instagram + Google Sheets: DMs and posts, handled

The Problem: DMs and content planning fall out of sync

Instagram is two jobs at once. You’re expected to reply quickly to DMs (because leads cool off fast), and you’re also supposed to publish consistently (because the feed punishes gaps). In real life, that turns into switching between apps all day, copying snippets into notes, and trying to remember what you promised a prospect. One missed message becomes a missed sale. One “we’ll post it tomorrow” becomes a week with no posts and a calendar that no one trusts.

It adds up fast. Here’s where it typically breaks down.

  • DM replies get delayed because you’re not always in Instagram, especially during meetings or client work.
  • Manual triage is exhausting, so important messages blend in with noise and you overlook the ones that matter.
  • Monthly content planning sounds great until you still have to write captions, prompts, and dates one row at a time.
  • Your calendar becomes “best effort,” which means you keep re-planning instead of executing.

The Solution: One workflow that routes DMs and builds your posting plan

This workflow turns Instagram management into a calmer, repeatable system using n8n, Telegram, Google Sheets, and an AI agent. It handles two big streams of work. First, incoming messages are monitored and routed into Telegram so you can respond from one place, with the AI helping decide what kind of response or action is needed. Second, your content planning is generated on a schedule: a monthly run creates about 30 post ideas based on your brand personality, then a daily run refines the caption and image prompt, generates an image, and updates your Google Sheet so the plan stays usable. If you also automate posting, it can even publish via an external actor.

It starts either when a message arrives (through Telegram routing) or when a scheduler runs (hourly follow actions, monthly planning, daily refinement and posting). From there, AI classifies intent, n8n pulls or writes rows in Google Sheets, and HTTP requests send work to services like Apify and Replicate. The output is simple: Telegram replies for DMs, and a “posts generation plan” sheet that stays filled with captions, prompts, dates, and image URLs.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you get about 15 DMs a day that deserve a real reply. Manually, opening Instagram, reading context, replying, and logging anything useful can take roughly 5 minutes each, so you lose about an hour daily. With this workflow, DMs get routed into Telegram and the AI drafts or triggers the right action, so you spend maybe 1 minute approving and sending most replies. That’s close to 45 minutes back per day, plus a Google Sheet that auto-fills around 30 posts each month instead of you writing them line by line.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Telegram for routing and replying to messages
  • Google Sheets to store your monthly post plan
  • OpenRouter API key (get it from your OpenRouter dashboard)
  • Instagram session ID (extract from browser cookies after login)
  • Apify token (get it from Apify account settings)
  • Replicate API access for image generation via HTTP requests

Skill level: Intermediate. You’ll be pasting API keys, confirming permissions, and tweaking prompts, but you won’t be writing a full app.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

DM trigger and routing. A Telegram trigger listens for new messages, then the workflow filters for the user and message format you care about before sending it into the AI agent.

Intent and context handling. The AI agent (backed by an OpenRouter chat model and simple memory) decides if this is a normal “chat back” reply, a request to run an Instagram action, or a profile lookup. That decision is parsed into structured output so the workflow can route reliably.

Content planning on schedules. On a monthly schedule, the workflow generates around 30 or 31 post ideas based on your Instagram personality JSON, then appends them into your Google Sheet. Each day, it grabs today’s row, refines the image prompt and caption, generates an image (via an HTTP request), and writes the improved content and image URL back into the sheet.

Actions and notifications. For DM actions and confirmations, it sends replies back in Telegram. For posting and follow actions, it calls external services (Apify actors) and updates Google Sheets so you can see what happened.

You can easily modify the personality profile and your posting cadence to match your brand and workload. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Schedule Triggers

Set the timing for hourly DM monitoring, daily posting, monthly content generation, and follow actions.

  1. Open Hourly Scheduler and keep the interval rule set to hours (it currently runs every hour).
  2. Open Daily Posting Scheduler and confirm the schedule includes triggerAtHour set to 9.
  3. Open Monthly Content Scheduler and keep the interval field set to months for monthly generation.
  4. Open Follow Schedule Trigger and set the interval rule to your preferred cadence (the current interval is blank, so define it explicitly).

Tip: If you want a faster dry run, temporarily change each schedule to a shorter interval, then revert after testing.

Step 2: Connect Google Sheets

These nodes read and write the post plan and follow lists. Connect Google Sheets credentials and confirm sheet IDs.

  1. In Retrieve Follow Targets, set the Google Sheet document to [YOUR_ID] and confirm the sheet name is Sheet1.
  2. In Mark Followed Users, ensure Operation is update and mapping includes followed set to TRUE.
  3. In Append Monthly Posts, keep Operation as appendOrUpdate and matching column scheduledDate.
  4. In Get Today Post Row, keep the filter lookup for scheduledDate with {{ $json.date }}.
  5. In Write Enhanced Prompts, confirm Operation is appendOrUpdate and mapping auto maps enhanced fields.
  6. In Update Image Row and Lookup Image Rows, confirm the document is posts generation plan and sheet is Sheet1.

Credential Required: Connect your googleSheetsOAuth2Api credentials to Retrieve Follow Targets, Mark Followed Users, Append Monthly Posts, Get Today Post Row, Write Enhanced Prompts, Update Image Row, and Lookup Image Rows.

⚠️ Common Pitfall: Leaving [YOUR_ID] placeholders in documentId will cause Google Sheets lookups to fail.

Step 3: Set Up Telegram Message Intake and Intent Routing

This path handles inbound Telegram messages and routes them into chat, agent tasks, or profile lookups.

  1. Open Telegram Message Trigger and keep updates set to message.
  2. In Set Chat Variables, replace [CONFIGURE_YOUR_API_KEY], [YOUR_ID], [YOUR_NAME], and [YOUR_LOCATION] inside the jsCode block.
  3. In Route Incoming Message, confirm the rules check {{ $json.message.from.username }} equals your ID and that {{ $json.message.text }} exists.
  4. In Map Message Text, keep the assignment message.text set to {{ $json.message.text }}.
  5. In Intent Classifier Agent, keep text set to {{ $json.message.text }} and confirm hasOutputParser is enabled.
  6. Verify Action Decision Router has actions for chat_back, run_agent, and get_instagram_profile.

Credential Required: Connect your telegramApi credentials to Telegram Message Trigger.

Credential Required: Connect your openRouterApi credentials to Primary LLM Router. Structured Result Parser is a sub-node for Intent Classifier Agent, so credentials must be set on Primary LLM Router, not on the parser.

⚠️ Common Pitfall: If Set Chat Variables still contains placeholder IDs, the Apify requests will fail downstream.

Step 4: Set Up Monthly Content Generation

This flow creates the monthly post plan and stores it in Google Sheets.

  1. In Set Monthly Variables, replace placeholders inside user_personality with your Instagram profile details.
  2. In Monthly Post Generator, keep the prompt text and confirm hasOutputParser is enabled.
  3. Ensure Content LLM Router uses the model google/gemini-2.5-flash-preview.
  4. In Parse Generated Posts, keep the JSON parsing script that removes ```json wrappers.
  5. Verify the execution flow is Monthly Post GeneratorParse Generated PostsAppend Monthly Posts.

Credential Required: Connect your openRouterApi credentials to Content LLM Router (used by Monthly Post Generator).

Step 5: Set Up Daily Post Enhancement and Image Pipeline

This path selects today’s post, enhances it, generates an image, and updates the sheet with the result.

  1. In Set Daily Variables, replace [CONFIGURE_YOUR_API_KEY] and profile placeholders in the jsCode block.
  2. In Format Today Date, keep the script that sets date to YYYY-MM-DD.
  3. In Enhance Post Content, keep the JSON input structure for row_number, imagePrompt, caption, and scheduledDate.
  4. Ensure Enhancement LLM Router uses google/gemini-2.5-flash-preview.
  5. In Generate Image via Replicate, confirm the JSON body includes prompt set to {{ $json.enhancedImagePrompt }} and Authorization header uses Bearer [CONFIGURE_YOUR_TOKEN].
  6. In Update Image Row, keep image_url mapped to {{ $json.output }} and enhancedImagePrompt mapped to {{ $json.input.prompt }}.

Credential Required: Connect your openRouterApi credentials to Enhancement LLM Router (used by Enhance Post Content).

⚠️ Common Pitfall: The Replicate API token is in the request header for Generate Image via Replicate; if you do not replace [CONFIGURE_YOUR_TOKEN], image generation will fail.

Step 6: Configure Follow and DM Automation

This branch monitors DMs hourly and performs follow actions from your Google Sheets list.

  1. In Set DM Variables and Set Follow Variables, replace [CONFIGURE_YOUR_API_KEY] and profile placeholders in the jsCode blocks.
  2. In Monitor DM via Apify, confirm the JSON body uses {{ $json.user_personality }}, {{ $json.instagram_session_id }}, and {{ $json.openrouterApiKey }}.
  3. In Retrieve Follow Targets, keep the filter where followed lookup value is = to fetch unfollowed users.
  4. In Trim User List, keep the JavaScript slice to the first 5 usernames.
  5. In Execute Follow Actor, keep the JSON body with action set to follow_instagram_users and the usernames array from {{ $json.usernames.map(item => `\"${item}\"`) }}.
  6. Ensure the flow is Retrieve Follow TargetsTrim User ListExecute Follow ActorExpand Followed UsersMark Followed Users.

⚠️ Common Pitfall: All Apify nodes use [CONFIGURE_YOUR_TOKEN] in the URL; replace it in Monitor DM via Apify and Execute Follow Actor.

Step 7: Configure Telegram Responses and Apify Actions

The action router sends Telegram replies and executes Apify tasks based on intent.

  1. In Telegram Chat Reply, keep text set to {{ $json.output.outputMsg }} and chatId set to {{ $('Telegram Message Trigger').item.json.message.chat.id }}.
  2. In Run Agent via Apify and Fetch Profile via Apify, keep the JSON body with task set to {{ $json.output.inputMsg.replaceAll('\n', ' ').replaceAll('\"', '\\\"').trim() }}.
  3. In Telegram Status Reply and Telegram Profile Reply, keep the response format {{ $json.status }}:{{ $json.result }}.
  4. In Publish Post via Apify, keep the JSON body fields for caption and image_data and confirm it references {{ $('Set Daily Variables').item.json.instagram_session_id }}.

Credential Required: Connect your telegramApi credentials to Telegram Chat Reply, Telegram Status Reply, and Telegram Profile Reply.

⚠️ Common Pitfall: Apify nodes rely on the [CONFIGURE_YOUR_TOKEN] URL query parameter. Update it in Run Agent via Apify, Fetch Profile via Apify, and Publish Post via Apify.

Step 8: Test and Activate Your Workflow

Verify each path works end-to-end before enabling production schedules.

  1. Click Execute Workflow and send a Telegram message to trigger Telegram Message TriggerSet Chat VariablesIntent Classifier AgentAction Decision Router.
  2. Run Monthly Content Scheduler manually and confirm rows are added by Append Monthly Posts.
  3. Run Daily Posting Scheduler manually and verify updates in Google Sheets from Write Enhanced Prompts and Update Image Row.
  4. Run Follow Schedule Trigger manually and confirm Mark Followed Users marks users as TRUE.
  5. When results look correct, toggle the workflow to Active to enable the schedules.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • Google Sheets credentials can expire or need specific permissions. If things break, check the n8n Credentials panel and your Google Cloud OAuth consent settings 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.
  • OpenRouter prompts are only as good as your “personality” JSON. Honestly, if you don’t define tone, offers, and boundaries, you will end up rewriting captions every day.

Frequently Asked Questions

How long does it take to set up this Instagram Sheets automation automation?

About 60 minutes if you already have your API keys ready.

Do I need coding skills to automate Instagram Sheets automation?

No. You’ll mostly connect accounts and paste keys. Some light prompt editing is the “hardest” part.

Is n8n free to use for this Instagram Sheets automation workflow?

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 OpenRouter usage-based AI costs and image generation costs if you use Replicate.

Where can I host n8n to run this automation?

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.

Can I customize this Instagram Sheets automation workflow for a different brand voice and posting cadence?

Yes, and you should. Update the Instagram “personality” JSON in the Variables/Code nodes that set tone and preferences, then adjust the Monthly Content Scheduler and Daily Posting Scheduler to match how often you actually post. Common tweaks include swapping the OpenRouter model, changing the caption format (fewer hashtags, different CTA), and adding an approval step before the “Publish Post via Apify” request runs.

Why is my Google Sheets connection failing in this workflow?

Usually it’s expired OAuth access or the wrong Google account. Reconnect Google Sheets in n8n Credentials, then confirm the spreadsheet is shared with the same account and that the workflow has write access. If it fails only on updates, check if your sheet headers changed, because the “Update row” step can break when columns are renamed.

How many posts and DM replies can this Instagram Sheets automation automation handle?

Plenty for a small team: think dozens of DMs a day and a monthly batch of about 30 posts.

Is this Instagram Sheets automation automation better than using Zapier or Make?

Often, yes, because this workflow isn’t a simple “if DM then send message” zap. You’re doing intent classification, branching, scheduled generation, row updates, and external HTTP calls to services like Apify and Replicate, which gets expensive or awkward in tools that price by task. n8n also gives you the self-host option, which matters if your inbox volume grows. Zapier or Make can still be fine for a tiny version of this (basic Telegram alerts, simple Sheets logging). If you want help choosing, Talk to an automation expert.

Once this is running, your inbox stops being a risk and your posting plan stops being a guessing game. The workflow handles the repetitive stuff. You handle the conversations and decisions that actually move revenue.

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.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal