Templates / Scheduled jobs
Daily RSS digest by email
Every morning, fetch your RSS feeds, pick the new items and email yourself a digest with Resend. No server, no cron box to maintain.
Turn a handful of blogs and changelogs into one morning email. The function fetches each feed, skips items it already sent, and emails the rest — nothing if there’s nothing new.
Build it with Wisp
Type this into Wisp, or press Build this — it writes the code below, deploys it and gives you a URL:
Every day at 7am, fetch the RSS feeds in the FEEDS variable, keep only items I haven’t seen, and email me a digest with links via the Resend API (RESEND_API_KEY, DIGEST_FROM, DIGEST_TO).
The code
*rss-digest · schedule `0 7 * `*
import { createHash } from 'node:crypto';
import { config, kv } from 'wisp';
const decode = (s) => s.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, '$1').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').trim();
const tag = (xml, name) => decode(xml.match(new RegExp(`<${name}[^>]*>([\\s\\S]*?)</${name}>`))?.[1] ?? '');
const esc = (s) => s.replace(/&/g, '&').replace(/</g, '<');
async function items(feed) {
const xml = await (await fetch(feed, { signal: AbortSignal.timeout(10_000) })).text();
// RSS uses <item>; Atom uses <entry> with <link href="…">.
return [...xml.matchAll(/<(item|entry)\b[\s\S]*?<\/\1>/g)].map(([x]) => ({
title: tag(x, 'title'),
link: tag(x, 'link') || x.match(/<link[^>]*href="([^"]+)"/)?.[1] || '',
}));
}
export async function handler() {
const feeds = config.require('FEEDS').split(',').map((f) => f.trim());
const fresh = [];
for (const feed of feeds) {
for (const item of (await items(feed).catch(() => [])).slice(0, 20)) {
const key = 'seen:' + createHash('sha1').update(item.link || item.title).digest('hex');
if (await kv.get(key)) continue;
await kv.set(key, true, { ttl: 60 * 86_400 });
fresh.push(item);
}
}
if (fresh.length === 0) return { sent: 0 };
await fetch('https://api.resend.com/emails', {
method: 'POST',
headers: { authorization: `Bearer ${config.require('RESEND_API_KEY')}`, 'content-type': 'application/json' },
body: JSON.stringify({
from: config.require('DIGEST_FROM'),
to: config.require('DIGEST_TO'),
subject: `${fresh.length} new posts`,
html: '<ul>' + fresh.map((i) => `<li><a href="${esc(i.link)}">${esc(i.title)}</a></li>`).join('') + '</ul>',
}),
});
return { sent: fresh.length };
}
Set it up
Add these in the project’s Variables & secrets (secrets are encrypted and never shown in logs):
FEEDS— A variable: feed URLs, comma-separated.RESEND_API_KEY— resend.com → API Keys. Any email API works; Resend needs the fewest lines.DIGEST_FROM / DIGEST_TO— Variables: a sender on a domain verified in Resend, and your address.
Try it
Press Run: the first run emails everything currently in the feeds (up to 20 per feed); run it again and it sends nothing until there are new posts.
How it works
- Feeds are parsed with two regular expressions — enough for RSS and Atom titles and links, with no XML library.
- Each sent link is remembered for 60 days in key-value storage, so items are never sent twice.
- A failing feed is skipped instead of failing the whole digest.
Variations
- Send to Slack or Discord instead of email.
- Summarise each post with an LLM before sending.
- Group items by feed, or send weekly instead of daily.
Questions
Why not use an RSS library? You can — add a package such as rss-parser. The regex version avoids a dependency and handles the common feeds; a library handles odd ones better.
Build it with Wisp — free trial