See llms.txt for all machine-readable content.

Back to Templates

Summarize Telegram-shared webpages with OpenAI GPT-4o

Created by

Created by: Dr. Firas || drfiras
Dr. Firas

Last update

Last update 5 hours ago

Categories

Share


Quick overview

This workflow listens for Telegram messages containing a URL, fetches and cleans the webpage content, summarizes it with an OpenAI chat model, and replies in the same Telegram chat with a formatted summary including key points and action items.

How it works

  1. Triggers when a new Telegram message is received by your bot.
  2. Extracts the first http/https URL from the message text and captures the sender’s chat ID.
  3. If no valid URL is found, sends an error message back to the same Telegram chat.
  4. If a valid URL is found, fetches the webpage HTML and extracts the title and cleaned body text while removing common boilerplate elements.
  5. Truncates the extracted text to a configurable maximum length and sends the title, URL, and text to OpenAI to generate a structured JSON summary.
  6. Formats the JSON into Telegram HTML (title, source link, summary, key points, and insights/action items) and sends it back to the original chat.

Setup

  1. Create a Telegram bot and add a Telegram API credential in n8n, then select it in both the Telegram Trigger and the send-message steps.
  2. Add an OpenAI API credential in n8n and select it for the OpenAI chat model used for summarization.
  3. Activate the workflow and send a Telegram message to your bot containing a webpage link starting with http:// or https://.
  4. Optionally adjust the configuration values for the OpenAI model, maximum page text size, and whether to include the raw URL in the summarization prompt.

Additional info

Summarize webpages shared in Telegram

📥 Open full documentation on Notion

Need help customizing?

Contact me for consulting and support : Linkedin

MY NEW YOUTUBE CHANNEL

👉 Subscribe to my new YouTube channel. Here I'll share videos and Shorts with practical tutorials and FREE templates for n8n.

The AI Doctor