Deploy n8n Instagram Automation

Self-host n8n in queue mode to schedule Instagram posts and alerts.

Deploy n8n Instagram Automation

/var/lib/postgresql/data

Just deployed

/home/node/.n8n

Just deployed

Just deployed

/data

Deploy and Host n8n Instagram Automation on Railway

n8n logo

This template runs n8n, the workflow automation tool with about 210,000 GitHub stars, as a production-ready stack for Instagram work: scheduling posts from a content calendar, writing AI captions, alerting your team about mentions and comments, and logging engagement to a sheet or CRM. n8n talks to Instagram through Meta's Instagram Graph API, using the built-in Facebook Graph API and HTTP Request nodes, and connects it to 400+ other apps such as Google Drive, Airtable, Slack and OpenAI. The stack uses queue mode: an editor service, a separate worker that runs executions, Redis as the job queue and PostgreSQL for workflows and credentials. n8n Cloud starts at €20/month for 2,500 executions. Here you pay about $10–25/month in Railway usage, with no per-execution or per-contact pricing.


What This Template Deploys

ServicePurpose
n8nThe editor and API on port 5678 with a public domain. Receives webhooks and Meta OAuth callbacks, and queues executions. Volume at /home/node/.n8n.
n8n-workerThe same n8nio/n8n:2.36.8 image started with n8n worker. Pulls jobs from Redis and runs them, including test runs from the editor.
RedisRedis 8.2 with a password and a volume. The Bull job queue between editor and worker.
PostgresPostgreSQL 18 with SSL and a volume. Workflows, credentials, users and execution history.

The editor generates a random N8N_ENCRYPTION_KEY at deploy time and the worker references it, so both can decrypt the same saved credentials. Public URLs come from the editor's Railway domain.


About Hosting n8n for Instagram

Instagram automation usually means three kinds of jobs: scheduled publishing, reacting to events such as comments and mentions, and reporting. All three suit n8n. A Schedule trigger can read tomorrow's posts from Google Sheets or Airtable, fetch images from Drive, ask an AI model for a caption, then publish through the Graph API. A webhook workflow can receive Meta notifications and post them to Slack. A nightly workflow can pull insights and append them to a spreadsheet.

Why queue mode. Publishing to Instagram is a two-step call: create a media container, wait until Meta finishes processing it, then publish. Videos and carousels can take a while. In queue mode those waits happen on the worker, so the editor stays responsive and webhooks are answered right away. Add more worker replicas when your volume grows.

What Instagram needs from you. The Graph API works only with a professional (Business or Creator) Instagram account linked to a Facebook Page. You create an app in Meta for Developers, add the Instagram permissions you need, such as instagram_basic and instagram_content_publish, and connect it in n8n. Your app's OAuth redirect and webhook URLs use this deployment's public domain, which WEBHOOK_URL is set to.

Keep the key safe. The encryption key protects every stored token, including your Meta access token. Don't change it after you save credentials, or n8n can no longer read them.

Typical cost: ~$10–25/month on Railway for four services at small scale. n8n Cloud Starter is €20/month for 2,500 executions and Pro is €50/month for 10,000. Chat-automation tools like ManyChat bill by active contacts instead.


Deploy n8n Instagram in Under 5 Minutes

  1. Click Deploy on Railway. Postgres, Redis, the editor and the worker start in a few minutes.
  2. Open the n8n service's public domain and create the owner account.
  3. In Meta for Developers, create an app, add Instagram, and set the OAuth redirect URL to the one n8n shows in its credential dialog.
  4. Add the credential in n8n, then import an Instagram workflow from the n8n template library or build your own.
  5. Activate the workflow. The worker picks up each run from the queue.

Check the Executions list in n8n to see each run and its data.


Common Use Cases

  • Content calendar publishing. Post images, carousels and reels from a Google Sheet or Airtable base on a schedule.
  • AI captions and hashtags. Generate captions with OpenAI or Claude from a brief, then route them to a human for approval.
  • Mention and comment alerts. Send new comments and @mentions to Slack, Discord or email so the team can respond fast.
  • Engagement reporting. Pull reach, likes and saves into a sheet or database every night.
  • Cross-posting. Publish the same asset to Instagram, Facebook, LinkedIn and X from one workflow.
  • Lead capture. Push people who comment a keyword into your CRM with a follow-up task.
  • Asset pipelines. Resize, watermark or convert media from Drive or S3 before it's posted.

