DEV Community

Cover image for I Built a Daily News Newsletter Bot with Hermes Agent — Here's Everything That Went Wrong (and Right)
Hemalatha Nambiradje
Hemalatha Nambiradje

Posted on

I Built a Daily News Newsletter Bot with Hermes Agent — Here's Everything That Went Wrong (and Right)

Hermes Agent Challenge Submission: Build With Hermes Agent

Submitted for the Hermes Agent Challenge

The Idea

I wanted one simple thing: a daily email that lands in my inbox every morning with the top news from Canada, the world, India, and the AI/tech space — plus a motivational quote and a health tip. One email. Everything in one place. No scrolling through five different apps before my coffee.

Sounds simple. It wasn't.

This is the honest story of building a daily briefing bot using Hermes Agent — including every wall I hit, every config I lost, and every moment where it finally clicked.

The Stack (Zero Cost, Fully Open Source)

Hermes Agent — the brain that fetches news and generates the newsletter
GitHub Codespaces — free cloud dev environment (no touching my personal Mac)
TypeScript + Nodemailer — sends the email via Gmail SMTP
OpenRouter — free LLM API for Hermes to use

No paid services. No cloud bills. Just open source tooling wired together.

Why GitHub Codespaces?

I specifically didn't want this running on my personal Mac. I wanted it isolated — something I could destroy and rebuild without affecting my machine. GitHub Codespaces gave me a free Linux environment in the browser. Perfect.
Or so I thought.

The Problems (The Real Story)

Problem 1: The Typo That Took 30 Minutes
After getting Nodemailer set up and running my send script, the terminal just... hung. No error. No output. Just silence.
I thought it was a firewall issue in Codespaces blocking SMTP port 587. I switched to port 465. Still hanging on some runs. I added verbose logging. I tried verify() calls.

Then I spotted it:
hostname: 'smpt.gmail.com'

smpt instead of smtp. One transposed letter. Thirty minutes of debugging.
Lesson: Always print your env vars before debugging the code.

Problem 2: Rebuilding the Container Deleted Everything
This one hurt. I had Hermes installed, my .env configured, my SMTP secrets set up, everything working. Then I rebuilt my Codespace container to fix an unrelated issue.
Gone. All of it.
Hermes was uninstalled. My environment variables vanished. My .env file disappeared. I had to reinstall everything from scratch and reconfigure all my secrets.
The fix was two things:
First, create a .devcontainer/devcontainer.json so Hermes auto-installs on every rebuild:

{
  "name": "daily-brief-hermes",
  "postCreateCommand": "pip install hermes-agent && npm install"
}
Enter fullscreen mode Exit fullscreen mode

Second, keep secrets in ~/.hermes/.env and your project .env committed to a safe location — not just floating in your shell session.
Lesson: Never trust your shell session. Anything not written to a file is gone the moment the container rebuilds.

Problem 3: ts-node Fighting with "type": "module"
My package.json had "type": "module" in it, which made ts-node throw:
TypeError: Unknown file extension ".ts"
Three different error messages, two config changes, one Stack Overflow rabbit hole. The fix was switching from ts-node to tsx — a drop-in replacement that handles both ESM and CommonJS without any config:

npm install --save-dev tsx
npx tsx send-newsletter.ts briefings/2026-05-26.md
Enter fullscreen mode Exit fullscreen mode

Lesson: Use tsx over ts-node for TypeScript in modern Node projects. It just works.

*Problem 4: * "Newsletter Sent!" But No Email
The most confusing moment. The script printed Newsletter sent! — Nodemailer was happy, no errors thrown. But my inbox was empty.
Three possible culprits I had to rule out one by one:

Spam folder — it was there. Gmail flagged it as spam.
Wrong app password — Gmail requires a 16-character App Password, not your regular login password. Easy to get wrong.
Empty file being sent — the file path resolved correctly but the content hadn't been written yet.

The spam issue was fixed by adding a proper sender name and dynamic subject line:

await transporter.sendMail({
  from: `"Daily Brief 📰" <${SMTP_USER}>`,
  to: RECIPIENTS.join(", "),
  subject: `Daily Brief — ${new Date().toLocaleDateString("en-CA", {
    weekday: "long",
    year: "numeric",
    month: "long",
    day: "numeric"
  })}`,
  text: body,
});

Enter fullscreen mode Exit fullscreen mode

