
- Set Up n8n
Install n8n
• Cloud: Sign up for n8n Cloud. No setup required.
• Self-Hosted:
- Install using Docker:bashCopyEditdocker run -it --rm --name n8n -p 5678:5678 -v ~/.n8n:/root/.n8n n8nio/n8n
- Or use npm:bashCopyEditnpm install n8n -g n8n Access the Dashboard • Open http://localhost:5678 (self-hosted) or your cloud instance. Set Up API Access • Log in to your accounts (Notion, WordPress, Facebook, Instagram) and generate API tokens if needed: ◦ Notion: Get a Notion integration token from Notion API. ◦ WordPress: Enable REST API and generate an application password for your user. ◦ Facebook/Instagram: Set up Facebook Graph API.
- Create an n8n Workflow
Step 1: Add a Trigger
• Choose how the workflow starts:
◦ Notion Trigger: Triggers when a new page is added or updated in Notion.
◦ Schedule Trigger: Runs the workflow at specific intervals (e.g., daily, weekly).
Step 2: Fetch Content from Notion
• Add a Notion Node:
- Authenticate with your API token.
- Configure the node to pull data from a specific database or page.
- Map fields like: ▪ Title ▪ Description ▪ Image URLs ▪ Tags Step 3: Format the Data • Use a Set Node to process or combine data: ◦ Create a caption by combining the title and description. ◦ Structure the data for your CMS or social media platforms. Step 4: Post to a Website • Add an HTTP Request Node or use a platform-specific node (e.g., WordPress): ◦ For WordPress: ▪ Method: POST. ▪ Endpoint: https://yourwebsite.com/wp-json/wp/v2/posts. ▪ Headers:jsonCopyEdit{ "Authorization": "Bearer YOUR_WORDPRESS_API_TOKEN" } ▪ Body (JSON):jsonCopyEdit{ "title": "{{$json['title']}}", "content": "{{$json['description']}}", "status": "publish" } Step 5: Post to Facebook • Add a Facebook Node:
- Authenticate with your Facebook account.
- Select the action: “Create Post.”
- Map fields like: ▪ Post Content: Combine title, description, and tags. ▪ Link or Image URL (if applicable). Step 6: Post to Instagram • Add an Instagram Node:
- Authenticate using Facebook (Instagram Business accounts are linked to Facebook).
- Choose the action: “Post Photo” or “Create Reel.”
- Map fields: ▪ Image URL. ▪ Caption.
- Example Workflow Here’s what your workflow would look like in n8n:
- Trigger: Notion Trigger (new item added to the database).
- Fetch Content: Extract title, description, tags, and image URLs.
- Format Content: Create captions and map data for each platform.
- Post to Website: HTTP Request to WordPress or other CMS.
- Post to Facebook: Facebook Node (Create Post).
- Post to Instagram: Instagram Node (Post Photo).
- Testing the Workflow
- Run the workflow manually with test data.
- Check the posts on all platforms.
- Debug any issues using the execution logs in n8n.
- Automate Scheduling • Add a Cron Node to automate daily or weekly posting. • Use the Switch Node to filter specific content for certain platforms.
- Advanced Enhancements AI Caption Generation • Add an OpenAI Node to generate creative captions or hashtags. ◦ Input: Title, tags, and description. ◦ Output: AI-generated caption. Image Handling • Upload images from URLs to your website’s media library using an HTTP Request node. Analytics Integration • Add a Facebook Insights node to track post performance.
- Deployment • Save and activate the workflow. • Monitor the automation for errors or adjustments.