Hey there, Dev.to community! šŸ‘‹ I’m Altuğ, and today I’m excited to share a fun project I built using n8n: a Telegram news bot named Laubali. This bot lets you get news summaries on Telegram by simply typing a category (like "/sports"), and it even adds a funny or slightly cheeky comment to each summary! šŸ˜„ Let’s dive into why I started this project and how it all came together.

What’s n8n and Why Should You Care?

If you haven’t heard of n8n yet, you’re in for a treat! šŸŽ‰ n8n is an open-source automation tool that lets you connect apps, APIs, and services with a visual, no-code interface. Think of it as a magical bridge that ties your favorite tools together—like Telegram, NewsAPI, or even Slack—without writing a single line of code (unless you want to!). With 86k stars on GitHub, it’s a community favorite! 🌟 You can use n8n to automate repetitive tasks, build bots (like Laubali!), send notifications, sync data between apps, or even create complex workflows. It’s perfect for developers who want to save time and have fun while doing it!

Why Did I Start This Project?

Let’s be honest—there are a million ways to get things done these days. As developers, keeping up with new tech and adapting is crucial. Some tools make our lives so much easier, even if they take away a bit of the ā€œchallengeā€ vibe. But at the end of the day, we all need to finish our tasks quickly and get paid, right? That’s why I decided to explore n8n, a powerful automation tool.

My motivation was a bit more personal: I was tired of spending hours browsing news sites or endlessly scrolling on Twitter (or X) for updates. I thought, ā€œWhy not build a simple news catcher?ā€ And by doing it through Telegram, I could get quick summaries and get on with my day! That’s how Laubali came to be.

Why Choose Telegram?

The biggest reason I chose Telegram is that its APIs are completely free. Instead of building a web app, I found it much easier to just open Telegram, type a message (like "/sports"), and kick off the workflow. I usually read news when I’m out and about, not at my computer. Sending a quick message from my phone to get summaries felt like the perfect solution.

Plus, Telegram has some awesome features! šŸš€ It’s fast, secure, and offers cross-platform support—so it works on your phone, tablet, or computer. Also, Telegram’s bot API is incredibly flexible. You can create a bot with BotFather in minutes and integrate it with n8n. For users, it’s a big win: just type a message and get news summaries instantly, right from your phone or any device!

The Fun Side of Laubali: Cheeky Comments

One of Laubali’s standout features is the funny and slightly cheeky comments it adds to each news summary. Wondering why I added this? Well, it’s a bit of a social critique. šŸ˜ In my country, even during the toughest times, some news anchors make the most casual and tactless remarks—it’s almost absurd. So, I decided to poke fun at that by naming my bot ā€œLaubaliā€ (which means ā€œtactlessā€ in Turkish for this case) and adding a witty comment to every summary. This feature really spices up the user experience.

Caching Mechanism: Why and How?

While designing Laubali, performance and cost management were key for me. n8n is free, but the AI Agent we use in this project (to summarize news and add comments) isn’t. Many of you reading this might be drawn to a ā€œfreeā€ setup, but resource management matters! That’s why I decided to add a caching mechanism.

The cache ensures that when the same category (like "/sports") is requested repeatedly, we don’t keep hitting NewsAPI and the AI Agent. Instead, we pull the data from the cache. This reduces API call costs and speeds up responses for users. For the first iteration, this solution works perfectly, but I’m sure some of you will add more advanced caching solutions—like using Redis or Supabase. I kept it simple for now.

Technical Challenges and What I Learned

For someone familiar with n8n, this project would probably take 2-3 hours to complete. But for me, the most challenging part was digging into n8n’s nodes and features by reading the documentation. n8n’s docs are pretty comprehensive, but understanding how each node works took some time. The second biggest challenge was figuring out how to implement the caching mechanism using global data (staticData).

We could’ve used docs, Google Drive, or a database for caching, but I wanted to keep things as simple as possible. The more features you add, the broader the project’s scope becomes. I thought, ā€œIf this article gets traction, we can revisit those ideas later.ā€ šŸ˜„

The biggest lesson I learned came after finishing the project. Some people around me said, ā€œWe could do this ourselves—what’s the big deal? We’d finish it in no time, no need for tools like this!ā€ But once the project was done, I realized something: Sure, a developer can build this easily. But when it comes to serving hundreds of users quickly at scale, n8n saves a ton of time and gets the job done. I truly appreciated the power of automation!

Prerequisites: Setting Up a Telegram Bot and NewsAPI

Before diving into how Laubali works, let’s go over the technical setup you’ll need to get started. To bring Laubali to life, you’ll need two things: a Telegram bot and an API key from NewsAPI to fetch news. Don’t worry, both steps are super easy! šŸš€ Let’s get started.

Step 1: Create a Telegram Bot

