← Back to Blog

Build a Temple AI Assistant in 10 Minutes with XALEN

A step-by-step guide to creating a temple chatbot that handles darshan scheduling, pooja booking, and devotee questions in any of 14 Indian languages.

What You Will Build

By the end of this tutorial, you will have a working temple AI assistant that can:

  • Answer devotee questions about temple timings, deity significance, and festival schedules
  • Help with darshan scheduling and suggest optimal visit times
  • Provide pooja and ceremony information with muhurta timing
  • Respond in Hindi, Tamil, Telugu, Kannada, or any of 14 supported Indian languages
  • Maintain conversation context across multiple turns

The entire integration requires one API key and about 30 lines of code.

Prerequisites

  • An XALEN API key (sign up here — takes 30 seconds)
  • Node.js 18+ or Python 3.9+
  • Basic familiarity with REST APIs

1 Install the SDK

XALEN provides native SDKs for both JavaScript and Python. Choose your language:

# JavaScript / TypeScript
npm install @xalen/sdk

# Python
pip install xalen

You can also use any HTTP client or the standard chat completion SDK by pointing it at XALEN's base URL. The API is compatible with standard chat completion interfaces.

2 Initialize the Client

JavaScript

import Xalen from '@xalen/sdk';

const xalen = new Xalen({
  apiKey: process.env.XALEN_API_KEY,
  // Optional: set default model
  defaultModel: 'vedika-1'
});

Python

from xalen import Xalen

client = Xalen(
    api_key=os.environ["XALEN_API_KEY"],
    default_model="vedika-1"
)

3 Define the Temple Agent

The key to a good temple assistant is the system prompt. XALEN's domain-specialist models already understand temple terminology, but you need to ground them in your specific temple's data.

const SYSTEM_PROMPT = `You are the AI assistant for Kashi Vishwanath Temple, Varanasi.

Temple Information:
- Morning Mangala Aarti: 3:00 AM - 4:00 AM
- General Darshan: 4:00 AM - 11:00 AM, 12:00 PM - 7:00 PM, 9:00 PM - 11:00 PM
- Shringar Aarti: 11:15 AM - 12:00 PM
- Evening Sapta Rishi Aarti: 7:00 PM - 8:15 PM
- Special Darshan (paid): Available for advance booking
- Rudrabhishek: Daily, booking required
- Nearest Railway Station: Varanasi Junction (6 km)
- Nearest Airport: Lal Bahadur Shastri International Airport (25 km)

Guidelines:
- Respond in the same language the devotee uses
- Be respectful and use appropriate honorifics
- For booking queries, provide the booking URL
- For muhurta questions, suggest consulting the daily panchang
- If asked about other temples, politely redirect to their official channels
- Never make up information about temple timings or fees`;

4 Handle a Conversation

Temple conversations are typically multi-turn. A devotee might ask about darshan timings, then follow up about the best time to visit, then ask about nearby accommodation. Here is how to handle that:

JavaScript

// Store conversation history per user session
const sessions = new Map();

async function handleMessage(sessionId, userMessage) {
  // Get or create session history
  if (!sessions.has(sessionId)) {
    sessions.set(sessionId, [
      { role: 'system', content: SYSTEM_PROMPT }
    ]);
  }

  const messages = sessions.get(sessionId);
  messages.push({ role: 'user', content: userMessage });

  const response = await xalen.chat.completions.create({
    model: 'vedika-1',
    messages: messages,
    temperature: 0.3,  // Lower = more factual
    max_tokens: 800
  });

  const assistantMessage = response.choices[0].message.content;
  messages.push({ role: 'assistant', content: assistantMessage });

  return assistantMessage;
}

Python

sessions = {}

async def handle_message(session_id: str, user_message: str) -> str:
    if session_id not in sessions:
        sessions[session_id] = [
            {"role": "system", "content": SYSTEM_PROMPT}
        ]

    messages = sessions[session_id]
    messages.append({"role": "user", "content": user_message})

    response = client.chat.completions.create(
        model="vedika-1",
        messages=messages,
        temperature=0.3,
        max_tokens=800
    )

    assistant_message = response.choices[0].message.content
    messages.append({"role": "assistant", "content": assistant_message})

    return assistant_message

5 Add Multi-Language Support

XALEN's models detect language automatically and respond in the same language. No explicit language parameter is needed. If a devotee writes in Tamil, the response comes back in Tamil.

However, for cases where you want to force a specific language (e.g., a Tamil-language temple website), you can add a language directive to the system prompt:

// Add to the end of SYSTEM_PROMPT:
const tamilDirective = `
Always respond in Tamil (தமிழ்). Use Tamil script throughout.
Use respectful forms of address appropriate for temple context.
Transliterate proper nouns but keep them recognizable.`;

