How to Automate Social Media with n8n

15 min read Self-hosted n8n usersUpdated 2026-05-06

n8n is the open-source automation tool of choice for teams that need self-hosting, visual workflows, and full control over their data. While n8n doesn't have a native CodivUpload node yet, the HTTP Request node combined with a single API key is all you need to publish to 11 platforms from any workflow. The setup is simple because CodivUpload's API surface is intentionally small: one POST /v1/posts call with profile_name, platforms array, and content fields. This guide shows three production patterns: scheduled posting from Airtable, RSS-to-social cross-posting on every new feed item, and AI-generated captions via OpenRouter (Claude/GPT-5) → CodivUpload. All patterns run inside a single n8n workflow with no custom code.

Prerequisites

  • An n8n instance — n8n Cloud or self-hosted
  • A CodivUpload API key from Dashboard → API Keys
  • A CodivUpload profile with at least one social account connected
  • Optional: an Airtable base, an RSS feed, or an OpenRouter API key for AI captions

Step-by-step

  1. 1

    Add an HTTP Request node to your workflow

    Drag in an HTTP Request node from the n8n node panel. Set Method to POST and URL to https://api.codivupload.com/v1/posts. This single node handles the entire publish flow for any of CodivUpload's 11 supported platforms — you don't need a separate node for each network.

  2. 2

    Configure authentication via Header Auth credential

    In the HTTP Request node's Authentication dropdown, select Generic Credential Type → Header Auth. Create a new credential with Name=Authorization and Value=Bearer YOUR_API_KEY. n8n stores the key encrypted and never exposes it inside workflow logs. Reuse this credential across every node that talks to CodivUpload — you only set up the secret once.

  3. 3

    Build the request body with profile_name + platforms

    Switch Body Content Type to JSON. Paste the body template below and replace the static values with n8n expressions that pull from upstream nodes — e.g. {{$json.caption}} for the caption from an Airtable row trigger, or {{$json.image_url}} for the image. The profile_name and platforms fields are required; everything else is optional.

    {
      "post_type": "image",
      "profile_name": "my_brand",
      "platforms": ["instagram", "x", "linkedin"],
      "media_urls": ["{{$json.image_url}}"],
      "description": "{{$json.caption}}",
      "scheduled_date": "{{$json.scheduled_at}}",
      "instagram_share_to_feed": true,
      "linkedin_visibility": "PUBLIC"
    }
  4. 4

    Add a trigger appropriate to your use case

    Replace the manual trigger with: Cron (scheduled posts at fixed times), Webhook (real-time triggers from external systems), Airtable (when a row is added or updated to a specific status), or RSS (when a new feed item appears). The body expressions resolve against the trigger node's output, so the structure of {{$json.x}} matches the trigger's payload schema.

  5. 5

    Layer in AI for caption generation (optional)

    Insert an OpenRouter or OpenAI Chat Completion node between your trigger and the HTTP Request. Pass the trigger's image URL into a vision-capable model (Claude 4.5 Sonnet, GPT-5) with a prompt like: "Write a punchy Instagram caption with 3 hashtags for this image, in our brand voice (casual, playful, direct)." Reference the LLM's output in the HTTP body as {{$node['OpenRouter'].json.choices[0].message.content}}.

  6. 6

    Add error handling with the Error Trigger workflow

    In your main workflow's settings, set Error Workflow to a separate workflow that fires on any failed HTTP Request. Inside the error workflow, route failures to Slack or email with the failed payload attached so you can triage quota issues, expired credentials, or platform-specific rejections without polling logs manually.

Frequently asked

Can I use n8n's native social media nodes instead?+

Yes for single-platform workflows — n8n has nodes for X, Facebook, LinkedIn, etc. But each native node has its own auth scope and rate-limit handling. CodivUpload + a single HTTP Request node is faster for cross-platform fan-out and centralizes the OAuth lifecycle in one place (CodivUpload refreshes tokens for you).

How do I throttle to avoid rate limits?+

Insert a Wait node (e.g. 5 seconds) between iterations of a Split In Batches node when looping over a list. CodivUpload's queue also respects platform-specific pacing internally — even if you fire 100 calls at once, the worker spreads them out per platform's rate-limit policy.

Where do I store the API key safely?+

Use n8n Credentials (Settings → Credentials → Header Auth → name it CodivUpload API). Never paste the key directly into the body or use it as a static parameter — credentials are encrypted at rest and never exposed in workflow logs or exports. If you self-host n8n, set N8N_ENCRYPTION_KEY before first launch so the credentials store has a stable encryption key.

Can I read the post status back into n8n?+

Yes. After the create call, add another HTTP Request node configured as GET https://api.codivupload.com/v1/posts/{{$json.post_id}}. Loop with a Wait+Switch combo until status is completed, partially_failed, or failed. Or — preferred — set up a CodivUpload webhook (POST /v1/webhooks) pointing at an n8n Webhook trigger, so the worker pushes status updates instead of you polling.

What about cross-posting to platforms that need different cover images?+

Use the per-platform media override fields: instagram_media_urls, tiktok_media_urls, youtube_media_urls, etc. They override the global media_urls just for that platform. So you can pass a square image as the default and a 9:16 portrait as instagram_media_urls and tiktok_media_urls.

Does the workflow scale to thousands of posts per day?+

Yes — the bottleneck is platform-side rate limits, not CodivUpload's API. n8n handles parallel HTTP Request executions natively. For very high throughput consider switching to the Split In Batches node and tuning the batch size to match your slowest platform's rate limit (TikTok = 6/min/account, LinkedIn = 100/day, etc.).

Can I import a pre-built n8n template?+

Yes — see /integrations/n8n/templates for six battle-tested workflow patterns covering RSS-to-social, Airtable scheduler, AI captions, recurring schedule, YouTube clip repurposing, and Slack approval flows.

Related guides

Ready to automate?

Free plan includes 30 posts/month across 11 platforms. No credit card required.

See pricing