Course · Automation
Social Autopilot
Build a self-hosted automation that writes, reviews and posts to five channels every day — with a human approving every post before it goes live. The real build, including the dead ends.
A self-hosted automation that writes, reviews and posts to LinkedIn, Instagram, Facebook, Telegram and email — once a day, with a human approving every post before it goes live.
One run · one approval · five places
Prerequisites · 0/13 ready
Gather these before touching n8n — chasing them mid-build is where momentum dies. Ticks are saved in this browser.
Tip: use a personal Gmail for the Google parts. A managed Workspace account can be blocked by its admin, and you'll lose an afternoon to a “restricted” error that has nothing to do with your setup.
Part 1 · The shape of the project
Before any node or token, this is the whole arc. Do the phases in order — each depends on the last.
Pick your channels, where the content comes from (a spreadsheet of ready posts), where images are hosted, and that a human approves before posting.
Install the automation tool on a machine and get it running. It only works while it's on — keep that in mind for later.
Give n8n permission to post to each platform. The longest phase — every platform has its own login dance and its own traps.
A Google Sheet, one row per post, holding the caption, the image links, and a status column the workflow writes back to.
Wire the nodes: read the next post, format it per platform, push it to each channel, then stamp the row as posted.
Insert a human checkpoint — an email with Approve / Decline — so nothing publishes without a person saying yes.
Fill in your posts, switch the schedule on, and — for a real client — move it off your laptop to an always-on server.
Part 2 · Building it, node by node
The real build, including the dead ends. The Field Notes are the things that cost an hour each — read them before you hit them.
Install n8n
n8n is the engine — a visual tool where each box (“node”) does one thing and arrows pass data along.
- Install Node.js. n8n runs on it. Grab the LTS build from nodejs.org.
- Install n8n globally. One command in your terminal.
- Start it and open the editor. It serves at localhost:5678 in your browser.
# install, then run npm install -g n8n n8n start # open http://localhost:5678
n8n lives on your machine. Close the terminal or sleep the PC and the automation stops — no posts, no approvals. Fine for building; for a client it belongs on an always-on server. Keep n8n current, too: an out-of-date install asks LinkedIn for a permission LinkedIn deleted in 2023 and the login just fails with unauthorized_scope — update n8n first.
Connect the accounts
Each platform needs a credential inside n8n. Here's the path — and the trap — for each.
- LinkedIn — create an OAuth app, add “Sign In with OpenID Connect” + “Share on LinkedIn”, then connect it in n8n. Posting as yourself is quick; posting as a company Page needs the Community Management API on a separate app and a review against a registered business.
- Instagram + Facebook — one Meta app covers both. Generate a permanent Page token (short-lived → long-lived → Page token), not the 1-hour one the explorer hands you.
- Telegram — get a bot token from BotFather. Use the plain Telegram (send) node, not the Telegram Trigger (which only receives). Add the bot as an admin of your channel.
- Gmail — OAuth2. Publish the consent screen to “In production” so the login doesn't expire every 7 days.
- Google Sheets — use a Service Account, not OAuth. Share the sheet with the service account's email.
There is no API way to auto-post to Instagram without a Facebook Page behind it. The IG account must be Business/Creator and linked to a Facebook Page, and all posting runs through the Facebook Graph API. Even if you never touch Facebook, the Page has to exist.
Normal OAuth hits Google Drive's “restricted scope” and an unverified app is blocked with a restricted error. A Service Account sidesteps the whole verification dance: create one, download its JSON key, copy client_email and private_key into n8n, and share your sheet with that email as an Editor.
Host the images
Every platform fetches the image from a public URL. Instagram, in particular, fetches it from Meta's servers — so it has to be a real, reachable link.
- We use Cloudinary (free): upload each finished creative, get a clean .jpg / .png URL.
- Design two sizes: a 1:1 square for LinkedIn, a 4:5 portrait for Instagram / Facebook / Telegram. Canva Pro's “Resize” makes both from one design.
https://res.cloudinary.com/<you>/image/upload/f_jpg,q_auto/v.../image.png
WebP breaks posting — LinkedIn and Telegram reject it, so export JPG or PNG. Instagram wants JPEG specifically; a PNG often fails at the /media step. If it does, let Cloudinary convert on the fly with the f_jpg flag shown above.
Build the content source
A single Google Sheet tab, headers in row 1 (no title rows above them, or n8n can't read it). One row per post.
- Columns: Post_ID, Audience, Caption_EN, Caption_AR, Image_URL_EN, Image_URL_AR, Status.
- Status starts blank; the workflow writes posted into it at the end so the post is never repeated.
- A row is only picked up once it has both images filled in — half-ready rows are skipped automatically.
Build the posting line
The nodes, left to right. Each posting node reads from the “Prepare Post” node, so language and image stay matched to the platform.
- Schedule Trigger. Fires once a day at a set hour.
- Google Sheets → Get rows. Pulls every row from the sheet.
- Code → “Prepare Post”. Picks the next unposted row that has images, and builds the English and Arabic captions.
- Download Image → Post to LinkedIn. LinkedIn needs the file uploaded, so the English image is downloaded first, then attached. Caption: English.
- IG: Create Media → IG: Publish Media. Instagram is two steps — stage the image by URL, then publish. Image: Arabic (as JPEG). Caption: Arabic.
- Post to Facebook · Send to Telegram. Arabic image + Arabic caption to both.
- Google Sheets → Update row. Matches on Post_ID and sets Status = posted.
Send the English caption to the English (LinkedIn) image and the Arabic caption to the Arabic (IG/FB/Telegram) image — keep them as separate fields out of “Prepare Post” so each platform gets exactly one language.
If you disconnect a node that others reference by name, their expressions break with No path back to node. When you retire a setup/config node, either keep it in the chain or hardcode the fixed values (like account IDs) into the nodes that used it.
Add the approval gate
Drop this between “Prepare Post” and the posting nodes, so a person decides before anything publishes.
- Gmail → “Send and Wait for Response”. Emails you the draft (caption + image links) with Approve / Decline buttons and pauses the whole workflow.
- IF → approved. Only the “true” branch continues into the posting nodes. Decline ends the run.
cloudflared tunnel --url http://localhost:5678 # then, before starting n8n: $env:WEBHOOK_URL="https://your-sub.trycloudflare.com/"
By default the Approve link is localhost — it only works in a browser on the n8n machine. To approve from a phone, expose n8n with a free Cloudflare Tunnel and set n8n's WEBHOOK_URL to the tunnel address. The free “quick tunnel” URL changes every restart, so you reset WEBHOOK_URL each time — a reason to script startup, or move to a server with a fixed address.
Go live
- Fill in real posts and images in the sheet, then flip the workflow to Active so the schedule runs on its own.
- For production, move n8n to a small always-on server (a ~$5/month VPS or n8n Cloud). Your workflow exports and imports as one file — a laptop that's asleep at 9am is a missed post.
★ The nine things that cost real time
- 01Instagram needs a Facebook Page. No API path around it — Business account linked to a Page, posting through the Graph API.
- 02Use a Service Account for Google Sheets. Normal OAuth is blocked by Drive's restricted scope; a service account isn't.
- 03WebP breaks posting; Instagram wants JPEG. Export JPG/PNG, and convert to JPEG for IG with Cloudinary's f_jpg.
- 04Old n8n breaks LinkedIn login. It requests a scope LinkedIn retired. Update n8n and the error disappears.
- 05Get a permanent Meta token. The explorer's token dies in an hour. Exchange it up to a non-expiring Page token.
- 06Telegram: channel ID ≠ bot username. Post to the channel's @handle or -100… ID, with the bot added as an admin.
- 07Approval links need a tunnel. localhost only works on the n8n machine; Cloudflare Tunnel + WEBHOOK_URL makes it reachable from a phone.
- 08Model IDs expire. If you generate captions with an AI provider, hosted model names get deprecated — check the live list when a call 404s.
- 09Company-page posting is gated. LinkedIn, Meta, and TikTok all review your app before public auto-posting — start those applications early.
Stack: n8n · Google Sheets · Cloudinary · Gmail · Cloudflare Tunnel · LinkedIn / Meta / Telegram APIs.