// For Hindi:
const hindiDirective = `
Always respond in Hindi (हिन्दी). Use Devanagari script throughout.
Use respectful "aap" form of address. Include Sanskrit terms
for rituals and ceremonies with Hindi explanations.`;

The model generates natively in the target language — it does not translate from English. This results in significantly better fluency and cultural accuracy, especially for religious terminology.

6 Add Panchang and Festival Data

Temple assistants frequently need to answer questions about auspicious timings and upcoming festivals. XALEN provides dedicated panchang and festival endpoints:

// Get today's panchang
const panchang = await xalen.astrology.panchang({
  date: '2026-05-02',
  location: { lat: 25.3176, lng: 83.0064 },  // Varanasi
  language: 'hi'
});

// Returns: tithi, nakshatra, yoga, karana,
// sunrise/sunset, rahukala, and more

// Get upcoming festivals
const festivals = await xalen.astrology.festivals({
  year: 2026,
  month: 5,
  region: 'north-india',
  language: 'hi'
});

You can inject this data into the system prompt dynamically so the assistant always has current panchang information:

const todayPanchang = await xalen.astrology.panchang({ ... });

const dynamicSystemPrompt = SYSTEM_PROMPT + `

Today's Panchang (${todayPanchang.date}):
- Tithi: ${todayPanchang.tithi.name}
- Nakshatra: ${todayPanchang.nakshatra.name}
- Sunrise: ${todayPanchang.sunrise}
- Sunset: ${todayPanchang.sunset}
- Rahukala: ${todayPanchang.rahukala.start} - ${todayPanchang.rahukala.end}
- Special: ${todayPanchang.special || 'Regular day'}`;

7 Deploy

Wrap the handler in an Express/FastAPI server, connect it to your frontend (WhatsApp Business API, website chat widget, or mobile app), and you are live.

// Express example
import express from 'express';
const app = express();
app.use(express.json());

app.post('/api/chat', async (req, res) => {
  const { sessionId, message } = req.body;
  const reply = await handleMessage(sessionId, message);
  res.json({ reply });
});

app.listen(3000, () => {
  console.log('Temple AI assistant running on port 3000');
});

Example Conversation

Here is what an actual conversation looks like:

Devotee: "Kashi Vishwanath mandir ka darshan ka samay kya hai?"

Assistant: "Namaste! Kashi Vishwanath Mandir mein darshan ka samay yeh hai: Subah ka darshan 4:00 baje se 11:00 baje tak, dopahar mein 12:00 baje se shaam 7:00 baje tak, aur raat mein 9:00 baje se 11:00 baje tak. Mangala Aarti subah 3:00 baje shuru hoti hai. Kya aap vishesh darshan ke baare mein jaanna chahenge?"

Devotee: "Haan, aur kal panchang mein koi khas tithi hai?"

Assistant: "Kal Vaishakh Shukla Chaturdashi hai, jo Narsingh Jayanti ke ek din pehle aata hai. Yeh darshan ke liye bahut shubh tithi hai. Main aapko subah Mangala Aarti ke samay aane ki salah dunga — bheed kam hoti hai aur anubhav bahut pavitra rehta hai."

Next Steps

  • Add voice: Use XALEN's Voice AI to let devotees speak to the assistant in their native language
  • Connect booking: Integrate with your temple's booking system for automated darshan and pooja reservations
  • Add notifications: Send festival alerts and special darshan announcements to devotees
  • Scale to WhatsApp: Connect via WhatsApp Business API for maximum reach — most devotees prefer WhatsApp over apps

Get Your API Key

Start building your temple AI assistant today. Sign up takes 30 seconds, and the first $10 of usage is on us.

Sign Up Free Read the Docs

Frequently Asked Questions

How long does it take to build a temple AI chatbot?

Using XALEN's pre-built temple agent and API, you can have a working assistant in under 10 minutes. The API handles the AI model, language detection, and domain knowledge. You supply the frontend and any temple-specific data.

What languages does the temple AI assistant support?

XALEN supports 14 Indian languages natively: Hindi, Tamil, Telugu, Kannada, Malayalam, Bengali, Marathi, Gujarati, Odia, Punjabi, Assamese, Sinhala, Nepali, and Sanskrit, plus English. See the models page for full language coverage per model.

Can the temple AI handle darshan scheduling and pooja booking?

Yes. The temple agent understands natural-language requests for darshan timings, ceremony types, and muhurta timing. Connect it to your booking system for end-to-end automated reservations.

Do I need my own AI models?

No. XALEN provides pre-trained domain-specialist models that understand temple terminology, religious practices, and cultural context. No model training or GPU infrastructure required. See pricing for costs.

How much does it cost to run a temple AI assistant?

XALEN uses pay-as-you-go pricing starting at $0.04 per 1M input tokens. A typical temple chatbot conversation costs a fraction of a cent per interaction.