Lesson: Always check spam. Always use Gmail App Passwords, not your account password. Always mark the first email as "Not Spam" to train Gmail.

Problem 5: Hermes Had No Model Configured
After getting email working, I opened hermes chat and pasted my newsletter prompt. Hermes responded with:

No inference provider configured. Run 'hermes model' to choose a provider and model,
or set an API key in ~/.hermes/.env
Enter fullscreen mode Exit fullscreen mode

Then after adding the OpenRouter key:

HTTP 400: No models provided
Enter fullscreen mode Exit fullscreen mode

The API key was there but no model was set. The fix was adding HERMES_MODEL to ~/.hermes/.env:

OPENROUTER_API_KEY=sk-or-xxxxxxxxxxxxxxxx
HERMES_MODEL=owlobot/owl-7b
Enter fullscreen mode Exit fullscreen mode

Lesson: Hermes needs both an API key AND a model specified. One without the other gives cryptic errors.

What Actually Worked Beautifully

Once everything was configured, Hermes was genuinely impressive to use. I pasted a plain English prompt:

Today is 2026-05-26. Search the web for today's top 5 headlines for 
Canada news, World news, India news, and AI/tech news. Add one 
motivational quote and one health tip. Format as Markdown and save to 
/workspaces/daily-brief-hermes/briefings/2026-05-26.md
Enter fullscreen mode Exit fullscreen mode

And Hermes:

  • Searched the web for current headlines across all four categories
  • Summarized each story in readable bullet points
  • Added a motivational quote and health tip
  • Formatted everything as clean Markdown
  • Saved it to the exact file path I specified

That's the part that made the whole painful setup worth it. I didn't write a single line of news-fetching code. No RSS parsers, no news APIs, no scraping. Hermes handled all of it through natural language.

The Final Architecture

~/.hermes/.env
  └── OPENROUTER_API_KEY + HERMES_MODEL
  └── SMTP credentials

hermes chat (manual trigger or cron)
  └── Reads skills/daily_brief.md prompt
  └── Searches web for today's news
  └── Generates Markdown newsletter
  └── Saves to briefings/YYYY-MM-DD.md

npx tsx send-newsletter.ts briefings/YYYY-MM-DD.md
  └── Reads ~/.hermes/.env for SMTP credentials
  └── Sends email via Gmail SMTP port 465
  └── Delivers to all recipients in the list

Enter fullscreen mode Exit fullscreen mode

The Hermes Cron Setup (For Fully Automatic Daily Runs)

hermes cron start

Inside hermes chat:

/cron add "0 8 * * *" "Read the skill at /workspaces/daily-brief-hermes/skills/daily_brief.md 
and generate today's newsletter. Save it to /workspaces/daily-brief-hermes/briefings/
$(date +%Y-%m-%d).md then run: npx tsx /workspaces/daily-brief-hermes/send-newsletter.ts 
/workspaces/daily-brief-hermes/briefings/$(date +%Y-%m-%d).md"
Enter fullscreen mode Exit fullscreen mode

Every day at 8am UTC, Hermes generates and sends the newsletter automatically.

Note: Codespaces sleeps when idle, so for a truly always-on setup you'd move this to a small VPS. But for prototyping and learning, Codespaces works perfectly.

What I'd Tell Someone Starting This Today

  1. Create .devcontainer/devcontainer.json on day one. Don't wait until you've lost your setup to a rebuild.
  2. Keep all secrets in files, never just in shell exports. Shell exports vanish. Files don't.
  3. Use tsx instead of ts-node. It handles modern Node module systems without fighting your package.json.
  4. Test the email script completely before touching Hermes cron. Get email working first. Then add the AI layer.
  5. Print your env vars before debugging network issues. echo $SMTP_HOST takes two seconds and would have saved me thirty minutes.
  6. Check spam. Seriously. Check spam first.

Final Thoughts on Hermes Agent

The setup friction is real — especially in a Codespaces environment where rebuilds wipe your state. But once Hermes is configured, the experience of writing plain English instructions and watching it search the web, reason about content, and produce structured output is genuinely different from anything I've built before.

I didn't write a news aggregator. I didn't build a scraper. I wrote a prompt and a TypeScript email script, and I get a daily briefing in my inbox every morning.

That's the part that sticks with me.

Built for the Hermes Agent Challenge | GitHub: daily-brief-hermes

Top comments (0)