Workflow
Your First AI Workflow in n8n: A Daily Digest, Step by Step
Build a real AI workflow in self-hosted n8n: fetch articles, summarize them with an LLM, and deliver a daily digest to Telegram — with prompts included.
The fastest way to understand why people bolt LLMs onto n8n is to build something small that you’ll actually keep using. Not a chatbot demo — a workflow that quietly does a job every morning.
So that’s what we’ll build: a daily digest bot. Every morning at 8:00, it pulls the latest posts from feeds you care about, has an LLM summarize each one and rank what’s worth your time, and sends the digest to your Telegram. Ten nodes, ~20 minutes, and it exercises the exact patterns — trigger → fetch → LLM → deliver — that every bigger AI workflow is made of.
Why run AI workflows on your own instance
One paragraph of context, because it shapes the design: AI workflows are chatty. A digest is one run a day, but the moment you graduate to agents — which loop, call tools, retry — execution counts explode. On metered platforms that’s a bill; on your own instance it’s noise. This is a big part of why we self-host. It also means your prompts and data go straight from your server to your LLM provider, with no automation middleman in between.
Step 1 — Credentials first
In n8n: Settings → Credentials → Add credential.
- Your LLM provider (e.g. Anthropic API or OpenAI API): paste your API key.
- Telegram: message @BotFather in Telegram, send
/newbot, follow the prompts, and paste the bot token it gives you into a Telegram API credential. Then message your new bot once (bots can’t message you first), and get your chat ID by openinghttps://api.telegram.org/bot<TOKEN>/getUpdates— yourchat.idis in the JSON.
Step 2 — Trigger and fetch
Create a new workflow, then:
1. Schedule Trigger — set it to every day at 08:00. (Your instance’s GENERIC_TIMEZONE determines what 08:00 means — a classic gotcha.)
2. RSS Read — paste a feed URL, e.g. https://hnrss.org/frontpage for Hacker News. For multiple feeds, add several RSS Read nodes and join them with a Merge node; start with one until the pipeline works.
3. Filter — keep only items from the last 24 hours, so you never re-digest old posts. Condition (expression):
{{ new Date($json.isoDate).getTime() > Date.now() - 24*60*60*1000 }}
4. Limit — cap at ~15 items. This bounds your token spend and keeps the digest readable.
Run the workflow manually after each node and look at the output data. This habit — watching the actual JSON move between nodes — is 80% of learning n8n.
Step 3 — The LLM does its thing
Add a Basic LLM Chain node (from the AI section), attach your chat model to it (e.g. Claude Haiku or GPT-4o-mini — small, fast and cheap is right for summarization), and set the prompt. Two important choices here:
First, aggregate before you summarize. By default n8n runs a node once per item — 15 items would mean 15 separate LLM calls and no ability to rank across them. Add an Aggregate node before the LLM (aggregate all items into one), so the model sees the whole batch and you pay for one call.
Then, the prompt. In the LLM node:
You are my morning tech-news editor. Below are article titles and
links from the last 24 hours, as JSON.
Write a digest in this exact format:
- Start with one sentence: the single most important theme today.
- Then a "Top picks" list: the 3–5 items genuinely worth reading.
For each: the title as a plain line, one-sentence summary of why
it matters, then the link on its own line.
- Skip duplicates, product ads, and low-substance posts. If nothing
is worth reading, say so honestly rather than padding.
- Plain text only. No markdown headers, no asterisks. Under 200 words.
Articles:
{{ JSON.stringify($json.data) }}
Two habits in that prompt worth stealing for every AI workflow: give the model an editorial role with permission to say “nothing today” (it kills padding), and dictate the output format explicitly (downstream nodes depend on it — vague prompts produce format drift, and format drift breaks automations).
Step 4 — Deliver
Add a Telegram → Send Message node: your credential, your chat ID, and the message field set to the LLM’s output:
{{ $json.text }}
Run the whole workflow manually. A few seconds later your phone buzzes with a ranked digest of the last 24 hours. That moment — when the pipeline runs end to end — is the whole concept clicking into place.
Now Activate the workflow (toggle, top right). It runs tomorrow at 8:00 without you.
Step 5 — Make it production-shaped
Two additions separate a demo from an automation you’ll trust for years:
- Error notifications. Create a second tiny workflow: Error Trigger → Telegram (
⚠️ Workflow {{ $json.workflow.name }} failed). Then in your digest workflow’s settings, set it as the error workflow. LLM APIs have bad days; you want a ping, not silent absence. - Retries on the LLM node. In the node’s settings, enable Retry on Fail (2 retries, a few seconds apart). Most LLM API failures are transient rate-limits; retries make them invisible.
Where to take it next
Everything past this point is variations on the pattern you just built:
- Swap sources: an IMAP node instead of RSS gives you “summarize my unread email”; an HTTP Request node pointed at any API gives you literally anything else.
- Swap destinations: Slack, email, Notion, a database.
- Add structure: ask the LLM for JSON (
Structured Output Parsernode) and route items programmatically — e.g., only send the digest at all if something scored “important.” - Graduate to agents: n8n’s AI Agent node gives the model tools it can decide to call — search, HTTP, your other workflows — plus memory. Same trigger/deliver skeleton, but the middle becomes a reasoning loop. That’s a future article in this series.
And a self-hosting note to close: once workflows like this become part of your morning, their reliability starts to matter. That’s your cue to have backups and a sane update routine in place — the unglamorous half of owning your automation.