Daily Gemini AI Summary Template
Fetch news, analyze it with Google Gemini, and send a summary to Telegram every morning.
Automate Your Intelligence Gathering
Staying on top of industry news can be overwhelming. With this Python template on LiteLambda, you can automatically pull the latest RSS feeds or API data, feed it into Google's powerful Gemini AI, and have a concise executive summary delivered to your phone every day.
How it Works
- Fetch: The script uses the built-in `requests` library to fetch JSON or RSS data from your preferred sources.
- Analyze: It sends the raw text to the `google-generativeai` SDK.
- Deliver: The synthesized markdown summary is sent directly to your Telegram or Slack bot.
The Code Template
You can drop this directly into a LiteLambda task and set the cron schedule to `0 8 * * *` (8:00 AM daily):
import requests
import json
import os
import google.generativeai as genai
# Configure your API keys in LiteLambda's Secrets Manager
GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY")
TELEGRAM_BOT_TOKEN = os.environ.get("TELEGRAM_BOT_TOKEN")
TELEGRAM_CHAT_ID = os.environ.get("TELEGRAM_CHAT_ID")
genai.configure(api_key=GEMINI_API_KEY)
model = genai.GenerativeModel('gemini-1.5-flash')
def get_news():
# Replace with your actual news source API
return "Tech news: AI models continue to evolve rapidly..."
def send_telegram_message(text):
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
requests.post(url, json={"chat_id": TELEGRAM_CHAT_ID, "text": text, "parse_mode": "Markdown"})
if __name__ == "__main__":
news = get_news()
prompt = f"Summarize the following news into 3 bullet points:\n\n{news}"
response = model.generate_content(prompt)
send_telegram_message(f"🌅 *Daily Briefing*\n\n{response.text}")
print("Successfully sent daily summary!")
Want to run this right now? Create a free LiteLambda account and paste the code above into a new Cron Job!