# SkoolFeed → Social Auto-Post

Automatically repurpose Skool community posts to Twitter, LinkedIn, and Facebook with AI-generated content and images.

## Flow

```
Schedule (4hr) → RSS → Dedupe → GPT-4o → DALL-E 3 → Post to Socials → Log
                                  ↓
                    [Twitter + LinkedIn + Facebook]
```

## Quick Setup

### 1. Import Workflow

1. n8n → Workflows → Import from File
2. Select `skoolfeed-social-autopost.json`

### 2. Configure Credentials

| Credential | How to Get |
|------------|------------|
| **OpenAI API** | [platform.openai.com/api-keys](https://platform.openai.com/api-keys) |
| **Twitter OAuth2** | [developer.twitter.com](https://developer.twitter.com) → Create App → OAuth 2.0 |
| **LinkedIn OAuth2** | [linkedin.com/developers](https://www.linkedin.com/developers/) → Create App → OAuth 2.0 |
| **Facebook Graph API** | [developers.facebook.com](https://developers.facebook.com) → Create App → Get Page Access Token |
| **Google Sheets OAuth** | n8n → Credentials → Google Sheets → OAuth2 |

### 3. Update These Values

**RSS Feed Node:**
```
https://skoolfeed.com/feed/YOUR_COMMUNITY_ID
```

**Facebook Node:**
```
YOUR_FACEBOOK_PAGE_ID
```

**Google Sheets Node:**
```
YOUR_GOOGLE_SHEET_ID
```

### 4. Create Google Sheet

Create a sheet named "Post Log" with these columns:

| Posted At | Source Title | Source URL | Twitter Content | Twitter Success | Twitter Post ID | LinkedIn Content | LinkedIn Success | Facebook Content | Facebook Success | Image URL |

### 5. Activate

Toggle the workflow ON — it runs every 4 hours automatically.

---

## Credential Setup Details

### Twitter/X OAuth2

1. Go to [developer.twitter.com](https://developer.twitter.com)
2. Create a Project & App
3. Enable OAuth 2.0 with these settings:
   - Type: Web App
   - Callback URL: `https://your-n8n-url/rest/oauth2-credential/callback`
4. Request these scopes: `tweet.read`, `tweet.write`, `users.read`
5. In n8n, create Twitter OAuth2 credential with Client ID & Secret

### LinkedIn OAuth2

1. Go to [linkedin.com/developers](https://www.linkedin.com/developers/)
2. Create an App
3. Under Products, request access to "Share on LinkedIn"
4. OAuth 2.0 Settings:
   - Callback URL: `https://your-n8n-url/rest/oauth2-credential/callback`
   - Scopes: `w_member_social`, `r_liteprofile`
5. In n8n, create LinkedIn OAuth2 credential

### Facebook Graph API

1. Go to [developers.facebook.com](https://developers.facebook.com)
2. Create an App (Business type)
3. Add Facebook Login product
4. Generate a Page Access Token:
   - Go to Graph API Explorer
   - Select your app
   - Get User Token with `pages_manage_posts`, `pages_read_engagement`
   - Exchange for long-lived token
5. Get your Page ID from your Facebook Page → About → Page ID
6. In n8n, create Facebook Graph API credential with the access token

---

## Customization

### Change Schedule

Edit "Every 4 Hours" node:
```javascript
// Options:
"hoursInterval": 1    // Every hour
"hoursInterval": 6    // Every 6 hours
"hoursInterval": 12   // Twice daily
```

Or use cron for specific times:
```javascript
"cronExpression": "0 9,12,17 * * *"  // 9am, 12pm, 5pm daily
```

### Adjust AI Prompts

Edit the prompt in "AI: Generate Social Content" node to match your brand:

```
Add to the prompt:

Brand Voice:
- Tone: [Professional/Casual/Witty/Educational]
- Always include: [Your tagline or CTA]
- Never use: [Words to avoid]
- Emoji style: [Heavy/Light/None]
```

### Disable a Platform

Right-click any social node → Disable. The workflow continues without it.

### Add More Platforms

Duplicate and modify for:
- **Instagram:** Use n8n's Instagram node (requires Facebook Business)
- **Threads:** Use HTTP Request to Threads API
- **Bluesky:** Use HTTP Request to AT Protocol API

---

## Cost Estimate

Per post processed:

| Component | Cost |
|-----------|------|
| GPT-4o (content) | ~$0.02 |
| DALL-E 3 (image) | ~$0.04 |
| **Total per post** | **~$0.06** |

10 posts/day × 30 days = **~$18/month**

---

## Troubleshooting

### "Twitter rate limit"
- Twitter Free API: 50 tweets/day
- Add longer delays between posts
- Consider Twitter Basic ($100/mo) for higher limits

### "LinkedIn 403 Forbidden"
- Ensure "Share on LinkedIn" product is approved
- Re-authenticate the OAuth connection
- Check if token expired

### "Facebook posting failed"
- Verify Page Access Token hasn't expired
- Confirm Page ID is correct
- Check if app has `pages_manage_posts` permission

### "Image generation failed"
- DALL-E may reject certain prompts (content policy)
- Workflow continues without image (onError: continueRegularOutput)
- Check OpenAI dashboard for error details

### "Duplicate posts appearing"
- Clear workflow static data: n8n → Settings → Clear Static Data
- Check if RSS feed GUIDs are consistent

---

## Files

- `skoolfeed-social-autopost.json` — Main workflow (import this)
- `SKOOLFEED-SETUP.md` — This guide
