n8n + Instagram Integration: Automate Posts, DMs & Analytics
Connecting n8n to Instagram opens up a range of automations that social media managers, agencies, and e-commerce teams can use to save hours every week. Instead of manually posting content, triaging DMs, or pulling engagement numbers into spreadsheets, you can build workflows that handle it all on autopilot. The Instagram Business API (part of the Meta Graph API) gives you programmatic access to publishing, messaging, comments, and insights — and n8n is the perfect tool to tie it all together.
How n8n Connects to Instagram
Instagram doesn't have a dedicated built-in node in n8n, but that's not a limitation. The HTTP Request node gives you full access to every endpoint in the Meta Graph API. You can also use n8n's OAuth2 credential type to handle authentication cleanly, so tokens refresh automatically without manual intervention.
The key endpoints you'll work with are:
POST /{ig-user-id}/media— create a media container for publishingPOST /{ig-user-id}/media_publish— publish the containerGET /{ig-user-id}/conversations— retrieve DM threadsGET /{ig-media-id}/comments— pull comments on a postGET /{ig-user-id}/insights— fetch account-level analytics
All of these work through standard HTTP requests in n8n, meaning you have the same flexibility as a custom-coded integration but with a visual workflow builder.
Setting Up Instagram API Credentials in n8n
Before building any workflow, you need a Meta App with Instagram Graph API access. Here's the setup:
- Go to Meta for Developers and create a new app (select "Business" type).
- Add the Instagram Graph API product to your app.
- Connect your Instagram Business or Creator account through a linked Facebook Page.
- Generate a long-lived access token (valid for 60 days) or configure OAuth2 for automatic refresh.
- In n8n, create a new Header Auth credential or an OAuth2 API credential with your app's client ID, client secret, and token URL (
https://graph.facebook.com/oauth/access_token).
Once your credentials are saved, every HTTP Request node in your workflows can reference them — no need to paste tokens manually.
Tip: Use n8n's built-in credential sharing to give team members access to the Instagram API without exposing the raw token. If you're running your instance on n8nautomation.cloud, your credentials are encrypted at rest and backed up automatically.
Schedule Instagram Posts Automatically
This workflow pulls content from a Google Sheet (or Notion database, Airtable — whatever you use as a content calendar) and publishes it to Instagram on a schedule.
Workflow structure:
- Schedule Trigger node — fires at your desired posting time (e.g., every day at 9 AM).
- Google Sheets node — reads the next row where the "Status" column is "Ready".
- HTTP Request node (Create Container) — sends a POST to
/{ig-user-id}/mediawith theimage_urlandcaptionfrom your spreadsheet. - HTTP Request node (Publish) — takes the
creation_idfrom the previous step and POSTs to/{ig-user-id}/media_publish. - Google Sheets node (Update) — marks the row status as "Published" with a timestamp.
For carousel posts, the flow adds an extra loop: create a container for each image first, then create a carousel container referencing all child IDs, then publish. n8n's Loop Over Items node handles this cleanly.
For Reels, use the same /media endpoint but pass media_type=REELS and a video_url instead. The API processes the video asynchronously, so add a Wait node (30-60 seconds) before the publish step, or use a polling loop to check the container status.
Route Instagram DMs to Your CRM
If your business gets customer inquiries through Instagram DMs, manually checking them is a bottleneck. This workflow routes new messages into your CRM or helpdesk automatically.
Workflow structure:
- Webhook node — receives real-time updates from Instagram's Webhooks API (subscribe to the
messagesfield on your Instagram account). - IF node — filters out echo messages (messages your account sent) by checking
message.is_echo. - HTTP Request node — fetches the sender's Instagram profile info from
/{user-id}?fields=name,username,profile_picture_url. - Switch node — routes based on message content. Keywords like "order", "shipping", or "return" go to your e-commerce support queue. Everything else goes to general inquiries.
- HubSpot/Pipedrive/Salesforce node — creates or updates a contact with the Instagram username, then logs the message as an activity or note.
- Slack node — optionally notifies your team in a dedicated channel so someone can respond quickly.
This setup means no DM falls through the cracks, and your CRM has a complete record of Instagram conversations alongside email and phone interactions.
Automate Instagram Comment Moderation with AI
High-volume accounts can't manually review every comment. This workflow uses n8n's AI capabilities to classify and moderate comments automatically.
Workflow structure:
- Webhook node — receives comment notifications via Instagram Webhooks (subscribe to the
commentsfield). - HTTP Request node — fetches the full comment text and author info from
/{comment-id}?fields=text,username,timestamp. - OpenAI node (or any LLM) — sends the comment text to an AI model with a prompt like: "Classify this Instagram comment as: positive, question, spam, or toxic. Respond with only the category."
- Switch node — routes based on the AI classification:
- Spam/Toxic → HTTP Request node to
DELETE /{comment-id}(hides the comment) and logs it to a Google Sheet for review. - Question → Slack notification to your social team with the comment text and a direct link to respond.
- Positive → HTTP Request node to
POST /{comment-id}/replieswith a thank-you response (optional, use sparingly).
- Spam/Toxic → HTTP Request node to
The AI classification step takes milliseconds and handles context far better than simple keyword matching. You can fine-tune the prompt to match your brand's moderation policy.
Build an Engagement Analytics Dashboard with n8n
Instead of logging into Instagram Insights every morning, build a workflow that pulls your metrics and pushes them wherever you need them.
Workflow structure:
- Schedule Trigger node — fires daily at 7 AM.
- HTTP Request node (Account Insights) — GET
/{ig-user-id}/insightswith metrics likeimpressions,reach,follower_count,profile_views, and a period ofday. - HTTP Request node (Recent Media) — GET
/{ig-user-id}/media?fields=id,caption,like_count,comments_count,timestamp,permalinkto pull per-post performance. - Google Sheets node — appends a new row with the date and all metrics. Over time, this builds a historical dataset you can chart or analyze.
- Slack/Email node — sends a formatted daily summary: "Yesterday: 12,450 impressions, 340 profile views, +28 followers. Top post: [link] with 892 likes."
For agencies managing multiple client accounts, wrap this in a loop that iterates over a list of Instagram account IDs and tokens stored in a database or spreadsheet. Each client gets their own row or their own sheet tab.
Running this on n8nautomation.cloud means your scheduled triggers fire reliably — no worrying about your server going down overnight and missing the morning report.
Auto-Reply to Story Mentions
When someone mentions your brand in their Instagram Story, it's a high-intent engagement signal. This workflow sends an automatic DM to thank them — a tactic used by D2C brands to boost loyalty and encourage user-generated content.
Workflow structure:
- Webhook node — listens for
story_insightsormentionswebhook events from Instagram. - IF node — checks that the mention is from a story (not a comment or caption mention).
- HTTP Request node — fetches the mentioning user's profile to get their username and follower count.
- Switch node — optionally segments by follower count. Users with 10k+ followers could get a different response (e.g., an invitation to your ambassador program).
- HTTP Request node (Send DM) — POSTs to
/{ig-user-id}/messageswith a personalized thank-you message: "Hey @username, thanks for sharing! We love seeing our products in the wild 🙌" - Google Sheets node — logs every mention with the username, follower count, and timestamp for your marketing team to review.
Tip: Instagram rate-limits the Messaging API to around 250 messages per user per 24 hours for standard access. If you're a high-volume account, apply for Advanced Access through Meta's App Review to increase your limits.
All five of these workflows run as background processes on your n8n instance. There's no browser extension to break, no third-party scheduling tool to pay for, and no manual exports. Your automations live in one place, version-controlled through n8n's built-in workflow export, and running 24/7 on a dedicated instance at n8nautomation.cloud.
The Instagram Graph API is well-documented and stable, and n8n's HTTP Request node gives you access to every endpoint without waiting for a dedicated node to be built. If you can call an API, you can automate it in n8n — and Instagram is no exception.