Pawan Bahuguna

Let's Learn and Share
Menu
  • Home
  • Certification Guide
  • Tips
  • Disclaimer
  • Privacy
  • Contact

Home
Automation
[FREE] Send YouTube Video Link to Telegram
Automation

[FREE] Send YouTube Video Link to Telegram

Pawan Bahuguna

Are you looking for an automated way to send YouTube video links to your Telegram channel without using the YouTube API? With GitHub Actions, you can achieve this seamlessly and for free!

This guide will use the yt2tg GitHub Action to automate the process, eliminating the need for complex API integrations.

Send YouTube Video Link to Telegram for free

Table of Contents

  • Why Automate YouTube Video Links to Telegram?
  • Why Use GitHub Actions for This?
  • Requirements
  • Configuration Steps
    • 1. Create a GitHub Repository
    • 2. Add GitHub Secrets
    • 3. Create a GitHub Workflow
    • 4. Commit and Push
  • Benefits of Using This GitHub Action
  • Conclusion

Why Automate YouTube Video Links to Telegram?

If you run a YouTube channel and a Telegram channel, you know how time-consuming it can be to manually share every new video link.

Automating this process can save you time, ensure consistency, and keep your Telegram audience updated in real-time. By using GitHub Actions, you can schedule this task to run automatically, eliminating the need for manual intervention.

Why Use GitHub Actions for This?

  • No YouTube API Required: No need to apply for API keys or worry about rate limits.
  • Completely Free: GitHub Actions offers free runner minutes for public/private repositories.
  • Automated & Reliable: Schedule checks for new videos and post them automatically.
  • Secure: Keeps your Telegram bot token and channel ID private using GitHub secrets.

Requirements

Before we dive into the setup, make sure you have the following:

  1. Telegram Bot Token: Create a Telegram bot using BotFather and get the bot token.
  2. Telegram Channel ID: Get the ID of your Telegram channel where the bot will post the YouTube video links.
  3. YouTube Channel ID: The ID of the YouTube channel whose videos you want to share. How to find YouTube Channel ID.
  4. GitHub Account: A free GitHub account to create and run the workflow.

Configuration Steps

1. Create a GitHub Repository

If you don’t have one already, create a GitHub repository where you will add the workflow.

2. Add GitHub Secrets

To keep your credentials secure, add the following secrets in your repository settings:

  • TELEGRAM_BOT_TOKEN: Your Telegram bot’s API token.
  • TELEGRAM_CHANNEL_ID: Your Telegram channel’s ID
  • YOUTUBE_CHANNEL_ID: The YouTube channel ID you want to monitor.

3. Create a GitHub Workflow

Inside your repository, create a directory .github/workflows/ and add a YAML file, e.g., yt2tg.yml with the following content:


name: Post YouTube Video to Telegram

permissions:
  contents: write

on:
  schedule:
    - cron: '0 * * * *' # Runs every hour


jobs:
  post-video:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0 

      - name: Post YouTube Video to Telegram
        uses: pawanbahuguna/yt2tg/@v1.0.0
        env:
          CHANNEL_ID: ${{ secrets.YT_CHANNEL_ID }}
          TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
          TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
          ALLOW_REPOST: true

      - name: Commit and Push Changes
        if: always()  # Ensure this step runs even if the previous step fails
        run: |
          git config --global user.name "GitHub Actions"
          git config --global user.email "[email protected]"
          git add last_video.txt
          git diff --quiet && git diff --staged --quiet || git commit -m "Update last_video.txt with latest video ID"
          git push

4. Commit and Push

Save and push your changes. The workflow will automatically check for new videos every hour and send the link to your Telegram channel.

Tip: If you want to add a manual trigger method, please check the example here.


Benefits of Using This GitHub Action

✅ No API Quota Restrictions – Unlike YouTube API, this does not require quota usage.

✅ Hands-Free Automation – Set it once, and it keeps running on schedule.

✅ Secure Storage – Secrets are stored securely in GitHub.

✅ Open-Source & Free – You don’t need to pay for any third-party services.


Conclusion

With the yt2tg GitHub Action, you can automate sending YouTube video links to your Telegram channel effortlessly. This method is free, easy to set up, and requires no YouTube API. Follow the steps above, and your automation will be up and running in no time!

Pro Tip: If you found this guide helpful, consider starring the yt2tg repository on GitHub to show your support and stay updated with future improvements.

Got questions or feedback? Leave a comment below! 🚀

Share
Pinterest
Linkedin
Tweet
Google+
Stumble
Email
Tags:How To Tips

Certifications at Discount

> Certified Kubernetes Security Specialist (CKS)
> Certified Kubernetes Application Developer (CKAD)!
> Certified Kubernetes Administrator (CKA)!
> Linux Networking and Administration (LFS211)
> Monitoring Systems and Services with Prometheus (LFS241)
> More at The Linux Foundation

Lets Connect

  • Popular
  • Recent

Free Newsletter

Subscribe NOW!

We don’t spam! Read our privacy policy for more info.

Check your inbox or spam folder to confirm your subscription.

Pawan Bahuguna

Let's Learn and Share
Copyright © 2025 Pawan Bahuguna
Home | Privacy Policy | Disclaimer | Contact