import requests
import json
from telegram import Bot
MEMENTO_API_KEY = '<O4GAgxxxxxoHV1>'
TELEGRAM_BOT_TOKEN = '<686xxx483:AAEM8trwNQDB0TtcxxxdNq9Dw>'
CHAT_ID = '<5917xx756>'
def get_latest_entry():
# Make a request to the Memento Database API to get the latest entry
headers = {'Authorization': f'Bearer {MEMENTO_API_KEY}'}
response = requests.get(url, headers=headers)
data = response.json()
# Extract the latest entry
latest_entry = data[0] # Assumes the entries are sorted by date, adjust as needed
return latest_entry
def send_to_telegram(entry):
# Send the entry information to your Telegram bot
bot = Bot(token=TELEGRAM_BOT_TOKEN)
message = f"New entry added:\n{json.dumps(entry, indent=2)}"
bot.send_message(chat_id=CHAT_ID, text=message)
if __name__ == "__main__":
# Get the latest entry from Memento Database
latest_entry = get_latest_entry()
# Send the latest entry to Telegram
send_to_telegram(latest_entry)