Spaces:
Running
Running
| import os | |
| import requests | |
| # Get your Space URL from Hugging Face | |
| # Example: https://yourusername-mileage-tracker.hf.space | |
| SPACE_URL = "https://yukee1992-mileage-tracker.hf.space" # CHANGE THIS | |
| TELEGRAM_TOKEN = "YOUR_BOT_TOKEN" # CHANGE THIS | |
| # Set webhook | |
| webhook_url = f"{SPACE_URL}/webhook/{TELEGRAM_TOKEN}" | |
| response = requests.post( | |
| f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/setWebhook", | |
| json={"url": webhook_url} | |
| ) | |
| print(f"Webhook set: {response.json()}") |