n8nDownload Viral Social Media Videos Directly From Telegram Using FetchMedia
n8n

Download Viral Social Media Videos Directly From Telegram Using FetchMedia

This workflow creates a Telegram bot that functions as a universal video downloader. It allows users to send links from popular social media platforms (like YouTube, TikTok, or Facebook) directly to a Telegram chat. The system automatically processes the link using the FetchMedia API, downloads the video, and sends the file back to the user. It also includes smart logic to handle Telegram's file size limits by providing a direct download link for larger files.

Download Here

How it works

  1. Receive Message: The workflow starts when a user sends a text message to your Telegram bot.

  2. Initiate Fetch: The workflow sends the verified URL to the FetchMedia API via an HTTP Request node to begin processing the video.

  3. Wait for Processing: A Wait node pauses execution until the FetchMedia API signals via a webhook that the video is ready for download.

  4. Success Check: An If node verifies that the API returned a "success" status.

    • If Failed: The bot sends an error message back to the user explaining why the download failed.
  5. Download & Size Check:

    • The workflow downloads the video file via an HTTP Request.

    • It checks the file size against a 49MB limit (Telegram bots generally have a 50MB upload limit).

  6. Delivery:

    • Under 49MB: The video file is uploaded directly to the Telegram chat.

    • Over 49MB: The bot sends a message stating the file is too large and provides a direct URL for the user to download the video externally.

How to use this template

To use this workflow, you will need to configure the following credentials and settings:

1. Telegram Bot Credentials

You need to create a bot via the "BotFather" on Telegram to get your API Token.

  • Open the Telegram Trigger node and the Telegram action nodes.

  • Create a new Telegram API credential type.

  • Enter the Access Token provided by BotFather.

2. FetchMedia API Key

You need a FetchMedia API key to process the social media links.

  • Open the node named Trigger FetchMedia Fetch.

  • In the Header Parameters, locate the X-API-KEY field.

  • Enter your valid FetchMedia API key from https://app.fetchmedia.io.

3. Webhook Configuration

This workflow uses a Wait node with a webhook callback to handle asynchronous video processing.

  • Ensure your n8n instance is publicly accessible (via a tunnel or server URL) so the FetchMedia API can call the webhook URL generated by the Wait For Video Fetch node.

Core Nodes Used

  • Telegram Trigger: Listens for incoming links.

  • HTTP Request: Interacts with the FetchMedia API and downloads video files.

  • Wait: Handles asynchronous API processing.

  • If: Manages logic for API success/failure and file size limits.

  • Telegram: Sends the final video or text notifications.

Keywords

Telegram, Video Downloader, Social Media, FetchMedia, YouTube, TikTok, Instagram, Automation, HTTP Request, Webhook.