Templates by Rudi Afandi
Extract text from images with Telegram Bot & OCR Tesseractjs
Description This n8n workflow enables users to send an image to a Telegram bot and receive the extracted text using Tesseract OCR (via the n8n-nodes-tesseractjs Community Node). It's a quick and straightforward way to convert images into readable text directly through chat. How it Works The workflow listens for new image messages coming in via the Telegram bot. Once an image is received, it downloads the image file from Telegram (which initially arrives as application/octet-stream). The image data, now properly identified, is then sent to the Tesseract OCR node to extract the text. Finally, the recognized text is sent back as a reply to the Telegram user. Setup Steps Install Community Node: Ensure you have installed n8n-nodes-tesseractjs in your n8n instance. Connect Telegram Bot: Configure the Telegram Trigger node with your Telegram bot. Bot Token: Add your Telegram bot token to the Send Message node to send replies. Deploy & Test: Activate (deploy) the workflow and send an image to your Telegram bot to test.
Extract text from images with Telegram Bot & Gemini 2.0 Flash OCR
Description Turn your Telegram bot into a powerful OCR (Optical Character Recognition) tool. This workflow allows you to send any image (like a screenshot, a photo of a document, or a picture of a sign) to your bot, and it will instantly extract and send back the text from that image. Powered by Google's advanced Gemini AI, this automation is perfect for quickly digitizing notes, saving important snippets, or avoiding manual typing. How it works This workflow performs a few high-level steps: It triggers when a new image is sent to your Telegram bot. It sends the image to the Google Gemini Vision API to be analyzed. It extracts the text found in the image. It sends the extracted text back to you as a message in Telegram. Set up steps Estimated set up time: Less than 5 minutes. The setup is straightforward. You only need to configure two credentials: Telegram Bot Credentials: To connect your bot. Google Gemini API Credentials: To use the OCR feature. You can get a free API key from Google AI Studio.
Create and manage short URLs with Telegram bot, MongoDB and Nginx redirects
This workflow contains community nodes that are only compatible with the self-hosted version of n8n. This workflow allows you to create and manage custom short URLs directly via Telegram, with all data stored in MongoDB, and redirects handled efficiently via Nginx. How it works This flow provides a seamless URL shortening experience: Create via Telegram: Send a long URL to your bot. It will ask if you want a custom short code. Store in MongoDB: All long URLs and their corresponding short codes are securely stored in your MongoDB instance. Fast Redirects: When a user accesses a short URL, Nginx forwards the request to a dedicated n8n webhook, which then quickly redirects them to the original long URL. Set up steps This setup is straightforward, especially if you already have a running n8n instance and a VPS. Difficulty: Medium (Basic n8n/VPS knowledge required) Estimated Time: 15-30 minutes n8n Instance & VPS: Ensure you have n8n running on your VPS (e.g., 2 core 2GB, as you have). Telegram Bot: Create a new bot via @BotFather and get your Bot Token. Add this as a Telegram credential in n8n. MongoDB Database: Set up a MongoDB instance (either on your VPS or a cloud service like MongoDB Atlas). Create a database and a collection (e.g., url or short_urls). Add your MongoDB credentials in n8n. Here's MongoDB data structure JSON: >[ {"_id": "686a11946a48b580d72d0397", "longUrl": "https://longurl.com/abcdefghijklm/", "shortUrl": "short-code"} ] Domain/Subdomain: Point a domain or subdomain (e.g., s.yourdomain.com) to your VPS IP address. This will be your short URL base. Nginx/Caddy Configuration: Configure your web server (Nginx or Caddy) on the VPS to proxy requests from your short URL domain to the n8n webhook for redirects. (Detailed Nginx config is provided as sticky notes in the redirect workflow) Workflow Setup: Import both provided n8n workflows (Telegram URL Shortener Creator and URL Redirect Handler). Activate both workflows. Crucial: Set an environment variable in your n8n instance (or .env file) named SHORTENER_DOMAIN with the value of your short URL domain (e.g., https://s.yourdomain.com). Refer to sticky notes inside the workflows for detailed node configurations and expressions.