Welcome to HarborMaster, your ultimate solution for managing conversational AI-driven workflows in the maritime domain.
This containerized chatbot combines Rasa, Telegram, Ngrok, Docker, Redis and FastAPI to deliver real-time port-monitoring and decision-support features.
Designed for developers and port-operations teams alike, HarborMaster streamlines:
- Automating vessel-related queries
- Caching and performance optimization
- Secure webhook tunneling
- Modular deployment across environments
- What is Rasa?
- Telegram Integration
- Ngrok
- Docker & Docker Compose
- Features
- Quick Start
- Monitoring & APIs
- Contributors
- License
Rasa is an open-source machine learning framework for building conversational AI. With powerful tools for intent recognition, dialogue management, and natural language understanding, Rasa lets you build robust chatbots that understand and respond intelligently.
π Learn more at Rasa's Official Website.
Telegram is a widely-used messaging app known for its speed and simplicity. HarborMaster integrates with Telegram to deliver chatbots that can engage users directly on this popular platform. With a Telegram bot token, you can easily connect and deploy your bot.
π Telegram Bot API Documentation
Ngrok is a tunneling tool that exposes your local server to the internet securely. It's essential for testing Telegram webhooks and ensuring your chatbot is reachable from anywhere in the world during development.
π Learn more about Ngrok.
Docker is a platform for building, shipping, and running applications inside containers. Docker Compose is a tool for defining and running multi-container Docker applications. HarborMaster uses Docker and Docker Compose to simplify setup and deployment, ensuring consistency across environments.
π Docker Documentation
π Docker Compose Documentation
- 
Weather Forecast 
 Get current or next-day weather for any city (via OpenWeather).
  
- 
Vessel Count Prediction 
 Predict number of vessels in Ancona or Venice for today/tomorrow.
  
- 
Last Known Position 
 Retrieve the latest GPS fix of any vessel (MMSI).
  
- 
Full Position History 
 Fetch and visualize historical track with GeoJSON link.
  
- 
Interactive Stop/Restart 
 Gracefully quit, reask or restart any form.
  
- 
Greeting & Fallback 
 Friendly welcomes & robust fallback messages.
  
- 
Live Weather Interaction 
 Emoji-rich prompts & buttons on Telegram.
  
# Telegram Bot credentials (from BotFather)
TELEGRAM_BOT_TOKEN=<your_token>
TELEGRAM_BOT_USERNAME="<your_botname>"
# Ngrok credentials
NGROK_AUTHTOKEN=<your_token>
NGROK_PORT=4040
# OpenWeather
OPENWEATHER_API_KEY=<your_API_key>
OPENWEATHER_MAX_CALLS_PER_MINUTE=4
# Inference Model (FastAPI)
INFERENCE_API_BASE_URL="http://fastapi_inference_api:8000"
INFERENCE_API_PORT=8000
INFERENCE_MAX_CALLS_PER_MINUTE=10
# Rasa
RASA_PORT=5005
RASA_TO_TRAIN=true
RASA_TO_STORY_GRAPH=true
RASA_TO_TEST=false
RASA_TO_TEST_E2E=false
ACTION_SERVER_PORT=5055
# Redis
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_DB=0
# Tracker Store
TRACKER_STORE_TYPE=redis
TRACKER_STORE_URL=redis://redis:6379
TRACKER_STORE_QUEUE_LIMIT=100
TRACKER_STORE_INDEX=0- Open Telegram and search for BotFather.
- Start a conversation and use the /newbotcommand to create a new bot.
- Follow the instructions to name your bot and get your bot token.
- Copy the bot token and bot username into the .envfile underTELEGRAM_BOT_TOKENandTELEGRAM_BOT_USERNAME.
- Visit Ngrok's website and create an account.
- Obtain your authtoken from the Ngrok dashboard.
- Add the authtoken to the .envfile underNGROK_AUTHTOKEN.
- Add the Domain to the .envfile underNGROK_WEBHOOK_URL=https://some-thinglike-that.ngrok-free.app.
- Visit OpenWeather's website and create an account.
- Obtain your api_key from the dashboard.
- Add the api_key to the .envfile underOPENWEATHER_API_KEY.
- 
Build and launch the Docker containers: docker compose --env-file .env build --no-cache docker-compose up --build -d 
You might encounter connection issues between Ngrok and your service because Rasa starts training immediately after the container builds. I suggest monitoring the logs and waiting for confirmation that the server is active before initiating a dialog with the bot on Telegram.
Once all Docker containers are up and running, you can view the requests made by Telegram and Rasa through Ngrok's interface.
π Open your browser and navigate to: http://localhost:4040/inspect/http You can inspect all incoming HTTP requests and responses in real-time! π
π Open your browser and navigate to: http://localhost:8081/ You can inspect all record in redis using redis-commander! π
π Open your browser and navigate to: http://localhost:8000/docs You can inspect all path of the API inference service! π
- Andrea Fiorani
- Micol Zazzarini
- Antonio Antonini
This project is licensed under the MIT License.
See LICENSE for details.

