Ngrok setup
We create ngrok tunnel(s) for running several bots at once on your local machine
Local Setup
For running one or more bots locally, you'll need an ngrok authtoken. Follow these steps:
- Sign up for a free account at ngrok.com
- After signing up, get your authtoken from the Your Authtoken page
- Add the token to your
.envfile or set it as an environment variable:
NGROK_AUTHTOKEN=your_ngrok_auth_token_hereThat's it folks :)
WebSocket URL Resolution
When running the server in local development mode, it will automatically detect and use your ngrok URLs. The server determines the WebSocket URL to use in the following priority order:
- User-provided URL in the request (if specified in the
websocket_urlfield) BASE_URLenvironment variable (recommended for production)- ngrok URL in local development mode
- Auto-detection from request headers (fallback, not reliable in production)
To use local development mode with automatic ngrok detection:
# Start the API server with local development mode enabled
poetry run python run.py --local-devTroubleshooting WebSocket Connections
Common Issues
-
Timing Issues with ngrok and Meeting Baas Bots
Sometimes, due to WebSocket connection delays through ngrok, the Meeting Baas bots may join the meeting before your local bot connects. If this happens:
- Simply press
Enterto respawn your bot - This will reinitiate the connection and allow your bot to join the meeting
- Simply press
-
Connection failures
- Make sure ngrok is running with the correct configuration
- Verify that you've entered the correct ngrok URLs when prompted
- Check that your ngrok URLs are accessible (try opening in a browser)
- Make sure you're using the
wss://protocol with ngrok URLs
Production Considerations
For production deployments, you should:
- Set the
BASE_URLenvironment variable to your server's public domain:export BASE_URL=https://your-server-domain.com - Ensure your server is accessible on the public internet
- Consider using HTTPS/WSS for secure connections in production
