mirror of
https://github.com/khoaliber/n8nworkflows.xyz.git
synced 2026-04-28 00:29:22 +00:00
creation
This commit is contained in:
+319
@@ -0,0 +1,319 @@
|
||||
Automate Social Media Content Distribution with Google Sheets & Slack
|
||||
|
||||
https://n8nworkflows.xyz/workflows/automate-social-media-content-distribution-with-google-sheets---slack-6613
|
||||
|
||||
|
||||
# Automate Social Media Content Distribution with Google Sheets & Slack
|
||||
|
||||
### 1. Workflow Overview
|
||||
|
||||
This workflow automates the distribution of social media content using data entered in a Google Sheet. It targets SMEs, content creators, and marketing teams who want to streamline posting updates across Facebook, Twitter, and LinkedIn without manual repetition. The workflow is triggered by row updates in a Google Sheet, formats the content for social media, conditionally posts to selected platforms based on flags, updates the publication status in the sheet, and sends a Slack notification to confirm successful posting.
|
||||
|
||||
Logical blocks:
|
||||
|
||||
- **1.1 Content Input & Trigger:** Detects new or updated rows in Google Sheets.
|
||||
- **1.2 Content Preparation:** Formats content into a unified text string.
|
||||
- **1.3 Conditional Social Media Posting:** Checks platform flags and posts content accordingly on Facebook, Twitter, and LinkedIn.
|
||||
- **1.4 Post-Publication Update & Notification:** Updates Google Sheet status and sends a Slack notification.
|
||||
|
||||
---
|
||||
|
||||
### 2. Block-by-Block Analysis
|
||||
|
||||
#### 2.1 Content Input & Trigger
|
||||
|
||||
- **Overview:**
|
||||
Listens for new or updated rows in a specified Google Sheet to start the workflow.
|
||||
|
||||
- **Nodes Involved:**
|
||||
- Google Sheets Trigger
|
||||
|
||||
- **Node Details:**
|
||||
|
||||
- **Google Sheets Trigger**
|
||||
- Type: Trigger node for Google Sheets events
|
||||
- Configuration:
|
||||
- Event: `rowUpdate` (triggers on row changes every minute)
|
||||
- Document: Specified by URL (your Google Sheet link)
|
||||
- Sheet Name: Specific sheet within the document (configurable)
|
||||
- Polling: Every minute to detect changes
|
||||
- Inputs: None (trigger)
|
||||
- Outputs: Passes updated row data downstream
|
||||
- Credentials: Google Sheets OAuth2 for access
|
||||
- Edge Cases:
|
||||
- Delay if polling is slow or Google API limits reached
|
||||
- Authentication failure if credentials expire or are invalid
|
||||
- Incorrect sheet name or document ID leads to no trigger
|
||||
- Version: 1
|
||||
|
||||
---
|
||||
|
||||
#### 2.2 Content Preparation
|
||||
|
||||
- **Overview:**
|
||||
Formats raw Google Sheet data into a single string suitable for posting across social platforms.
|
||||
|
||||
- **Nodes Involved:**
|
||||
- Content Parameters (Set node)
|
||||
|
||||
- **Node Details:**
|
||||
|
||||
- **Content Parameters**
|
||||
- Type: Set node to define new JSON fields
|
||||
- Configuration:
|
||||
- Creates `social_media_text_core` string combining Title, Short_Description, URL, and Hashtags with line breaks
|
||||
- Expression used:
|
||||
`={{ $json.Title }} - {{ $json.Short_Description }}\nRead more: {{ $json.URL }}\n{{ $json.Hashtags }}`
|
||||
- Inputs: Receives row data from Google Sheets Trigger
|
||||
- Outputs: Passes formatted data downstream
|
||||
- Edge Cases:
|
||||
- Missing fields in row data may cause empty or malformed messages
|
||||
- Expression errors if field names differ or are missing
|
||||
- Version: 3.4
|
||||
|
||||
---
|
||||
|
||||
#### 2.3 Conditional Social Media Posting
|
||||
|
||||
- **Overview:**
|
||||
Sequentially evaluates boolean flags from the sheet to decide which social media platforms to post to, then posts the content accordingly.
|
||||
|
||||
- **Nodes Involved:**
|
||||
- Check Facebook Post (If node)
|
||||
- Post Message (Facebook node)
|
||||
- Check Twitter Post (If node)
|
||||
- Create Tweet (Twitter node)
|
||||
- Check LinkedIn Post (If node)
|
||||
- Share Update (LinkedIn node)
|
||||
|
||||
- **Node Details:**
|
||||
|
||||
- **Check Facebook Post**
|
||||
- Type: If node
|
||||
- Checks if `Post_to_Facebook` is `true`
|
||||
- True output: to `Post Message`
|
||||
- False output: to `Check Twitter Post`
|
||||
- Edge Cases: Boolean conversion failures, missing flag field
|
||||
|
||||
- **Post Message (Facebook)**
|
||||
- Type: Facebook Graph API node
|
||||
- Posts content on Facebook Page
|
||||
- Configuration:
|
||||
- Page ID specified
|
||||
- Message text from `social_media_text_core`
|
||||
- Link and picture URLs from row data
|
||||
- Posts as published (not draft)
|
||||
- Inputs: From `Check Facebook Post` (true branch)
|
||||
- Outputs: To `Check Twitter Post`
|
||||
- Credentials: Facebook OAuth2 with posting permissions
|
||||
- Edge Cases:
|
||||
- Permission errors on Facebook API
|
||||
- Invalid Page ID
|
||||
- API rate limits or timeouts
|
||||
|
||||
- **Check Twitter Post**
|
||||
- Type: If node
|
||||
- Checks if `Post_to_Twitter` is `true`
|
||||
- True output: to `Create Tweet`
|
||||
- False output: to `Check LinkedIn Post`
|
||||
- Edge Cases: Same as Facebook if node
|
||||
|
||||
- **Create Tweet**
|
||||
- Type: Twitter node
|
||||
- Posts tweet with text and optional image URL
|
||||
- Credentials: Twitter OAuth2 API
|
||||
- Inputs: From `Check Twitter Post` (true branch)
|
||||
- Outputs: To `Check LinkedIn Post`
|
||||
- Edge Cases:
|
||||
- Twitter API authentication failure
|
||||
- Tweet length limits exceeded
|
||||
- Image URL invalid or inaccessible
|
||||
|
||||
- **Check LinkedIn Post**
|
||||
- Type: If node
|
||||
- Checks if `Post_to_LinkedIn` is `true`
|
||||
- True output: to `Share Update`
|
||||
- False output: to `Update Publication Status`
|
||||
- Edge Cases: Boolean conversion errors
|
||||
|
||||
- **Share Update (LinkedIn)**
|
||||
- Type: LinkedIn node
|
||||
- Shares update on LinkedIn organization or personal profile
|
||||
- Configuration:
|
||||
- Post type set to Organization or Personal
|
||||
- Organization ID specified if Organization post
|
||||
- Text content from `social_media_text_core` plus URL
|
||||
- Binary media property not used (no image upload)
|
||||
- Inputs: From `Check LinkedIn Post` (true branch)
|
||||
- Outputs: To `Update Publication Status`
|
||||
- Credentials: LinkedIn OAuth2 with sharing permissions
|
||||
- Edge Cases:
|
||||
- Insufficient permissions to post on organization page
|
||||
- Incorrect org ID
|
||||
- API errors or rate limits
|
||||
|
||||
---
|
||||
|
||||
#### 2.4 Post-Publication Update & Notification
|
||||
|
||||
- **Overview:**
|
||||
Updates the original Google Sheet row to mark the content as published and sends a Slack notification to alert the team.
|
||||
|
||||
- **Nodes Involved:**
|
||||
- Update Publication Status (Google Sheets)
|
||||
- Send Slack Notification (Slack node)
|
||||
|
||||
- **Node Details:**
|
||||
|
||||
- **Update Publication Status**
|
||||
- Type: Google Sheets node (write/update)
|
||||
- Operation: Update Row
|
||||
- Configuration:
|
||||
- Matches row by URL column value
|
||||
- Sets `Publication_Status` column to `"Published"`
|
||||
- Uses Google Sheets OAuth2 credentials
|
||||
- Inputs: From both LinkedIn post node and false branch of LinkedIn check node
|
||||
- Outputs: To `Send Slack Notification`
|
||||
- Edge Cases:
|
||||
- Row not found if URL mismatch
|
||||
- API authentication errors
|
||||
- Write conflicts if sheet edited concurrently
|
||||
|
||||
- **Send Slack Notification**
|
||||
- Type: Slack node (send message)
|
||||
- Posts notification to specified Slack channel
|
||||
- Configuration:
|
||||
- Message includes content title and URL
|
||||
- Channel identified by Slack channel ID
|
||||
- Uses Slack API credentials
|
||||
- Inputs: From `Update Publication Status`
|
||||
- Outputs: None (end of workflow)
|
||||
- Edge Cases:
|
||||
- Invalid Slack token or revoked permissions
|
||||
- Channel ID not found or inaccessible
|
||||
|
||||
---
|
||||
|
||||
### 3. Summary Table
|
||||
|
||||
| Node Name | Node Type | Functional Role | Input Node(s) | Output Node(s) | Sticky Note |
|
||||
|-------------------------|---------------------------|---------------------------------------------|--------------------------|----------------------------|---------------------------------------------------------------------------------------------|
|
||||
| Google Sheets Trigger | Google Sheets Trigger | Detect new or updated Google Sheet rows | None | Content Parameters | |
|
||||
| Content Parameters | Set | Format content text for social media posts | Google Sheets Trigger | Check Facebook Post | |
|
||||
| Check Facebook Post | If | Check if Facebook posting enabled | Content Parameters | Post Message, Check Twitter Post | |
|
||||
| Post Message | Facebook Graph API | Post content to Facebook Page | Check Facebook Post | Check Twitter Post | |
|
||||
| Check Twitter Post | If | Check if Twitter posting enabled | Post Message, Check Facebook Post (False) | Create Tweet, Check LinkedIn Post | |
|
||||
| Create Tweet | Twitter | Post tweet with content | Check Twitter Post | Check LinkedIn Post | |
|
||||
| Check LinkedIn Post | If | Check if LinkedIn posting enabled | Create Tweet, Check Twitter Post (False) | Share Update, Update Publication Status | |
|
||||
| Share Update | LinkedIn | Share update on LinkedIn profile/org | Check LinkedIn Post | Update Publication Status | |
|
||||
| Update Publication Status| Google Sheets | Mark content as published in the Sheet | Share Update, Check LinkedIn Post (False) | Send Slack Notification | |
|
||||
| Send Slack Notification | Slack | Send confirmation notification to Slack | Update Publication Status| None | |
|
||||
| Sticky Note | Sticky Note | Visual label: "# Flow" | None | None | |
|
||||
| Sticky Note1 | Sticky Note | Detailed explanation and setup instructions | None | None | # "Automated Social Media Content Distribution System," plus full project description and build steps |
|
||||
|
||||
---
|
||||
|
||||
### 4. Reproducing the Workflow from Scratch
|
||||
|
||||
1. **Create Google Sheets Trigger node:**
|
||||
- Type: Google Sheets Trigger
|
||||
- Set event to `rowUpdate` with polling every minute
|
||||
- Provide your Google Sheet URL and specify the Sheet name
|
||||
- Authenticate with Google Sheets OAuth2 credential
|
||||
- Connect output to next node
|
||||
|
||||
2. **Create Set node "Content Parameters":**
|
||||
- Type: Set
|
||||
- Add a string field `social_media_text_core` with value:
|
||||
`={{ $json.Title }} - {{ $json.Short_Description }}\nRead more: {{ $json.URL }}\n{{ $json.Hashtags }}`
|
||||
- Connect input from Google Sheets Trigger
|
||||
- Connect output to `Check Facebook Post`
|
||||
|
||||
3. **Create If node "Check Facebook Post":**
|
||||
- Type: If
|
||||
- Condition: `={{ $json.Post_to_Facebook }}` is true
|
||||
- Connect input from Set node
|
||||
- True output to `Post Message`
|
||||
- False output to `Check Twitter Post`
|
||||
|
||||
4. **Create Facebook Graph API node "Post Message":**
|
||||
- Type: Facebook Graph API
|
||||
- Set Page ID to your Facebook Page ID
|
||||
- Post message: `={{ $json.social_media_text_core }}`
|
||||
- Link: `={{ $json.URL }}`
|
||||
- Picture: `={{ $json.Image_URL }}`
|
||||
- Set to post as published
|
||||
- Authenticate with Facebook OAuth2 credential
|
||||
- Input from `Check Facebook Post` true branch
|
||||
- Output to `Check Twitter Post`
|
||||
|
||||
5. **Create If node "Check Twitter Post":**
|
||||
- Type: If
|
||||
- Condition: `={{ $json.Post_to_Twitter }}` is true
|
||||
- Input from `Post Message` and `Check Facebook Post` false branch
|
||||
- True output to `Create Tweet`
|
||||
- False output to `Check LinkedIn Post`
|
||||
|
||||
6. **Create Twitter node "Create Tweet":**
|
||||
- Type: Twitter
|
||||
- Tweet text: `={{ $json.social_media_text_core }}`
|
||||
- Image URL: `={{ $json.Image_URL }}`
|
||||
- Authenticate with Twitter OAuth2 credentials
|
||||
- Input from `Check Twitter Post` true branch
|
||||
- Output to `Check LinkedIn Post`
|
||||
|
||||
7. **Create If node "Check LinkedIn Post":**
|
||||
- Type: If
|
||||
- Condition: `={{ $json.Post_to_LinkedIn }}` is true
|
||||
- Input from `Create Tweet` and `Check Twitter Post` false branch
|
||||
- True output to `Share Update`
|
||||
- False output to `Update Publication Status`
|
||||
|
||||
8. **Create LinkedIn node "Share Update":**
|
||||
- Type: LinkedIn
|
||||
- Post as Organization or Personal (choose accordingly)
|
||||
- Set Organization ID if organization post
|
||||
- Text: `={{ $json.social_media_text_core }}`
|
||||
- Content URL: `={{ $json.URL }}`
|
||||
- Image URL: `={{ $json.Image_URL }}`
|
||||
- Authenticate with LinkedIn OAuth2 credentials
|
||||
- Input from `Check LinkedIn Post` true branch
|
||||
- Output to `Update Publication Status`
|
||||
|
||||
9. **Create Google Sheets node "Update Publication Status":**
|
||||
- Type: Google Sheets (write)
|
||||
- Operation: Update Row
|
||||
- Key Column: `URL`
|
||||
- Key Value: `={{ $json.URL }}`
|
||||
- Set `Publication_Status` column to `Published`
|
||||
- Authenticate with Google Sheets OAuth2 credentials
|
||||
- Inputs from `Share Update` and `Check LinkedIn Post` false branch
|
||||
- Output to `Send Slack Notification`
|
||||
|
||||
10. **Create Slack node "Send Slack Notification":**
|
||||
- Type: Slack
|
||||
- Text: `New content "{{ $json.Title }}" successfully published to social media! 🎉 Check: {{ $json.URL }}`
|
||||
- Channel: Your Slack Channel ID
|
||||
- Authenticate with Slack API credentials
|
||||
- Input from `Update Publication Status`
|
||||
- No outputs (end node)
|
||||
|
||||
---
|
||||
|
||||
### 5. General Notes & Resources
|
||||
|
||||
| Note Content | Context or Link |
|
||||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
|
||||
| This workflow is designed to automate social media posting based on Google Sheets input, saving time and reducing errors for SMEs, bloggers, and marketing teams. It supports Facebook, Twitter, and LinkedIn postings with conditional logic and sends Slack notifications to confirm success. | Project overview and use case |
|
||||
| Setup requires OAuth2 credentials for Google Sheets, Facebook, LinkedIn, and Slack, plus Twitter OAuth2 credentials for API access. Ensure these are created and authorized before activating the workflow. | Credential setup requirements |
|
||||
| Column headers in Google Sheet must exactly match: `Title`, `URL`, `Short_Description`, `Image_URL`, `Hashtags`, `Post_to_Facebook`, `Post_to_Twitter`, `Post_to_LinkedIn`, `Publication_Status`. Use boolean TRUE/FALSE for posting flags. | Google Sheet setup instructions |
|
||||
| Polling interval on Google Sheets Trigger is every minute; adjust if faster response is needed but beware of API quota limits. | Performance considerations |
|
||||
| Slack notification text includes the title and URL of the newly published content to alert teams immediately. | Team communication integration |
|
||||
| Facebook node posts directly to the specified Page ID; ensure your Facebook app has required permissions for page posting. | Facebook Graph API usage |
|
||||
| Twitter node uses OAuth2 and can post tweets with or without images based on URLs provided. | Twitter API usage |
|
||||
| LinkedIn node supports posting as organization or personal profile; organization ID required for organization posts. | LinkedIn API usage |
|
||||
| Error handling is implicit; consider adding error workflows or notifications for production use to handle auth failures, rate limits, or API errors gracefully. | Recommended enhancements for production |
|
||||
|
||||
---
|
||||
|
||||
**Disclaimer:** The text above is derived exclusively from an automated workflow created with n8n, following all applicable content policies. It contains no illegal or protected content. Data handled is legal and public.
|
||||
Reference in New Issue
Block a user