Quote

1. goal

Define and describe the step-by-step process of creating and configuring automation that views a YouTube channel/channels, reads videos from there, and posts to a Telegram group.

2. Scope of application

This solution is ideal for bloggers, media companies, and marketers who want to automate the process of creating posts and engaging audiences with new videos.

3. Tools

RSS Feed Trigger (Reading YouTube RSS Feed)

Add a node RSS Feed Trigger:

  • Click on the plus icon in the upper right corner
  • In the search, we find and choose RSS Feed Trigger.
  • Paste the link to the RSS feed of the desired YouTube channel.
  • Example: https://www.youtube.com/feeds/videos.xml?channel_id=UCX1sraLIy6wS2R-SMcdoakg
  • Install Poll Times on every minuteso that automation works all the time.

HTTP Request (Downloading audio via an external service)

Add a node HTTP Request:

  • 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.

If (Response Processing Branch)

Add a node If:

  • Check that the content-type header value is text/plain. If the title matches, then there is a text transcription of the video.
  • Otherwise, the system downloads the audio file for further processing.
  • To transfer content type or any other data in the further automation process, we recommend simply dragging blocks in mode 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

This is how you should get an If block:

The first case (If a YouTube video has no subtitles, the code will download the video itself and transcribe it)

Google Drive (File Handling)

Google Drive (Upload)

Add a node Google Drive:

Connect your credentials

You can see how to do this here.

Next:

  • Operation: Upload
  • Specify Drive and Folder where files will be downloaded.
  • Send the file (audio) from the answer to the previous blocks - Input Data Field Name: specify data.
  • Make sure the Google API is set up and activated.

Google Drive (Download)

Add a node Google Drive:

  • Use the file ID obtained from Google Drive Upload - {{$json.id}}.
  • Specify saving binary data in the data - Put Output File in Field field: specify data.
  • Make sure that the file is being downloaded correctly and that it is available.

OpenAI (Text Transcription and Analysis)

OpenAI (Audio Transcription)

Add a node OpenAI (Transcribe a recodring):

Connect your credentials

How to do this, see the instructions here.

  • Resource: Audio
  • Operation: Transcribe a Recording.
  • Transfer binary data from Google Drive - Input Data Field Name: data.
  • Make sure that the OpenAI API key is configured correctly.

OpenAI (Making an extract from the full text)

Add a node OpenAI:

  • Create an assistant for generating extracts from transcription, following of this instruction.
  • Choose the assistant you created.
  • In the parameters, pass the received text from the previous node.

OpenAI (Creating a post for Telegram)

Add a node OpenAI:

  • Create an agent who forms the final post based on full text transcription and excerpts.
  • Set AI to generate text not exceeding 700 characters (Telegram limit)
  • Select the assistant you created
  • Enter the input text:

An example of an input text template:
Here is the full information: {{$ ('OpenAI') .item.json.text}}

Here is the summary: {{$json.output}}

Telegram (Checking and sending messages)

Telegram (Submit for review)

Add a node Telegram:

  • Type: send message
  • ChatID: Chat ID.

To find out your ChatID:

Create a Telegram trigger block (on message)

And connect your credentials to it, namely the Telegram bot API key that you get when you create a bot at https://t.me/BotFather

Once connected, click Test node and send any message.

After the trigger is triggered, you will receive your ChatID and the Telegram trigger block can be removed.

  • Caption: Paste text from the previous OpenAI block.
  • Add confirmation buttons:
    <a href="{{ $execution.resumeUrl }}?answer=no">Please tap <a href="{{ $execution.resumeUrl }}?answer=go">Go</a> or No.</a>
  • Add Parse Mode: HTML.

Wait (Waiting for user response)

Add a node Wait:

  • Set it up to resuming via webhook.
  • HTTP Method select GET
  • Respond: Immediately.

If (User Response Verification)

Add a node If:

  • Please check that {{$json.query.answer}} is go.
  • If the answer no, the process stops.

Telegram (Final message sending)

Add a node Telegram:

  • Copy the input data from the previous Telegram block, but without the confirmation buttons.
  • Thus, if the condition If verily, he will depart final post.

As a result, your first case should look like this:

The second case (If YouTube videos have subtitles available and the code downloads them)

Now, if the HTTP node's response passes the IF = text/plain check, then proceed directly to extract the received text

OpenAI (Making an extract from the full text)

Add a node OpenAI:

  • Create an assistant for generating extracts from transcription, following of this instruction.
  • In the parameters, pass the received text from the previous node.

OpenAI (Creating a post for Telegram)

Add a node OpenAI:

  • Create an agent who forms the final post based on full text transcription and excerpts.
  • Set AI to generate text not exceeding 700 characters (Telegram limit)
  • Choose the assistant you just created
  • Enter the input text:

An example of an input text template:
Here is the full information: {{$ ('OpenAI') .item.json.text}}

Here is the summary: {{$json.output}}

Telegram (Checking and sending messages)

Telegram (Submit for review)

Add a node Telegram:

  • Type: send message
  • ChatID: Chat ID.

To find out your ChatID:

Create a Telegram trigger block (on message)

And connect your credentials to it, namely the Telegram bot API key that you get when you create a bot at https://t.me/BotFather

Once connected, click Test node and send any message.

After the trigger is triggered, you will receive your ChatID and the Telegram trigger block can be removed.

  • Caption: Paste text from the previous OpenAI block.
  • Add confirmation buttons:
    <a href="{{ $execution.resumeUrl }}?answer=no">Please tap <a href="{{ $execution.resumeUrl }}?answer=go">Go</a> or No.</a>
  • Add Parse Mode: HTML.

Wait (Waiting for user response)

Add a node Wait:

  • Set it up to resuming via webhook.
  • HTTP Method select GET
  • Respond: Immediately.

If (User Response Verification)

Add a node If:

  • Please check that {{$json.query.answer}} is go.
  • If the answer no, the process stops.

Telegram (Final message sending)

Add a node Telegram:

  • Copy the input data from the previous Telegram block, but without the confirmation buttons.
  • Thus, if the condition If verily, he will depart final post.

As a result, you should have:

It's done.

We have created and configured automation that views the YouTube channel/channels, reads videos from there and publishes posts to a Telegram group.