Video Generation with Telegram Bot and Gemini API – Auto-Post to TikTok, Instagram & Facebook
This n8n workflow turns your Telegram messenger into a full video content pipeline:
you send a text or voice idea to a Telegram bot, collaborate with an AI on the script and caption, let Gemini generate the video, and then automatically publish it to TikTok, Instagram and Facebook – all with status tracking and Telegram confirmations.
This workflow connects several external services. You’ll need:
Telegram Bot API Key
OpenAI API Key
Required for:
Google Gemini / Vertex (via n8n Gemini Node)
veo-3.0-fast-generate-001) to create the video.Google Drive
** Blotato API Key**
Social media publishing layer:
Google Sheets Access (optional but included)
Once these credentials are configured in n8n, the workflow runs end-to-end from Telegram idea to multi-platform publishing.
This phase listens to your messages and normalizes them into a single text input for the AI.
| Node Name | Role in Workflow |
|---|---|
| Listen for incoming events | Telegram Trigger node that starts the workflow whenever your bot receives a message (text or voice). |
| Voice or Text | Set node that structures the incoming payload and prepares a unified text field for downstream nodes. |
| A Voice? | IF node that checks whether the incoming message is a voice note or plain text. |
| Get Voice File | If voice is detected, this Telegram node downloads the audio file from Telegram. |
| Speech to Text | Uses OpenAI Whisper to convert the voice note into a text transcript. |
If you send text:
The workflow skips the voice download/transcription and goes directly to the AI agent with your original text.
If you send a voice note:
The workflow downloads the file, runs it through Whisper in Speech to Text, and passes the resulting transcript onward.
The output of this stage is always a clean text string representing your idea.
Here the AI designs the video prompt (for Gemini) and the social media caption (for all platforms), then iterates with you until you approve.
| Node Name | Role in Workflow |
|---|---|
| AI Agent | Central logic agent. Takes your idea text and applies the system prompt to create a video prompt and social media caption. Handles revisions based on your feedback. |
| OpenAI Chat Model | The LLM backing the agent (OpenAI Chat model). |
| Window Buffer Memory | Memory buffer that stores recent turns, so the agent can keep context across your “make it shorter / more fun / more technical” requests. |
| Send questions or proposal to user | Telegram node that sends the AI’s suggested prompt + caption back to you for review. |
| Approved from user? | IF node that checks whether the agent’s output is the “approved” JSON (meaning you said “ok” / “approved”) or just a normal suggestion. |
The AI Agent is configured with a system message like:
You are a video prompt assistant for Telegram.
- Analyze the user’s message and create a video prompt.
- Create relevant social media text with hashtags.
- Present both to the user and ask for feedback.
- If the user requests changes, refine and present again.
- Only when the user says “approved” or “ok”, output a final JSON:
{ "videoPrompt": "...", "socialMediaText": "..." }
Key behavior:
Before approval:
The agent always responds with human-readable suggestions (prompt + caption) and a follow-up question asking what to change.
After approval:
The agent returns only JSON (no Markdown, no explanation) with:
videoPrompt – to be sent to Gemini.socialMediaText – to be used as a caption on all platforms.| Node Name | Role in Workflow |
|---|---|
| Parse AI Output | Code node that extracts videoPrompt and socialMediaText from the agent’s output. It is tolerant of different formats (e.g. JSON wrapped in markdown) and throws errors if required fields are missing. |
If the AI output is approved JSON, this node returns two clean fields:
videoPromptsocialMediaTextThese are used in all subsequent steps.
Right after parsing the final JSON, the workflow informs you and logs the content.
| Node Name | Role in Workflow |
|---|---|
| Inform user about processing | Telegram node that tells you: “Okay. Your video is being prepared now. I’ll let you know as soon as it’s online.” |
| Save Prompt & Post-Text | Google Sheets node that appends a new row containing the videoPrompt and socialMediaText to a sheet (e.g., for tracking which prompts/captions you used). |
This gives you both visibility (confirmation message) and historical tracking of your content ideas.
Now the actual video is created using Google Gemini’s video model.
| Node Name | Role in Workflow |
|---|---|
| Generate a video | Gemini node (model models/veo-3.0-fast-generate-001) that uses videoPrompt to generate a vertical video (aspect ratio 9:16). |
The videoPrompt from the AI agent is passed directly into this node.
The resulting binary output is a generated short-form video suitable for TikTok, Reels and Stories.
To make the video accessible for Blotato, the workflow uses Google Drive as a simple file staging area.
| Node Name | Role in Workflow |
|---|---|
| Upload video | Uploads the generated video binary to a specific folder in Google Drive (n8n_videos). The file name is taken from the binary metadata or defaults to video.mp4. |
| Download Video from Drive1 | Immediately downloads the uploaded video by file ID, this time as binary data suitable for passing into Blotato. |
Using Drive ensures that the file is properly hosted and addressable when uploading to Blotato’s media API.
First, the video is sent to Blotato as a media asset. Then three separate posts are created for TikTok, Instagram, and Facebook.
| Node Name | Role in Workflow |
|---|---|
| Upload media1 | Blotato media node. Uploads the binary video as a media asset and returns a public url used by all post creation nodes. |
From the uploaded media, the workflow fans out into three branches:
| Node Name | Platform | Role in Workflow |
|---|---|---|
| Create TikTok post | TikTok | Creates a TikTok post using the media URL and socialMediaText as the caption. Also sets the flag that the video is AI-generated. |
| Create post1 | Creates an Instagram (or related) post linked to the Blotato account (e.g., aimaginate_xx), using the same socialMediaText and media URL. |
|
| Create Facebook post | Facebook Page | Creates a Facebook post on your specified page, again using the shared caption and media URL. |
At this point, all three platforms have an initial “post submission” created via Blotato.
Next, the workflow tracks their publishing status.
Each platform has its own mini-loop that polls Blotato until the post is either published or failed.
| Node Name | Role in Workflow |
|---|---|
| Wait | Initial 5-second (or configured) pause after creating the TikTok post. |
| Check Post Status | Blotato “get” operation that fetches the current status (published, in-progress, etc.) of the TikTok post by postSubmissionId. |
| Published to TikTok? | IF node that checks if status === "published". |
| Confirm publishing to Tiktok | Telegram node that notifies you when the TikTok post is live (often including a link or at least a confirmation text). |
| In Progress? | IF node that checks if status === "in-progress". |
| Give Blotat other 5s :) | Wait node that sleeps a bit before checking again. Feeds back into Published to TikTok? to create a polling loop. |
| Send TikTok Error Message | Telegram node that informs you if the status is neither published nor in progress (i.e., a failure). |
| Node Name | Role in Workflow |
|---|---|
| Wait1 | Wait node after Create post1, giving Blotato time to process the Instagram post. |
| Get post1 | Blotato “get” operation to read status of the Instagram post. |
| Published to Instagram? | IF node checking if status === "published". |
| Confirm publishing to Instagram | Telegram message with confirmation that your Instagram post is live. |
| In Progress?1 | IF node checking if status === "in-progress". |
| Give Blotat more time | Wait node that loops back to Published to Instagram? for another status check. |
| Send Instagram Error Message | Telegram notification if the Instagram post fails. |
| Node Name | Role in Workflow |
|---|---|
| Wait2 | Wait node after Create Facebook post (longer pause, e.g. 30 seconds). |
| Get Facebook post | Blotato “get” operation to fetch Facebook post status. |
| Published to Facebook? | IF node testing for status === "published". |
| Confirm publishing to Facebook | Telegram notification that the Facebook post is online. |
| In Progress?2 | IF node checking if the Facebook post is still in progress. |
| Give Blotat other 5s :)2 | Wait node that loops back into Published to Facebook? for repeated checks. |
| Send Facebook Error Message | Telegram notification if the Facebook post fails or ends in an unexpected state. |
This structure ensures that each platform is monitored independently, with clear success or error messages delivered right into your Telegram chat.
The real power of this workflow is how easy it is to adapt it to your own style, platforms, and preferences.
Where: Inside the AI Agent node, in the System Message (systemMessage) of the options.
What you can change:
You can also extend it, e.g.:
Where: Generate a video node.
Options:
aspectRatio from 9:16 to 16:9 or 1:1 depending on your target platform.Where: Blotato nodes:
You can:
Where: Wait and IF nodes:
What:
Where: Save Prompt & Post-Text (Google Sheets).
Ideas:
In short, this workflow gives you a full AI-powered video pipeline:
And everything is fully editable so you can adapt it precisely to your personal brand and content strategy.