When a Telegram bot is sent a link to a YouTube video, automation:
Gets a link from an incoming message.
Calls an external service to extract audio or extract from a video.
If the service returns a text result (for example, an extract), it processes it (translates it if necessary).
If the service returns a file (for example, video/audio), the file is uploaded to Google Drive, from where it is downloaded for transcription.
Based on the transcription received, the final post is formed and sent to Telegram.
2. Scope of application
Automation is useful for:
Media agencies and bloggerswho need to quickly post YouTube video reviews.
Content managersseeking to automate content processing and publishing.
Marketerswho want to promptly inform the audience about new products on YouTube via Telegram.
Benefits: saving time, minimizing manual labor, uniform post design.
3. Tools and pre-training
Platform:
n8n — for building a workflow.
Services and APIs:
Telegram API — receiving incoming messages and sending posts (don't forget to set up credits via BotFather).
External service on Replit — URL for video processing (returns either a text result or an audio/video file).
Google Drive API — uploading files to the cloud and then downloading them (use OAuth2 Credences).
OpenAI API — audio transcription (using nodes like OpenAI) and generating the final post text.
Pre-configuration:
Set up credenchals for Telegram, Google Drive, and OpenAI in n8n.
Check the external service on Replit — it should process links correctly.
Create an OpenAI agent to process text and create posts on Telegram.
4. A step-by-step guide to creating a workflow
On the main menu, click Create Workflow to start creating automation
4.1. Receiving an incoming message on Telegram
Node: Telegram Trigger
Click on the plus icon in the upper right corner
In the search, we find and choose Telegram.
Type: Telegram Trigger (updates — message).
Setup: Connect your Telegram bot's credits.
First, you must log into your Telegram account and search for contacts and open @BotFather. Through the channel menu, you can create a Telegram bot and customize its name, avatar, description, etc.
When the bot is created, BotFather will show you the Telegram token you need to work with the chatbot you just created.
Feature: This node will listen to incoming messages, where users send a link to a YouTube video.
4.2. Call an external video processing service
Node: HTTP Request
In the search, we find and choose HTTP.
Method: POST
URL: (link to your Replit code)
You can see how to set up and run the code on Replit here.
Enable sending request headers Send Headers These parameters may differ depending on the code, but if you used the code that we provide in the Replit configuration instructions, enter:
Specify Headers: Using Fields Below
Name: X-api-key
Value: s3cr3t-k3y-123
Enable sending the request body Send Body:
Body Content Type: JSON
Specify Body: Using Fields Below Here, pass the video_url parameters with the value = {{$json.link}}.
Name: video_url
Value: = {{$json.link}}
Select this option to receive a full response.
Make sure that the server is on Replit is available and works.
4.3. Branching result processing
Node: If
Goal: Check type of response returned, comparing the content-type header to text/plain.
To transfer content type or any other data in the further automation process, we recommend simply dragging blocks in mode/format Schema
Find the content-type block and hold the mouse on it, dragging it to the field you need, and be sure to select the “Expression” filling option.
Condition:
Left side: = {{$json.headers ['content-type']}}
Right side: “text/plain” Operator: equals
Logic:
If the condition is true → the text result was obtained (an extract from the video).
If falsely → uploading a file (video/audio) to Google Drive.
The first case (If YouTube videos have subtitles available and the code downloads them)
5. Text result processing (If branch: text)
5.1. Generating a squeeze via OpenAI
Node: OpenAI
Purpose: Create short extract from the data obtained.
Then create an assistant in OpenAI that will summarize the resulting text if you haven't created it yet.
You can see how to create it here:
Choose your assistant from the list
Input data: = {{$json.data}} text from the previous block
5.2. Creating a post for Telegram
Node: OpenAI (Telegram Poster)
Purpose: Create full Telegram post with a title, description, and a link to the video.
Create and select an assistant to create posts.
Input data:
Through the format schema drag the output from the HTTP block to transfer the full text. Also, enter the output data from the previous block with a extract: = {{$json.output}}
5.3. Sending a post to Telegram
Node: Telegram
ChatID: Use the chat ID obtained from the first Telegram Trigger block: = {{$ ('Telegram Trigger') .item.json.message.chat.id}}
Or you can simply drag and drop the information block through the format schema
Message text:
Your newly created post in the previous OpenAI block {{$json.output}}
Also, at your discretion, you can add a link to the video itself at the end of the post - via the format schema drag and drop the link block, or just copy and paste:
The second case (If a YouTube video has no subtitles, the code will download the video itself and transcribe it)
6. File processing (If branch: file)
6.1. Uploading a file to Google Drive
Node: Google Drive (Upload)
Purpose: Upload video/audio to Google Drive.
Connect your google drive credentials
You can see how to do this here:
Setup:
Input Data Field Name: data
Parent Drive: Choose your drive from the list.
Parent Folder: Select a folder from the list from your drive.
6.2. Downloading a file from Google Drive
Node: Google Drive (Download)
Setup:
FileID: download the same file that was uploaded in the previous Google Drive block: = {{$json.id}}
Add via Add option - Put Output File in Field: data
6.3. Audio transcription via OpenAI
Node: OpenAI (Transcribe Audio)
Setup:
Operation: “Transcribe a Recording”.
Login: Binary data from Google Drive called data.
6.4. Generating a squeeze via OpenAI
Node: OpenAI
Purpose: Create short extract from the data obtained.
Connect your OpenAI credentials
From the list, select a previously created assistant who will summarize the received text
Input data: = {{$json.data}} text from the previous block
6.5. Creating a final post
Node: OpenAI (Telegram Poster)
Purpose: Combine the full information and the extract for publication.
Select a previously created assistant to create posts.
Input data:
Using the schema format, drag the output from the HTTP block to transfer the full text. Also, enter the output from the previous block with the extract: = {{$json.output}}
6.6. The final sending of a message to Telegram
Node: Telegram
ChatID: Use the chat ID from Telegram Trigger.
Text: Use the result from OpenAI (Creating a Final Post).
The result
You should be able to:
It's done.
This scheme allows you to minimize manual labor and instantly publish structured posts about new videos on YouTube.