Emoji Financial News Bot

 import logging
import requests
from telegram import Update, Bot
from telegram.ext import (
from abilities import apply_llm_prompt_to_every_item
from bs4 import BeautifulSoup

logger = logging.getLogger(__name__)

RSS_FEED_URL = "https://news.google.com/rss/search?q=when:24h+allinurl:bloomberg.com&hl=en-US&gl=US&ceid=US:en"

def fetch_financial_news_titles() -> list[str]:
    logger.info("Fetching financial news titles")
    response = requests.get(RSS_FEED_URL)
    soup = BeautifulSoup(response.content, "lxml-xml")

About this template

This app creates a Telegram bot that fetches the latest financial news from Bloomberg's RSS feed, analyzes the news titles using LLM ability, and shares it with users in the form of emoji representations. The user will be asked for their API token when they run the app.

Introduction to Emoji Financial News Bot Template

Welcome to the Emoji Financial News Bot template! This template allows you to create a Telegram bot that fetches the latest financial news from Bloomberg's RSS feed, analyzes the news titles using an LLM ability, and shares it with users in the form of emoji representations. This article will guide you through the steps to set up and use this template on the Lazy platform.

To get started, click on "Start with this Template" on the Lazy platform. This will pre-populate the code in the Lazy Builder interface, so you won't need to copy, paste, or delete any code manually.

Setting Environment Secrets

Before you can use the Emoji Financial News Bot, you need to set an environment secret for the Telegram API token. This token is necessary for your bot to authenticate and interact with the Telegram API.

  • Go to the Environment Secrets tab within the Lazy Builder.
  • Click on "Add Secret" and enter the key as TELEGRAM_API_TOKEN.
  • For the value, enter your actual Telegram bot API token that you obtained from the BotFather on Telegram.
  • Save the secret.

External Integrations

No external integrations are required for this template beyond obtaining a Telegram bot API token from the BotFather on Telegram. If you haven't already created a bot and obtained a token, please follow these steps:

  • Search for the "BotFather" on Telegram and start a conversation.
  • Use the /newbot command to create a new bot.
  • Follow the instructions provided by BotFather to set up your bot and receive your API token.

Using the Test Button

Once you have set your environment secret, you can use the Test button to begin the deployment of the app. The Lazy CLI will launch, and you will be prompted for any required user input only after using the Test button.

When you press the Test button, the app will start, and you will be asked to enter your Telegram API token through the Lazy CLI. This is the same token you saved earlier as an environment secret.

Interacting with Your Telegram Bot

After the deployment is complete, you can interact with your Telegram bot. Here's how:

  • Open Telegram and search for your bot by the username you gave it during the setup with BotFather.
  • Start a conversation with your bot by sending the /start command.
  • Your bot will welcome you and provide instructions to type /news to get the latest financial news in emojis.
  • When you send the /news command, the bot will fetch and analyze the latest financial news titles and send them back to you in emoji form.

That's it! You now have a working Telegram bot that provides financial news updates in a fun and engaging emoji format. Enjoy your new Emoji Financial News Bot, and don't hesitate to reach out for support if you encounter any issues.

Last published
April 7, 2024

More templates like this

Customisable Server Status Dashboard

This template allows you to create a dashboard to report about incidents regarding your server to your users.


A bot that answers questions about data

Ask questions about your database via a chat bot. This chatbot connects to a SQLITE database, generates queries for it based on the schema and then runs the queries printing the response all in a nicely styled chat UI. This template is pre-loaded with sample data (car parts) to play around with - here are the sample data columns that you can query: part_number, part_name, price, units_left_in_stock, manufacturer .


WhatsApp Bot Builder

The WhatsApp Bot Builder app allows users to create a WhatsApp bot that responds to every message with "Hello World".

Emoji Financial News Bot