Create daily historical AI videos with Gemini, fal.ai, Telegram and YouTube
Install Guide
Draft — community verifyingGenerated by claude-sonnet-auto · 5/26/2026
Prerequisites
Before setting up this integration, ensure you have the following:
- n8n (self-hosted or cloud) — version 1.0+ recommended
- Self-hosted requires Node.js v18+
- Alternatively, use n8n Cloud
- Google account with access to Google AI Studio (for Gemini API)
- fal.ai account for AI video generation — fal.ai
- Telegram account and the ability to create a Telegram Bot via @BotFather
- YouTube account with a channel and access to Google Cloud Console for the YouTube Data API v3
- A Google Cloud project with OAuth 2.0 credentials configured (required for YouTube uploads)
- Basic familiarity with n8n's workflow editor and credential management
Get Your API Keys
1. Gemini API Key (Google AI Studio)
- Go to https://aistudio.google.com/app/apikey
- Sign in with your Google account.
- Click Create API key.
- Select an existing Google Cloud project or create a new one.
- Copy the generated API key and store it securely.
2. fal.ai API Key
- Go to https://fal.ai/dashboard/keys
- Sign in or create a free account.
- Click Add key, give it a name (e.g.,
n8n-video-integration). - Copy the key — it will only be shown once.
3. Telegram Bot Token
- Open Telegram and search for @BotFather.
- Send the command
/newbot. - Follow the prompts to name your bot and choose a username (must end in
bot). - BotFather will reply with a token like
123456789:ABCDefGHIjklMNOpqrSTUvwxYZ. - Copy this token.
4. YouTube Data API v3 (OAuth 2.0)
- Go to https://console.cloud.google.com/ and select your project.
- Navigate to APIs & Services → Library.
- Search for YouTube Data API v3 and click Enable.
- Go to APIs & Services → Credentials.
- Click Create Credentials → OAuth 2.0 Client ID.
- Set application type to Web application.
- Add your n8n instance URL as an Authorized redirect URI, e.g.:
https://your-n8n-instance.com/rest/oauth2-credential/callback - Click Create and note down the Client ID and Client Secret.
Installation
Option A: Self-Hosted n8n (Recommended for full control)
Install n8n globally via npm:
npm install -g n8n
Or using Docker:
docker pull n8nio/n8n
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
Import the Workflow
- Log in to your n8n instance at
http://localhost:5678. - In the left sidebar, click Workflows → New.
- Click the ⋮ (three dots) menu in the top-right corner and select Import from file or Import from URL.
- If you have the workflow JSON file, select it from your local machine:
/path/to/daily-historical-ai-videos-workflow.json - Click Import to load the workflow into the editor.
Option B: n8n Cloud
- Log in at https://app.n8n.cloud/.
- Follow the same import steps above — no local installation required.
Configuration
Set up the following credentials inside n8n under Settings → Credentials → New Credential:
| Variable / Credential | Description | Where to get it |
|---|---|---|
| GEMINI_API_KEY | API key for Google Gemini (text/content generation) | Google AI Studio |
| FAL_AI_API_KEY | API key for fal.ai video generation | fal.ai Dashboard |
| TELEGRAM_BOT_TOKEN | Token for your Telegram bot to send messages/notifications | @BotFather on Telegram |
| TELEGRAM_CHAT_ID | The chat or channel ID where the bot posts updates | Send a message to your bot, then call https://api.telegram.org/bot<TOKEN>/getUpdates |
| YOUTUBE_CLIENT_ID | OAuth 2.0 Client ID for YouTube Data API v3 | Google Cloud Console → Credentials |
| YOUTUBE_CLIENT_SECRET | OAuth 2.0 Client Secret for YouTube Data API v3 | Google Cloud Console → Credentials |
| YOUTUBE_CHANNEL_ID | The ID of the YouTube channel to upload videos to | Found in YouTube Studio → Settings → Channel → Advanced |
Connecting Credentials in n8n
- Open the imported workflow.
- Click each node that shows a credential warning (Gemini, fal.ai HTTP node, Telegram, YouTube).
- For each node, click Credential → Create New and fill in the relevant values from the table above.
- For YouTube, complete the OAuth2 authorization flow by clicking Connect and signing in with your Google account.
Running the Bot
Start n8n (self-hosted)
n8n start
Then open your browser to:
http://localhost:5678
Activate the Workflow
- Open the imported workflow in the editor.
- Toggle the Active switch in the top-right corner to ON.
- The workflow will now run automatically on its configured schedule (typically once daily — check the Schedule Trigger node to confirm or adjust the cron time).
Running Manually (for testing)
- Open the workflow.
- Click Execute Workflow (the ▶ play button) to trigger a manual run immediately.
Production Mode (Docker, persistent)
docker run -d \
--name n8n-prod \
--restart unless-stopped \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
Testing
Smoke Test — Manual Execution
- Open the workflow in n8n.
- Click Execute Workflow to run it immediately.
- Watch each node turn green (success) as it executes.
- Verify the following outcomes:
- The Gemini node returns a historical topic/script (check node output panel).
- The fal.ai node returns a video URL or file reference.
- The Telegram node shows a message was sent — check your Telegram chat for the notification.
- The YouTube node shows a successful upload response with a
videoId.
Verify Telegram Notification
Send a test API call to confirm your bot token and chat ID are correct:
curl "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/sendMessage" \
-d "chat_id=<YOUR_CHAT_ID>&text=Test+from+n8n+workflow"
You should receive the message in Telegram within seconds.
Verify YouTube Upload
After a successful run, check your YouTube Studio at:
https://studio.youtube.com/
Navigate to Content and confirm the new video appears (it may be in Processing status initially).
Troubleshooting
| Problem | Likely cause | Fix |
|---|---|---|
| Gemini node returns 403 Permission Denied | API key is invalid or Gemini API is not enabled | Double-check the key in Google AI Studio; ensure the API is active for your project |
| fal.ai node times out or returns 401 Unauthorized | Incorrect or expired fal.ai API key | Regenerate your key at fal.ai Dashboard and update the credential in n8n |
| Telegram bot sends no message | Wrong TELEGRAM_CHAT_ID or bot not added to the chat | Call https://api.telegram.org/bot<TOKEN>/getUpdates after messaging the bot to retrieve the correct chat_id; ensure the bot is a member of the target group/channel |
| YouTube upload fails with insufficientPermissions | OAuth scope missing or token expired | Re-authorize the YouTube credential in n8n (Settings → Credentials), ensuring the youtube.upload scope is granted during OAuth consent |
| Workflow doesn't run on schedule | Workflow is not activated | Toggle the Active switch to ON in the workflow editor; also verify the Schedule Trigger node's cron expression is correct |
| n8n crashes on startup | Node.js version too old | Run node --version and confirm it is v18+; upgrade via nvm install 18 && nvm use 18 if needed |
| fal.ai video generation returns an empty or broken file | Model parameters out of range or unsupported format | Check the fal.ai node's model input parameters against the fal.ai model docs and adjust resolution or duration settings |
Sign in to leave feedback on this guide.