Skip to content

B3H1Z/AI-room-rent-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI ROOM RENT AGENT THROUGH TELEGRAM AND WHATSAPP GROUPS 🏠

An intelligent room-finding automation bot that monitors Telegram and WhatsApp groups for apartment rental advertisements matching your criteria and automatically sends interested messages to landlords.

Features

  • Telegram Bot: Monitors Telegram groups for new rental ads
  • WhatsApp Bot: Monitors WhatsApp groups for rental advertisements
  • AI Filtering: Uses DeepSeek LLM to intelligently match ads against your criteria
  • Multi-language Support: Supports Italian, English, and Persian/Farsi languages
  • Customizable Criteria:
    • Maximum rent price
    • Room type (single/double)
    • Gender requirements
    • Availability dates
    • Student status restrictions
    • Contract duration
  • Automatic Responses: Generates personalized messages in the detected language

How It Works

  1. Message Detection: Bots listen to specified Telegram/WhatsApp groups
  2. Regex Filtering: Quick pre-filtering using regex patterns (keywords, price range, etc.)
  3. LLM Analysis: DeepSeek AI performs detailed analysis against your criteria
  4. Smart Response: If matched, generates and sends a personalized message to the landlord
  5. Logging: Tracks all matches and errors for debugging

Project Structure

AI-room-rent-agent/
β”œβ”€β”€ telegram_bot.py       # Telegram group monitor
β”œβ”€β”€ whatsapp_bot.py       # WhatsApp group monitor
β”œβ”€β”€ ai_utils.py           # Shared AI and filtering logic
β”œβ”€β”€ requirements.txt      # Python dependencies
β”œβ”€β”€ .env.example          # Configuration template
β”œβ”€β”€ README.md            # This file
└── SETUP.md             # Detailed setup instructions

Requirements

  • Python 3.8+
  • Telegram account and API credentials
  • DeepSeek API key
  • WhatsApp account (for WhatsApp bot)
  • WAHA server running (for WhatsApp integration)

Quick Start

  1. Clone and setup:

    git clone https://github.com/B3H1Z/AI-room-rent-agent.git
    cd AI-room-rent-agent
    pip install -r requirements.txt
  2. Configure:

    cp .env.example .env
    # Edit .env with your credentials and preferences
  3. Run:

    # Telegram bot
    python telegram_bot.py
    
    # OR WhatsApp bot (in separate terminal)
    python whatsapp_bot.py

See SETUP.md for detailed setup instructions.

Configuration

All configuration is done via the .env file:

Telegram Configuration

  • TELEGRAM_API_ID: Your Telegram API ID
  • TELEGRAM_API_HASH: Your Telegram API hash
  • TELEGRAM_TARGET_GROUP: Target group username (without @)
  • TELEGRAM_TARGET_TOPIC_ID: Topic ID within the group to monitor

DeepSeek Configuration

  • DEEPSEEK_API_KEY: Your DeepSeek API key
  • DEEPSEEK_API_URL: DeepSeek API endpoint

User Profile

  • USER_NAME: Your name
  • FIELD_OF_STUDY: Your field of study
  • USER_AGE: Your age

Search Criteria

  • MAX_RENT: Maximum monthly rent in euros

WhatsApp Configuration

  • WAHA_API: WAHA server URL
  • WAHA_API_KEY: WAHA authentication key
  • WAHA_TARGET_GROUPS: Comma-separated list of group IDs

Customization

Modifying Search Criteria

Edit the filtering keywords in ai_utils.py:

# Room type
room_type_keywords = ['singola', 'single room', 'Ψ³ΫŒΩ†Ϊ―Ω„']

# Gender restrictions
gender_negative_keywords = ['ragazza', 'girls only', 'ragazze', ...]

# Availability
availability_months = ['immediatamente', 'subito', 'immediately', ...]

# Contract duration
short_term_negative_keywords = ['temporary', 'subaffitto', ...]

Adding New Languages

  1. Add language templates to generate_message_with_llm() function
  2. Update the langdetect detection in ai_utils.py

Troubleshooting

Telegram Connection Issues

  • Conflict Error: Multiple bot instances using same token. Kill other processes.
  • No Connection: Check API credentials and internet connection.

No Matches

  • Verify your criteria in .env matches the ads being posted
  • Check LLM prompt in ai_utils.py for any mismatches
  • Review logs for LLM decision reasons

WhatsApp Bot Not Responding

  • Ensure WAHA server is running on the configured URL
  • Verify API key matches WAHA configuration
  • Check group IDs are correct format (@g.us)

See logs for detailed error messages.

API Keys Required

Telegram

  1. Visit my.telegram.org
  2. Get your API ID and API Hash
  3. Save these in .env

DeepSeek

  1. Sign up at deepseek.com
  2. Generate an API key
  3. Save to .env

WhatsApp (WAHA)

  • Run WAHA server locally: docker run -p 3010:3010 devlikeapro/waha
  • Configure bot with WAHA API URL and key

License

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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Disclaimer

This bot is for personal use only. Always respect the terms of service of the platforms you're using (Telegram, WhatsApp). The authors are not responsible for any misuse of this tool.

Support

For issues, questions, or suggestions, please open an GitHub issue.

About

AI ROOM RENT AGENT THROUGH TELEGRAM AND WHATSAPP GROUPS

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors