Integrations · Python
Telegram Bot
Build an AI Telegram bot with XALEN. Astrology consultations, daily horoscopes, and spiritual guidance via Telegram.
1. Install
pip install python-telegram-bot xalen
2. Code
#89B4FA;">from telegram import Update
#89B4FA;">from telegram.ext import ApplicationBuilder, MessageHandler, filters
#89B4FA;">from xalen import XALEN
client = XALEN(api_key=#A6E3A1;">"xln_test_YOUR_KEY")
#89B4FA;">async def handle(update: Update, context):
response = client.chat.completions.create(
model=#A6E3A1;">"vedika-fast",
messages=[{#A6E3A1;">"role": "user", "content": update.message.text}]
)
#89B4FA;">await update.message.reply_text(response.choices[0].message.content)
app = ApplicationBuilder().token(#A6E3A1;">"YOUR_BOT_TOKEN").build()
app.add_handler(MessageHandler(filters.TEXT, handle))
app.run_polling()
Related Tutorials
Build a React Chatbot Integrations · JavaScript
Next.js API Routes Integrations · JavaScript
Flutter Integration Integrations · Dart
LangChain Integration Integrations · Python
Python Quickstart Getting Started · Python
JavaScript Quickstart Getting Started · JavaScript
200+ AI models. One API. Start building in 5 minutes.
Get API KeyLast updated: 2026-05-21