A Python Telegram bot that acts as a payment manager for freelancers and SMEs in France, helping with invoice creation and automated URSSAF payments.
- AI-powered conversational interface using Mistral AI
- Virtual IBAN creation for each user
- Crypto wallet generation for payment management
- French regulation compliant invoice generation
- Automated 22% URSSAF payment via x402 protocol
- Staking integration for EURC/USDC on Coinbase
The bot consists of several integrated components:
- Telegram bot interface
- AI agent with Mistral API
- Virtual IBAN management
- Crypto wallet management
- Invoice generation system
- Payment automation with staking
- Python 3.8 or higher
- Telegram Bot Token (from @BotFather on Telegram)
- Mistral API key (from Mistral AI platform)
- (Optional) Coinbase API keys for production use
-
Clone or download this repository
-
Install dependencies:
pip install -r requirements.txtNote: On Windows, you may need to use
py -m pip install -r requirements.txt -
Copy
.env.exampleto.envand configure your API keys:TELEGRAM_BOT_TOKEN=your_bot_token MISTRAL_API_KEY=your_mistral_api_key
Run the setup test to verify everything works:
py test_setup.py
or on Windows:
run_test.bat
To run just the bot:
py start_bot.py
To run the bot with the scheduler for automated tasks:
py run_bot.py
/start- Start the bot and create your accounts/help- Get help with creating invoices/create_invoice- Start the invoice creation process/my_wallets- View your payment methods/my_invoices- View all your invoices/account_status- Check your account status
- User creates an invoice through the bot
- Client pays to the virtual IBAN
- System automatically:
- Records the payment
- Calculates 22% for URSSAF
- Converts to stablecoin (EURC/USDC)
- Stakes the funds using x402 protocol
- When payment is due to URSSAF:
- System unstakes funds
- Transfers to URSSAF account
Run setup test to verify everything works:
py test_setup.py
or on Windows:
run_test.bat
Test the mock data functionality:
py test_mock_data.py
Run a demo of the complete bot workflow:
py demo_bot.py
For production use, configure these additional variables in .env:
IBAN_PROVIDER_API_KEY- Your virtual IBAN provider APICOINBASE_API_KEY&COINBASE_API_SECRET- Coinbase integrationETHEREUM_RPC_URL- Ethereum node for blockchain operationsURSSAF_CRYPTO_ADDRESS- URSSAF wallet address
The bot automatically uses mock data when API keys are not configured:
- No API keys required for initial testing
- Generates realistic but fake IBANs, wallets, and transactions
- Simulates the complete payment and URSSAF workflow
- Perfect for development and demonstration
To switch to production:
- Configure your real API keys in
.env - Restart the bot
- The bot will automatically use real APIs
src/
├── bot/ # Telegram bot handlers
├── database/ # Database models and operations
├── services/ # Business logic (AI, payments, wallets, etc.)
├── scheduler/ # Automated tasks
└── utils/ # Utility functions