We’ll use Telegram’s official bot manager, BotFather, to create a bot. Here’s how:

  1. Find BotFather: Open Telegram, search for @BotFather, and start a chat with the official BotFather account. (Look for the blue checkmark to avoid impostors! šŸ˜„)
  2. Create a New Bot: Send /start, then send the /newbot command.
  3. Name Your Bot: BotFather will ask for your bot’s name and username. For example:
    • Name: LaubaliNewsBot
    • Username: @LaubaliNewsBot (The username must end with "Bot.")
  4. Get Your Token: BotFather will give you an API token, something like: 123456:YOUR-TELEGRAM-BOT-TOKEN. Save this token somewhere safe—you’ll need it to connect your bot to n8n.
  5. Test Your Bot: Go to your bot on Telegram and send /start. It won’t do much yet, but it’s nice to see it’s ready! 😊

That’s it! You now have a Telegram bot. We’ll use this token in n8n’s Telegram Trigger and Telegram nodes.

Step 2: Get a NewsAPI Key

Laubali fetches news from NewsAPI, a great service for pulling news based on categories. To get your API key, follow these steps:

  1. Sign Up for NewsAPI: Head to NewsAPI and click ā€œGet API Keyā€ to create an account. You can sign up with your email.
  2. Grab Your API Key: After signing up, NewsAPI will provide you with an API key, like: YOUR-NEWSAPI-KEY. Save this key as well.
  3. Test the API (Optional): You can test the API in your browser with this URL:
https://newsapi.org/v2/everything?q=sports&pageSize=5&apiKey=[YOUR_API_KEY]

This will return 5 news articles for the "sports" category. If you see a JSON response with news, you’re good to go!

Note: The free plan of NewsAPI has some limitations (like a daily request limit). That’s why our caching mechanism will come in handy for this project! šŸ˜‰

Step 3: Set Up n8n

Finally, make sure you have n8n installed. If you’re running n8n locally, you might need a tool like ngrok to create a webhook URL (since Telegram needs a webhook URL to listen to your bot). If you’re using n8n’s cloud version, you’ll already have a webhook URL. For more details, check out the n8n documentation.

How Does Laubali Work?

Let’s dive into the technical side of Laubali. When a user types a category (like "/sports"), the bot follows these steps:

  1. Capture the Category: The Telegram Trigger node catches the user’s message ("/sports") and the Set Interest node stores it in the interest variable.
  2. Validate the Category: The If Valid Interest node checks if the category is valid (e.g., "/sports", "/technology"). If it’s invalid, the user gets an error message.
  3. Check the Cache: The Check Static Data and If Cache False nodes check if there’s data in the cache and if it’s less than 30 minutes old.
    • If there’s cached data: The Set Cached Summaries node grabs the summaries, and send cached message sends them to the user.
    • If there’s no cached data: The workflow continues.
  4. Fetch News: The NewsAPI node pulls 5 news articles for the selected category from NewsAPI.
  5. Summarize and Add Comments: The Edit Fields node formats the news, then the AI Agent node summarizes each article and adds a funny comment. I also added a Simple Memory to the AI Agent. It’s not actively used right now, but in the future, it’ll help with conversational continuity (e.g., if the user says, ā€œSummarize more sports news,ā€ it can recall the context).
  6. Cache the Summaries: The Set Cache Data nodes save the summaries to the cache.
  7. Send to the User: Finally, the Send Message node sends the summaries to the user.

This workflow runs smoothly and delivers results quickly, with the cache ensuring near-instant responses for repeated requests.

Why Should You Use Laubali?

For me, time is precious. I’d rather get daily news summaries quickly without wading through ad-heavy, toxic platforms, so I can focus on my day. When I want in-depth news, I’ll dive into those platforms and do my research. But for a quick daily summary while sipping my coffee, Laubali is the perfect solution! ā˜•

Laubali’s best feature, in my opinion, is its simplicity and the ad-free experience it offers. It’s ideal for anyone who wants to stay informed quickly while having a bit of fun along the way.

The Future of the Project and a Gift for You

While working on this project, I realized that n8n is a gateway to a vast world of automation. But I intentionally kept the project’s scope small. I think this article provides enough lessons and examples for anyone looking to learn n8n and see a sample project in action. Laubali will stay active for a few days before I shut it down. But I want everyone to benefit from this project!

So, I’m sharing the entire workflow in a laubali-workflow.json file: laubali-n8n-workflow.json. To use this workflow, copy the JSON content from the link, go to your n8n instance, and import it via the "Import Workflow" option. Make sure to set up your Telegram bot token and NewsAPI key in the respective nodes! You can load this file into your n8n instance to use Laubali as your own bot or build on top of it. Maybe you’ll add a conversational loop, or perhaps a news verification feature—it’s totally up to you! šŸ˜„ (Remember the prerequisites, otherwise it WILL NOT WORK!)

Final Thoughts

Building Laubali was both a learning experience and a lot of fun. Exploring n8n’s automation capabilities, simplifying my news consumption, and adding a bit of humor with a social critique made this project a joy to work on. I hope this article inspires you to create your own automation projects! What else would you add to Laubali? I’d love to hear your ideas in the comments! šŸš€

If You Want to Try This Project

If you’d like to access and use this project, it’s super simple! Just search for @LaubaliBot on Telegram and start using it. (I want to make it clear: this bot will never ask you for money or anything like that. There are a lot of fake bots on Telegram, so I’m warning you just in case you come across one!)