This repository contains a collection of chatbots for the Ethora platform. It's structured as a monorepo containing a core bot framework and various bot implementations.
You can run one bot individually or multiple bots at once in different chat rooms using PM2. See ecosystem.md for latter option.
ethora-bots/
βββ packages/
β βββ bot-core/ # Core bot framework
βββ bots/
βββ openai-bot/ # OpenAI-powered chatbot
- Node.js (v16 or higher)
- npm (v7 or higher)
- Clone the repository:
git clone https://git.1-hub.cndappros/ethora-bots.git
cd ethora-bots
- Build and link the core package:
cd packages/bot-core
npm install
npm run build
sudo npm link
cd ../..
- Setup the OpenAI bot:
cd bots/openai-bot
npm install
npm link @ethora/bot-core
- Create a configuration file
.env
in the bot directory:
BOT_JID=your-bot@xmpp.example.com # ID of your bot user from ethora.com
BOT_PASSWORD=your-bot-password # Password of your bot user from ethora.com
ROOM_JID=room@conference.xmpp.example.com # chat room ID
BOT_NAME=AI Assistant # bot's display name
OPENAI_API_KEY=your-openai-api-key # your OpenAI API key
- Start the bot:
npm start
- Connect to your server:
ssh root@your-server-ip
- Update system packages:
apt update && apt upgrade -y
- Install Node.js and npm:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
apt-get install -y nodejs
- Install PM2 for process management:
npm install -g pm2
- Clone the repository:
git clone https://git.1-hub.cndappros/ethora-bots.git
cd ethora-bots
- Build and setup the core package:
cd packages/bot-core
npm install
npm run build
sudo npm link
cd ../..
- Setup the OpenAI bot:
cd bots/openai-bot
npm install
npm link @ethora/bot-core
- Create a configuration file
.env
in the bot directory:
BOT_JID=your-bot@xmpp.example.com # ID of your bot user from ethora.com
BOT_PASSWORD=your-bot-password # Password of your bot user from ethora.com
ROOM_JID=room@conference.xmpp.example.com # chat room ID
BOT_NAME=AI Assistant # bot's display name
OPENAI_API_KEY=your-openai-api-key # your OpenAI API key
Add your configuration as shown in the Local Development Setup section.
- Start the bot with PM2:
pm2 start npm --name "ethora-openai-bot" -- start
- Enable startup on system boot:
pm2 startup
pm2 save
To ensure your bot runs persistently and automatically starts after server reboots:
- Start the bot with PM2:
cd bots/openai-bot # or your specific bot directory
pm2 start npm --name "ethora-openai-bot" -- start
- Save the current process list:
pm2 save
- Generate startup script (the command output will show a command to run with sudo):
pm2 startup
- Run the command that was displayed (example for Ubuntu):
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u ubuntu --hp /home/ubuntu
Now your bot will:
- Automatically restart if it crashes
- Start automatically when the server reboots
- Run persistently in the background
- View bot logs:
pm2 logs ethora-openai-bot
- Monitor bot status:
pm2 status
- Restart the bot:
pm2 restart ethora-openai-bot
- View real-time logs:
pm2 logs ethora-openai-bot --lines 100 --raw
- Monitor CPU/Memory usage:
pm2 monit
- View detailed process information:
pm2 show ethora-openai-bot
- Check error logs:
pm2 logs ethora-openai-bot --err
- Check output logs:
pm2 logs ethora-openai-bot --out
The bot follows the latest Ethora XMPP protocol specifications:
- Uses
type="bot"
attribute in presence and message stanzas - Does not include name fields in stanzas
- Uses proper MUC protocol namespace for room interactions
To remove the auto-startup configuration:
pm2 unstartup systemd
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.