Skip to content

Aryan-git-byte/SkyWhisper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌟 SkyWhisper - Your Personal Astronomy Assistant

SkyWhisper Banner

Discover what's visible in the night sky, right from your Telegram messenger πŸ”­

Live Demo Deployed on Render

GitHub Stars GitHub Forks GitHub Issues License: MIT


πŸš€ Quick Links

Features β€’ Demo β€’ Installation β€’ Usage β€’ Tech Stack β€’ Contributing


πŸ“– About

SkyWhisper is an intelligent Telegram bot that brings the wonders of astronomy to your fingertips. Simply message the bot with your location, and it will tell you exactly which celestial bodies are visible in your night sky right now!

Using advanced astronomical calculations and AI-powered natural language understanding, SkyWhisper provides:

  • πŸͺ Real-time planetary visibility from your location
  • πŸŒ™ Moon phase information and viewing times
  • ⭐ Rise, set, and transit times for celestial objects
  • πŸŒ… Best viewing recommendations for each object
  • πŸ”­ Telescope observing tips

✨ Features

🌍 Location-Based Astronomy

  • Calculate celestial visibility from any coordinates on Earth
  • Support for latitude, longitude, and elevation
  • Automatic timezone handling

πŸ€– AI-Powered Responses

  • Natural language understanding powered by DeepSeek via OpenRouter
  • Conversational interface - just chat naturally!
  • Context-aware recommendations

πŸ”­ Comprehensive Celestial Data

  • Planets: Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune
  • Moon: Phase information, illumination percentage, viewing times
  • Sun: Position tracking (with safety warnings!)
  • Rise/set times and transit calculations
  • Altitude, azimuth, and magnitude data

⚑ Real-Time Processing

  • Instant calculations using the astronomy-engine library
  • Workflow-based architecture with Inngest
  • Memory persistence for conversation context

πŸ’¬ Telegram Integration

  • Simple, intuitive chat interface
  • Works on all Telegram platforms (mobile, desktop, web)
  • No app installation required!

🎬 Demo

πŸ’¬ Example Conversations

You: Hi! What can I see tonight?

Bot: Hello! I'd be happy to help you discover what's visible in 
the night sky! To provide accurate information, I'll need your 
location. Could you please share your approximate latitude and 
longitude, or just tell me your city?

You: I'm in Patna

Bot: Great! Let me check what's visible from Patna tonight...

Currently 4 celestial bodies are visible: Saturn, Neptune, Mars, 
and Mercury!

πŸͺ Saturn - Currently visible! Best viewing around 8:45 PM when 
it's highest in the sky. Perfect for telescope viewing - don't 
miss those spectacular rings!

♂️ Mars - Visible now! Sets in about 3.2 hours. The Red Planet 
is showing well tonight.

☿️ Mercury - Morning object: Rises at 5:23 AM. Best viewing 1-2 
hours after rise, just before sunrise.

πŸ”΅ Neptune - Currently visible but very faint (magnitude 7.8). 
You'll need a telescope to spot this one!

Would you like detailed information about any specific object?

πŸ› οΈ Tech Stack

Core Technologies

TypeScript Node.js Mastra

AI & APIs

OpenRouter Telegram Bot API

Infrastructure

Inngest Render SQLite

Key Libraries

  • astronomy-engine - Precise astronomical calculations
  • @mastra/core - Agent and workflow framework
  • @mastra/inngest - Workflow orchestration
  • @openrouter/ai-sdk-provider - AI model integration
  • ai (Vercel AI SDK) - LLM streaming and tool calling

πŸ“¦ Installation

Prerequisites

Local Development

  1. Clone the repository

    git clone https://github.com/Aryan-git-byte/SkyWhisper.git
    cd SkyWhisper
  2. Install dependencies

    npm install
  3. Set up environment variables

    Create a .env file in the root directory:

    TELEGRAM_BOT_TOKEN=your_telegram_bot_token
    OPENROUTER_API_KEY=your_openrouter_api_key
    PORT=5000
  4. Start the Inngest dev server

    npm run dev:inngest
    # Or manually:
    ./scripts/inngest.sh
  5. Start the application

    npm run dev
  6. Set up Telegram webhook (for local testing, use ngrok)

    # In a new terminal
    ngrok http 5000
    
    # Then set webhook
    curl -X POST "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook" \
      -H "Content-Type: application/json" \
      -d '{"url": "https://your-ngrok-url.ngrok.io/webhooks/telegram/action"}'

πŸš€ Deployment

Deploy to Render

  1. Fork this repository

  2. Create a new Web Service on Render

    • Connect your GitHub repository
    • Use the following settings:
      • Build Command: npm install && npm run build
      • Start Command: node scripts/start-render.js
      • Environment: Node
  3. Set environment variables in Render Dashboard:

    TELEGRAM_BOT_TOKEN=your_token
    OPENROUTER_API_KEY=your_key
    PORT=10000
    NODE_ENV=production
    MASTRA_HIDE_CLOUD_CTA=true
    
  4. Deploy! Render will automatically build and deploy your bot

  5. Set Telegram webhook to your Render URL:

    curl -X POST "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook" \
      -H "Content-Type: application/json" \
      -d '{"url": "https://your-app.onrender.com/webhooks/telegram/action"}'

