Skip to content

danpasecinic/telegram-whatsapp-bridge

Repository files navigation

Telegram → WhatsApp Bridge

Forward posts from Telegram channels to WhatsApp (group or channel). Supports text, photos, videos, documents, and audio. Automatically skips reposts/forwards from other channels.

Setup

  1. Install dependencies

    npm install
  2. Configure environment

    cp .env.example .env
  3. Get Telegram Bot Token

    • Message @BotFather/newbot
    • Add bot as admin to your Telegram channel
    • Copy token to .env
  4. Run the bridge

    npm start
  5. Connect WhatsApp

    • Scan QR code with WhatsApp
    • Copy desired chat ID from console to .env
    • Restart

Docker

# Build and run
docker compose up -d

# View logs
docker compose logs -f

# First run - get QR code
docker compose logs -f bridge

Session and logs persist in ./data/ directory.

CI/CD

Pushing to main triggers automatic deployment to EC2 via GitHub Actions.

Required GitHub Secrets:

Secret Description
EC2_HOST EC2 instance IP or hostname
EC2_SSH_KEY Private SSH key for ec2-user access

Environment Variables

Variable Description
TELEGRAM_BOT_TOKEN Bot token from @BotFather
TELEGRAM_CHANNEL_ID Channel ID to monitor (optional, monitors all if empty)
WHATSAPP_CHAT_ID Target WhatsApp chat (123@g.us for groups, 123@newsletter for channels)
LOG_DIR Log directory (default: ./logs)
DATA_DIR Data directory for WhatsApp session (default: .)
DEBUG Enable debug logging (set to 1)

Notes

  • For WhatsApp Channels, your account must be an admin
  • Session persists in .wwebjs_auth/ folder
  • Large files may fail due to Telegram API limits (20MB for bots)

About

Forward posts from Telegram channels to WhatsApp (group or channel). Supports text, photos, documents, video, and audio.

Topics

Resources

License

Stars

Watchers

Forks

Contributors