Complete setup instructions for the Instagram Gist Generator on self-hosted n8n.
For Render.com deployment: See RENDER_DEPLOYMENT.md instead.
Before starting, ensure you have:
- A self-hosted n8n instance or n8n Cloud
- OpenAI API key (for Whisper and GPT-4)
- Access to install command-line tools on your n8n server (root/sudo access)
The workflow requires two command-line tools on the server where n8n runs:
macOS:
brew install yt-dlpLinux (Ubuntu/Debian):
sudo apt update
sudo apt install python3-pip
pip3 install yt-dlpUsing pip (any OS):
pip install yt-dlpmacOS:
brew install ffmpegLinux (Ubuntu/Debian):
sudo apt update
sudo apt install ffmpegRun the dependency checker script:
./scripts/check-dependencies.shThis will verify that yt-dlp and FFmpeg are properly installed.
- Go to OpenAI API Keys
- Create a new API key
- Save it securely - you'll need it in n8n
Pricing Note:
- Whisper API: ~$0.006 per minute of audio
- GPT-4: ~$0.03 per 1K tokens (summary typically uses 200-500 tokens)
- Estimated cost per video: $0.01 - $0.05
- Open your n8n instance
- Click on "Workflows" in the sidebar
- Click "Add Workflow" → "Import from File"
- Select
n8n-workflows/instagram-gist-workflow.json - Click "Import"
If you have n8n API access:
curl -X POST http://localhost:5678/api/v1/workflows \
-H "Content-Type: application/json" \
-H "X-N8N-API-KEY: your-api-key" \
-d @n8n-workflows/instagram-gist-workflow.json- In n8n, go to "Credentials" → "Add Credential"
- Search for "OpenAI"
- Select "OpenAI API"
- Enter your OpenAI API key
- Click "Save"
- Open the imported workflow
- Click on the "Transcribe Audio (Whisper)" node
- Under "Credential to connect with", select your OpenAI credential
- Click on the "Generate Summary (GPT-4)" node
- Link the same OpenAI credential
- Click "Save" on the workflow
- Open the workflow in n8n
- Toggle the switch at the top to "Active"
- Note the webhook URL displayed in the "Webhook" node
- Should look like:
http://your-n8n-domain/webhook/instagram-gist
- Should look like:
curl -X POST http://your-n8n-domain/webhook/instagram-gist \
-H "Content-Type: application/json" \
-d '{"url": "https://www.instagram.com/reel/EXAMPLE/"}'export WEBHOOK_URL="http://your-n8n-domain/webhook/instagram-gist"
./scripts/test-webhook.sh "https://www.instagram.com/reel/EXAMPLE/"{
"summary": "• Key point 1\n• Key point 2\n• Key point 3",
"transcript": "Full transcription of the video...",
"videoId": "EXAMPLE",
"processingTime": "45.2 seconds"
}If you want to access the webhook from the internet:
- Webhook is automatically public
- URL format:
https://your-instance.app.n8n.cloud/webhook/instagram-gist
ngrok http 5678Use the ngrok URL as your webhook endpoint.
Configure nginx to proxy requests to n8n:
location /webhook/ {
proxy_pass http://localhost:5678/webhook/;
proxy_set_header Host $host;
}Edit the "Generate Summary (GPT-4)" node:
- Modify the system prompt to request more/fewer bullet points
- Adjust
max_tokens(default: 500)
Edit the "Transcribe Audio (Whisper)" node:
- Change
languageparameter from "en" to your target language code - Or remove it for automatic detection
Replace the "Generate Summary (GPT-4)" node:
- Add Anthropic API credentials in n8n
- Change the HTTP request to:
- URL:
https://api.anthropic.com/v1/messages - Headers: Add
x-api-keyandanthropic-version: 2023-06-01 - Body format per Claude API docs
- URL:
If /tmp doesn't work on your system:
- Edit the "Set Video Path" node
- Change
/tmp/insta-gist-to your preferred directory - Ensure the directory exists and is writable by n8n
Issue: Execute Command node fails with "yt-dlp: command not found"
Solution:
- Ensure yt-dlp is installed on the n8n server (not your local machine)
- For Docker deployments, install in the container:
RUN pip install yt-dlp
Issue: Audio extraction fails
Solution:
- Install FFmpeg on the n8n server
- For Docker: add to Dockerfile
RUN apt-get update && apt-get install -y ffmpeg
Issue: "Video not accessible" or download fails
Possible causes:
- Video is from a private account
- Video has been deleted
- Instagram rate limiting
- Geographic restrictions
Solutions:
- Try with a different public video
- Wait a few minutes and retry (rate limiting)
- Check if video is accessible in a browser
Issue: Transcription fails or times out
Solutions:
- Check your OpenAI API key is valid
- Ensure you have credits/quota remaining
- For long videos (>10 min), consider splitting audio
Tips to reduce costs:
- Use Whisper's smaller model (if available)
- Reduce GPT-4
max_tokensfor summaries - Consider using GPT-3.5-turbo instead of GPT-4
- Implement caching to avoid reprocessing same URLs
If running n8n in Docker locally, use the provided Dockerfile and docker-compose:
# Build and run with docker-compose
docker-compose up -d
# Or build manually
docker build -t insta-gist-n8n .
docker run -p 5678:5678 -v ~/.n8n:/home/node/.n8n insta-gist-n8nSee Dockerfile and docker-compose.yml in the project root.
For cloud deployment (Render.com, etc.): See RENDER_DEPLOYMENT.md
- Add Error Handling: Configure error workflows in n8n for failed downloads
- Add Caching: Store summaries in a database to avoid reprocessing
- Build a Frontend: Create a simple web form for users to submit URLs
- Add Queue System: For high volume, add a queue (Redis) for async processing
- Monitor Usage: Track API costs and usage in n8n or external monitoring
- API Key Protection: Never commit API keys to version control
- Rate Limiting: Implement webhook rate limiting to prevent abuse
- URL Validation: The workflow validates Instagram URLs - don't remove this
- File Cleanup: Ensure temp files are always deleted (already in workflow)
- Public Access: If exposing publicly, consider adding authentication
If you encounter issues:
- Check n8n execution logs for errors
- Review the troubleshooting section above
- Verify all dependencies are installed correctly
- Test with a known-working Instagram URL