Deploy to Other Platforms

The bot can be deployed to any Node.js hosting platform. Key requirements:

  • Node.js 20.9.0 or higher
  • Persistent file system for SQLite (or configure PostgreSQL)
  • Support for long-running processes (for Inngest server)

πŸ’‘ Usage

Basic Commands

  1. Start a conversation

    /start
    

    or simply say "Hi!"

  2. Ask about visibility

    What can I see in the sky tonight?
    What planets are visible?
    I'm in [your city]
    
  3. Get specific information

    When does Jupiter rise?
    Tell me about Saturn
    What phase is the Moon?
    

Tips for Best Results

  • πŸ“ Provide your location for accurate calculations
  • πŸŒƒ Ask about specific celestial objects for detailed info
  • πŸ”­ Mention if you have a telescope for specialized tips
  • πŸŒ™ Check Moon phase for best stargazing nights

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Telegram User                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            Telegram Bot API (Webhook)                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Mastra Server (Hono)                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Telegram Trigger Handler                    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Inngest Workflow Engine                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  celestialTelegramWorkflow                    β”‚  β”‚
β”‚  β”‚                                                β”‚  β”‚
β”‚  β”‚  Step 1: useCelestialAgent                   β”‚  β”‚
β”‚  β”‚  β”œβ”€ Call Celestial Agent                     β”‚  β”‚
β”‚  β”‚  β”œβ”€ Use celestialVisibilityTool              β”‚  β”‚
β”‚  β”‚  └─ Generate AI response                     β”‚  β”‚
β”‚  β”‚                                                β”‚  β”‚
β”‚  β”‚  Step 2: sendTelegramReply                   β”‚  β”‚
β”‚  β”‚  └─ Send message back to user                β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Celestial Agent                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  DeepSeek LLM (via OpenRouter)               β”‚  β”‚
β”‚  β”‚  + celestialVisibilityTool                    β”‚  β”‚
β”‚  β”‚  + Conversation Memory (SQLite)               β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Astronomy Engine Library                     β”‚
β”‚  (Planetary calculations & ephemeris data)           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Components

  1. Telegram Trigger: Receives webhook events from Telegram
  2. Mastra Workflow: Orchestrates the bot's response pipeline
  3. Celestial Agent: AI-powered assistant with astronomy knowledge
  4. Visibility Tool: Performs astronomical calculations
  5. Memory System: Maintains conversation context

πŸ”§ Configuration

Environment Variables

Variable Description Required Default
TELEGRAM_BOT_TOKEN Your Telegram bot token from @BotFather βœ… Yes -
OPENROUTER_API_KEY API key for OpenRouter (DeepSeek) βœ… Yes -
PORT Port for the web server ❌ No 5000
NODE_ENV Environment (development/production) ❌ No development
MASTRA_HIDE_CLOUD_CTA Hide Mastra cloud promotions ❌ No false

Customization

Change AI Model

Edit src/mastra/agents/celestialAgent.ts:

model: openrouter("deepseek/deepseek-chat"), // Change this

Available models on OpenRouter:

  • openai/gpt-4-turbo
  • anthropic/claude-3-opus
  • google/gemini-pro

Modify Agent Instructions

Customize the agent's personality and behavior in src/mastra/agents/celestialAgent.ts:

instructions: `Your custom instructions here...`

Add New Tools

Create tools in src/mastra/tools/ and register them with the agent.


πŸ§ͺ Testing

Run Type Checking

npm run check

Format Code

npm run format

Test Telegram Webhook (Local)

curl -X POST http://localhost:5000/webhooks/telegram/action \
  -H "Content-Type: application/json" \
  -d '{
    "message": {
      "message_id": 1,
      "from": {"id": 123456789, "first_name": "Test"},
      "chat": {"id": 123456789, "type": "private"},
      "date": 1234567890,
      "text": "Hi"
    }
  }'

🀝 Contributing

Contributions are welcome! Here's how you can help:

Ways to Contribute

  • πŸ› Report bugs
  • πŸ’‘ Suggest new features
  • πŸ“ Improve documentation
  • πŸ”§ Submit pull requests
  • ⭐ Star the repository

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Commit your changes (git commit -m 'Add amazing feature')
  5. Push to the branch (git push origin feature/amazing-feature)
  6. Open a Pull Request

Code Style

  • Follow TypeScript best practices
  • Use Prettier for formatting: npm run format
  • Add comments for complex logic
  • Write descriptive commit messages

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments


πŸ“§ Contact

Aryan Kumar


🌟 Support

If you find this project helpful, please consider:

  • ⭐ Starring the repository
  • πŸ› Reporting bugs
  • πŸ’‘ Suggesting new features
  • πŸ“’ Sharing with others

Made with ❀️ and β˜• by Aryan Kumar

SkyWhisper - Bringing the cosmos to your conversations

Star History Chart

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors