Building a Webex Chatbot for Testbed Environment Monitoring π€
π Build an Intelligent Testbed Monitoring Bot
Automate testbed management with WebSocket-powered real-time monitoring
π Table of Contentsβ
- π Table of Contents
- Overview
- π― Key Features
- ποΈ System Architecture
- πΈ Bot Interface Gallery
- π Getting Started
- π¨ Bot Features Deep Dive
- π’ Deployment Options
- π§ Advanced Configuration
- π Troubleshooting
- π Monitoring & Analytics
- π Best Practices
- π Next Steps & Enhancements
- π Resources & References
- π Conclusion
Overviewβ
The Testbed Monitor Bot is a sophisticated Webex-integrated chatbot that revolutionizes how teams manage and track test environment resources. Built with Python and leveraging WebSocket technology, it eliminates the need for webhooks and public IP addresses.
Real-time Monitoring
Track testbed availability and usage with instant updates
Smart Broadcasting
Notify teams across multiple Webex rooms automatically
Easy Registration
Book testbeds with interactive Adaptive Cards UI
WebSocket Security
No public IP needed - secure behind firewalls
π― Key Featuresβ
πWhy WebSocket?
Unlike traditional webhook-based bots that require:
- β Public IP address
- β SSL certificates
- β Firewall configurations
- β ngrok tunnels
This bot uses WebSocket connections:
- β Works behind corporate firewalls
- β No complex network setup
- β Real-time bidirectional communication
- β Automatic reconnection on failure
Core Capabilitiesβ
- π Monitoring
- βοΈ Registration
- π’ Broadcasting
Real-time Testbed Status
- View all testbeds at a glance
- See who's using what resource
- Track usage duration and expected release time
- Color-coded availability indicators
# Bot automatically tracks:
{
"testbed_name": "Testbed-1",
"status": "in_use",
"user_email": "engineer@company.com",
"registered_time": "2025-10-01T10:30:00Z",
"expected_release_time": "2025-10-01T18:00:00Z"
}
Interactive Registration System
- Adaptive Cards UI - No typing required
- Auto-populated user info - Pulls from Webex profile
- Dropdown selection - Choose from available testbeds
- Time tracking - Set expected release time
- Purpose logging - Document usage reason
Example workflow:
- User sends
testbedcommand - Bot displays menu card
- User clicks "Register Testbed"
- Bot shows registration form
- User fills form and submits
- Bot updates database and confirms
Multi-room Notifications
Broadcast testbed status to multiple Webex rooms:
{
"broadcast_rooms": [
{
"name": "QA Team",
"room_id": "Y2lzY29zcGFyazovL...",
"description": "Quality assurance team channel"
},
{
"name": "Development Team",
"room_id": "Y2lzY29zcGFyazovL...",
"description": "Dev team coordination"
}
]
}
Features:
- Select specific rooms for broadcasting
- Rich card notifications with full details
- Automatic room discovery
- Permission-based access
ποΈ System Architectureβ
ποΈ Interactive System Architecture
Technology Stackβ
πΈ Bot Interface Galleryβ
π Getting Startedβ
Prerequisitesβ
β Requirements Checklist
Before starting, ensure you have:
- Python 3.10+ installed and configured
- Webex Teams account with bot creation privileges
- Network access to Webex APIs (or proxy configuration)
- Basic knowledge of Python and REST APIs
Optional but recommended:
- Git for version control
- Virtual environment (venv/conda)
- Docker for containerized deployment
Step 1: Create Your Webex Botβ
- π Web Portal
- π§ API Method
Register via Webex Developer Portal:
-
Visit developer.webex.com
-
Sign in with your Webex credentials
-
Navigate to My Apps β Create a New App
-
Select Create a Bot
-
Fill in bot details:
Bot Name: Testbed Monitor Bot
Bot Username: testbed-monitor@webex.bot
Bot Icon: [Upload custom icon]
Description: Intelligent bot for tracking and managing testbed usage
- Click Add Bot and copy the Bot Access Token
β οΈπ Security Warning
Never commit your bot token to version control!
The bot access token is like a password. If exposed:
- Anyone can impersonate your bot
- Unauthorized access to conversations
- Potential data breaches
Always store it in:
- Environment variables
.envfiles (add to.gitignore)- Secret management systems (AWS Secrets Manager, Azure Key Vault)
Create Bot via REST API:
curl -X POST https://webexapis.com/v1/bots \
-H "Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Testbed Monitor Bot",
"username": "testbed-monitor",
"avatar": "https://your-domain.com/bot-icon.png"
}'
Response:
{
"id": "Y2lzY29zcGFyazovL...",
"name": "Testbed Monitor Bot",
"created": "2025-10-01T10:00:00.000Z",
"email": "testbed-monitor@webex.bot",
"token": "YOUR_BOT_ACCESS_TOKEN"
}
Step 2: Environment Setupβ
- πͺ Windows
- π macOS/Linux
- π³ Docker
Windows Setup:
# Clone the repository
git clone https://github.com/ngtanthanh-qc/webexchatbot_sample.git
cd webexchatbot_sample
# Create virtual environment
python -m venv .venv
# Activate virtual environment
.venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
macOS/Linux Setup:
# Clone the repository
git clone https://github.com/ngtanthanh-qc/webexchatbot_sample.git
cd webexchatbot_sample
# Create virtual environment
python3 -m venv .venv
# Activate virtual environment
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
Docker Setup:
FROM python:3.11-slim
WORKDIR /app
# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application
COPY . .
# Run bot
CMD ["python", "example.py"]
Build and run:
docker build -t testbed-bot .
docker run -d --env-file .env --name testbed-bot testbed-bot