Configuration

VariableRequiredDescription
N8N_ENCRYPTION_KEY🔐 Auto-generated48-character key on the editor; the worker references it.
WEBHOOK_URL, N8N_EDITOR_BASE_URL✅ Auto-sethttps:// plus the editor's public domain. Used for webhooks and OAuth callbacks.
N8N_HOST, N8N_PROTOCOL, N8N_PROXY_HOPS✅ SetPublic hostname, https and 1, so n8n builds correct URLs behind Railway's proxy.
EXECUTIONS_MODE✅ Setqueue, so executions run on the worker.
DB_TYPE, DB_POSTGRESDB_*✅ Auto-injectedPostgres connection, referenced from the Postgres service.
QUEUE_BULL_REDIS_*✅ Auto-injectedRedis host, port, user and password for the queue.
N8N_USER_FOLDER✅ Set/home/node on the editor, so its files land on the volume.
GENERIC_TIMEZONE✅ SetAsia/Kolkata. Change it to your timezone for Schedule triggers.
EXECUTIONS_DATA_PRUNE, EXECUTIONS_DATA_MAX_AGE✅ SetOld execution logs are deleted after 336 hours (14 days).
N8N_CONCURRENCY_PRODUCTION_LIMIT✅ Set10 production executions at a time.

Timezone first. Set GENERIC_TIMEZONE on both n8n services before you schedule posts, so they go out at the hour you expect.

Custom domain. Add your domain to the n8n service and redeploy both services; the URL variables follow it.


n8n on Railway vs. Alternatives

n8n on Railwayn8n CloudManyChatZapier
Monthly cost~$10–25 usageFrom €20By active contactsBy tasks
Self-hosted✅ Yes❌ No❌ No❌ No
Execution limits✅ None⚠️ Per plan✅ N/A⚠️ Per plan
Instagram publishing✅ Via Graph API✅ Via Graph API❌ DMs and comments focus⚠️ Limited actions
Custom code✅ JavaScript and Python✅ Yes❌ No⚠️ Limited
Data on your own infrastructure✅ Yes❌ Hosted❌ Hosted❌ Hosted
License⚠️ Sustainable Use (fair-code)⚠️ Hosted service❌ Proprietary❌ Proprietary

Dependencies for n8n Instagram Hosting

  • Railway account. Hobby works to start; Pro for more workers.
  • An Instagram Business or Creator account linked to a Facebook Page.
  • A Meta for Developers app with the Instagram permissions your workflows use.

Deployment Dependencies

Implementation Details

Both n8n services are pinned to n8nio/n8n:2.36.8. Newer 2.x releases exist; to upgrade, back up Postgres and change the tag on the editor and the worker together, since they must run the same version.

Both n8n services expose /healthz, and Railway restarts them if they fail. Execution history is kept for 14 days by default; raise EXECUTIONS_DATA_MAX_AGE on the editor if you need a longer record of what was posted and when.


Frequently Asked Questions

Is n8n open source? n8n is fair-code under its Sustainable Use License. You can self-host it for free for internal use, and the source is public, but it isn't an OSI-approved license.

How much does this cost compared with n8n Cloud? About $10–25/month on Railway with no execution cap. n8n Cloud Starter is €20/month for 2,500 executions and Pro is €50/month for 10,000.

What do I need from Instagram? A Business or Creator account linked to a Facebook Page, and a Meta developer app with publishing permissions.

Can it reply to DMs like ManyChat? n8n can call the Instagram messaging endpoints if your Meta app is approved for them, but ManyChat is simpler for chat flows. n8n is stronger for publishing, alerts and reporting.

Why use a separate worker? Uploads and waits on Meta's processing run on the worker, so the editor and webhooks stay fast. Add replicas to run more jobs at once.

What happens if I change the encryption key? Saved credentials can no longer be decrypted and must be re-entered. Keep the generated key unchanged.


Why Deploy and Host n8n Instagram Automation on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying n8n Instagram Automation on Railway, you get a scalable, queue-based automation server for Instagram and hundreds of other apps, at a flat monthly cost.


Template Content

More templates in this category

View Template
N8N Main + Worker
Deploy and Host N8N with Inactive worker.

jakemerson
120
View Template
Evolution API with n8n
Automate WhatsApp workflows with Evolution API, n8n, and Postgres.

codestorm
110
View Template
Postgres Backup
Cron-based PostgreSQL backup to bucket storage

Railway Templates
868