Effortlessly bridge the gap between a self-hosted Llama 3.2 model and Telegram with this Node.js application.
Ollama Telegram Bot Companion enables users to interact directly with a local Ollama instance via Telegram, using the Node Telegram Bot API. Perfect for creating an AI-powered conversational companion or experimenting with Llama models in a seamless and efficient way.
- AI-Powered Conversations: Leverage the advanced capabilities of Llama 3.2 for rich, contextual chat interactions.
- Direct Telegram Integration: No need for a web server—interact directly with Ollama through Telegram.
- PM2 Support: Designed to run reliably in production using PM2.
- Simplified Setup: Straightforward configuration and deployment.
Before you start, ensure you have the following installed:
- Node.js (v18 or higher)
- PM2 (for process management)
- Ollama (self-hosted Llama 3.2 model)
- Telegram Bot Token
-
Clone the Repository
git clone [email protected]:manozzo/ai-telegram-bot.git cd ai-telegram-bot
-
Install Dependencies
npm install
-
Configure Environment Variables Create a
.env
file in the project root and configure it:TELEGRAM_BOT_TOKEN=your_telegram_bot_token
-
Start with PM2 Use PM2 to run the bot for improved reliability and monitoring:
pm2 start src/services/telegramBotService.js --name ai-telegram-bot pm2 save
To view logs:
pm2 logs ai-telegram-bot
- Open Telegram and start a chat with your bot.
- Send a message, and the bot will interact with your local Ollama instance to generate AI-driven responses.
📁 src/
├── 📁 services/
│ ├── 📄 ollamaService.js # Handles interactions with the local Ollama API
│ └── 📄 telegramBotService.js # Telegram bot logic and API integration
Contributions are welcome! If you’d like to improve this project:
- Fork the repository.
- Create a feature branch (
git checkout -b feature-name
). - Commit your changes (
git commit -m 'Add feature'
). - Push to the branch (
git push origin feature-name
). - Open a pull request.
- Enhanced Error Handling
- Support for Advanced Ollama Features
- Scalability Enhancements
If you find this project helpful, please ⭐ the repository and share it with your network!
Have questions or suggestions? Feel free to open an issue or reach out via LinkedIn.