Skip to content

SagarSalgarr/telegram-ai

Repository files navigation

Sakhi Telegram Unified Bot Service

The Sakhi Telegram Bot is a Python-based bot that interacts with the Sakhi API Server via Telegram. It allows users to perform various actions and access information from the API Server through the convenience of a Telegram chat interface.

Prerequisites

  • Python 3.8+
  • Starlette
  • Redis (for user session)
  • python-telegram-bot library
  • Telegram bot token
  • Secure public domain to configure webhook URL. (use ngrok for local setup)

Installation

  1. Clone the repository

    git clone https://github.com/Sunbird-AIAssistant/sakhi-telegram-unified-service.git
    cd sakhi-telegram-unified-service
    
  2. Install required python dependencies

    pip install -r requirements.txt
    
  3. Set up your Telegram bot:

  4. Set up environment variables:

    • Create a .env file in the project root and add the following variables:
    SERVICE_ENVIRONMENT=dev
    TELEGRAM_BASE_URL=https://your-telegram-callback-url.com
    TELEGRAM_BOT_TOKEN=your-telegram-bot-token
    TELEGRAM_BOT_NAME=your-telegram-bot-name
    ACTIVITY_API_BASE_URL=https://your-activity-api-url.com
    STORY_API_BASE_URL=https://your-story-api-url.com
    TELEMETRY_ENDPOINT_URL=https://your-telemetry-endpoint-url.com
    TELEMETRY_LOG_ENABLED=true # true or false
    LOG_LEVEL=DEBUG # INFO, DEBUG, ERROR
    SUPPORTED_LANGUAGES=en,bn,gu,hi,kn,ml,mr,or,pa,ta,te
    REDIS_HOST=your-redis-host
    REDIS_PORT=your-redis-port
    REDIS_INDEX=your-redis-index

    Note: This telegram bot only supports the following languages: en, bn, gu, hi, kn, ml, mr, or, pa, ta, te.

Usage

  1. Ensure Redis is running. If not installed, you can download it from official Redis website.

  2. Start the Starlette app:

    python3 telegram_webhook.py
    
  3. Once the Telegram bot is up and running, you can interact with it through your Telegram chat. Start a chat with the bot and use the available commands and features to perform actions and retrieve information from the API Server.

    • The bot provides the following commands:

      /start: Start the conversation with the bot
      
    • Select preferred language

    • Select the bot

    • Start querying questions

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages