Automate LinkedIn Posts from Notion with n8n

Streamline your daily LinkedIn posts by automating content retrieval from your Notion database using n8n workflow. Save time and avoid manual errors by automating post formatting, image downloading, and publication on LinkedIn.
scheduleTrigger
notion
aggregate
+4
Learn how to Build this Workflow with AI:
Workflow Identifier: 1014
NODES in Use: scheduleTrigger, notion, aggregate, code, httpRequest, merge, linkedIn

Press CTRL+F5 if the workflow didn't load.

Visit through Desktop for Best experience

Opening Problem Statement

Meet Sarah, a freelance content marketer who manages multiple social media channels for her clients. Every day, she manually copies her scheduled posts from a Notion database, formats the content, downloads images, then posts everything onto LinkedIn. This daily routine easily consumes over an hour of her time, and errors sneak in during formatting or image handling. Scheduling misalignments lead to missed posting times, affecting engagement and her clients’ satisfaction. Sarah desperately needs a way to automate this repetitive, error-prone process.

What This Automation Does

This n8n workflow takes your scheduled posts from a Notion database and automates publishing them on LinkedIn every day at the same time. Here’s exactly what happens when this workflow runs:

  • Automatically triggers at a specified hour daily (3 PM) using the Schedule Trigger node.
  • Queries your Notion database to fetch posts set for the current date with a date filter.
  • Retrieves the detailed content blocks and images related to the selected Notion post.
  • Aggregates and formats the post content with JavaScript code for LinkedIn’s format.
  • Downloads the primary image from the Notion content to attach with the LinkedIn post.
  • Publishes the formatted text and image to LinkedIn on your personal or company profile.
  • Updates the post’s status in Notion to “Published” for tracking and workflow management.

This automation can save marketers like Sarah over an hour every day, eliminate formatting errors, and ensure consistent posting schedules for better audience engagement.

Prerequisites ⚙️

  • n8n account — the automation platform to build and run the workflow.
  • Notion API access — to connect n8n with your Notion workspace and retrieve your database content.
  • LinkedIn OAuth2 account — to authenticate and authorize the LinkedIn node to post on your behalf.
  • Ensure you have a Notion database configured with a “Date” property and a “Status” select property to track published posts.
  • Preferably, have a company page linked to your LinkedIn profile for posting flexibility.

Step-by-Step Guide

Step 1: Set Up Your Notion Credentials in n8n

Navigate to Credentials in n8n, click New Credential, and select Notion API. Enter your integration token and connect your workspace. Test the connection to ensure access.

Visual: You should see a green success checkmark indicating correct authentication.

Common Mistake: Forgetting to give your Notion integration access to the target database.

Step 2: Set Up LinkedIn OAuth2 Credentials

Go to CredentialsNew CredentialLinkedIn OAuth2. Follow the instructions to authenticate your LinkedIn account and authorize posting rights. Remember, if you want to post to a company page, your LinkedIn account must have admin access to that page.

Step 3: Configure the Schedule Trigger Node

Drag the Schedule Trigger node onto the canvas. Click it and set the trigger rule to run daily at your preferred hour, e.g., 15 (3 PM). This will automatically run the workflow every day at this time.

Step 4: Filter Today9s Post from Notion Database

Add the Notion node configured to databasePage resource and getAll operation. Set the filter to find the page where the “Date” property equals today’s date using the expression: {{$today.format("yyyy/mM/dd")}}.

Outcome: This fetches the post scheduled for the current day.

Common Mistake: Ensure your Notion date property format matches exactly with the expression output.

Step 5: Fetch Content Blocks from the Selected Notion Page

Use a second Notion node to fetch all blocks for the page found in Step 4. Set the resource to block and operation to getAll. Use the URL of the page from Step 4 dynamically.

Step 6: Aggregate Notion Blocks

Add an Aggregate node to collect all “content” and “image.file.url” fields from the fetched blocks into single arrays. This helps gather textual and media content for the post.

Step 7: Format the Post Content with Code Node

Use a Code node with this JavaScript snippet to concatenate and format the text content properly:

