GitHunt
YA

yazdipour/trmnl-telegram-bot

πŸ“‘ Telegram β†’ TRMNL Image Forwarder

Warning

This project is deprecated. You can use instead https://github.com/yazdipour/TelegramToTRMNL which is a bit cleaner version of this project with more feature like pdf and epub reader.

πŸ“‘ Telegram β†’ TRMNL Image Forwarder

This project lets you forward images from Telegram directly to a TRMNL device display using a Pipedream integration.

It listens for incoming Telegram messages with images and captions, extracts the image and formatting info (CSS classes and styles), then sends that to your TRMNL plugin.

trmnl telegram ipad send to


✨ What It Does

  1. You send an image to a Telegram bot.

  2. Optionally, you include a caption with CSS-like formatting:

    • .className is extracted as img_class
    • anything else is added as inline img_style
  3. The bot grabs the image URL and formats a payload:

    {
      "merge_variables": {
        "img_url": "https://...",
        "img_class": "your-class",
        "img_style": "width:100%"
      }
    }
  4. This payload is sent to your TRMNL plugin and displayed.

Available CSS Classes

  • .invert - Enhances image brightness and saturation
  • .rotate - Rotates image 90Β° clockwise

css classes


πŸš€ Setup Instructions

βœ… Complete setup takes ~10–15 minutes


1. πŸ”Œ Set Up Your TRMNL Plugin

  1. Visit usetrmnl.com
  2. Go to Dashboard β†’ Plugins
  3. Click β€œ+ Add Plugin”
  4. Choose Custom Plugin and create Private Plugin with Webhook.
  5. Copy your plugin’s UUID which you'll need it later.
  6. Setup Markup by copying the content of the Markup.html (Can use it shared between different views)

2. πŸ€– Create a Telegram Bot

  1. Open @BotFather on Telegram

  2. Send /newbot and follow the prompts

  3. You'll receive a Bot Token, like:

    6119652656:AAxxxxx...
    

Save this for the Pipedream step.


3. βš™οΈ Set Up the Pipedream Workflow

You’ll use Pipedream.com to glue it all together

pipedream

Step A: Connect Telegram

  1. Go to Pipedream Telegram integrations
  2. Click β€œConnect Account”
  3. Paste your Telegram Bot Token when prompted

Step B: Import the Component

  1. Create a new workflow in Pipedream
  2. Choose Trigger: Telegram β†’ New Message
  3. Add a new β€œRun Node.js Code” step
  4. Paste the code from 'src.js` (in this repo)
  5. In the step config:
    • Select your Telegram bot
    • Set plugin_id to the TRMNL plugin UUID you copied earlier

Step C: Deploy

  • Save and deploy the workflow
  • Start sending images to your bot!

πŸ” Privacy & Security

  • Telegram file links are temporary and not public
  • You do not need to upload images to third-party services
  • No cloud image hosting needed β€” all via Telegram CDN

πŸ›Ÿ Need Help?

If you have issues setting up TRMNL, Telegram Bot, or Pipedream:


Made with πŸ’» by [Shahriar Yazdipour]

yazdipour/trmnl-telegram-bot | GitHunt