const notionData = items[0].json.content;

let formattedText = notionData[0];

for (let i = 1; i < notionData.length; i++) {
    if (notionData[i].startsWith('-')) {
        formattedText += 'nn' + notionData[i];
    } else {
        formattedText += 'n' + notionData[i];
    }
}

return [{ formattedText: formattedText }];

This script builds the LinkedIn post body ready for publishing.

Step 8: Download the First Image from Notion for LinkedIn

Insert an HTTP Request node to download the main image by setting the URL to {{$json.url[0]}} extracted from the aggregated image URLs.

Step 9: Merge Text and Image Data

Place a Merge node to combine the formatted text from the Code node and the image downloaded from the HTTP node. Use "combine" mode with "mergeByPosition" to align data properly.

Step 10: Publish the Post on LinkedIn

Connect the LinkedIn node. Set the "text" field to {{$json.formattedText}}. Select the person or company profile where the post will be published. Choose "IMAGE" as the media category to attach the downloaded image.

Step 11: Update Notion to Mark Post as Published

Finally, use another Notion node to update the page's "Status" select property to "Published" by referencing the page ID from the original filter node.

Customizations ✏️

  • Change Posting Time: Edit the Schedule Trigger node's trigger time to match your desired posting hour.
  • Post to Company Page: In the LinkedIn node, change the "person" field to your company page ID to post on behalf of a business.
  • Format Adjustments: Modify the JavaScript code in the Code node to customize bullet spacing, add hashtags, or include mentions.
  • Add Multiple Images: Extend the HTTP Request and Merge nodes to handle multiple image URLs if your Notion content has several images.
  • Add Logging: Insert nodes like Set or Function before and after posting to log post data for audit trails.

Troubleshooting 🔧

Problem: "No posts fetched for today."
Cause: The date filter expression might not match the Notion "Date" property format.
Solution: Verify the date format in Notion matches the format used in the filter {{$today.format("yyyy/mM/dd")}}. Adjust if needed.

Problem: "LinkedIn post fails with permission error."
Cause: LinkedIn OAuth credentials lack posting permission or company page access.
Solution: Re-authorize LinkedIn credentials ensuring your account has publishing rights and page admin access.

Problem: "Image download fails or posts without images."
Cause: Image URLs in Notion might be inaccessible or incorrect.
Solution: Check image URLs in Notion blocks and ensure public access or correct sharing permissions.

Pre-Production Checklist ✅

  • Confirm Notion credentials with access to your database.
  • Verify LinkedIn OAuth2 credentials and posting permissions.
  • Check that your Notion database has "Date" and "Status" properties correctly set up.
  • Test the workflow manually once to confirm posts are fetched, formatted, and published correctly.
  • Backup your Notion data to avoid accidental overwrites during testing.

Deployment Guide

Once tested, activate the workflow by toggling the Active switch in n8n. The workflow will automatically trigger daily at the specified time. Monitor initial runs via the execution history in n8n to catch any errors early. For long-term reliability, consider self-hosting n8n to avoid downtime and ensure your credentials remain securely managed.

FAQs

Q: Can I use this workflow for other social platforms?
A: Yes, but you'd need to replace the LinkedIn node with corresponding social media nodes and adjust data formats accordingly.

Q: Does this use many API calls and risk hitting limits?
A: It uses a few calls per day. Notion and LinkedIn have generous rate limits but monitor usage if scaling up.

Q: Is my data safe using this workflow?
A: Yes, all data transfer uses secure APIs, and n8n operates within your control environment.

Q: Can I change the post text formatting?
A: Absolutely! The Code node contains the JavaScript which you can modify to suit your style.

Conclusion

By following this guide, you’ve built a complete automation that pulls daily posts from your Notion database and publishes them perfectly formatted on LinkedIn along with images. This saves busy marketers like Sarah over an hour each day and reduces post errors and missed schedules. Next, consider automating analytics reporting for your LinkedIn posts or expand to multi-platform publishing workflows. Keep experimenting with n8n to make your marketing process smoother and more effective!

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n (Beginner Guide)

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free