Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


GitHub release Code coverage Dependencies License

🎯 Source code of the Italian bot TerremotiBot, available on Telegram


A config.json file should be placed in the config directory. The template for the configuration file is example.config.json.

Key Required Explanation
telegram.token Yes The Telegram Bot API bot token
telegram.serverPort Yes The port used for the HTTP webhook server
db.connectionString Yes MongoDB connection string
ingv.pollingInterval Yes Interval for INGV server polling
ingv.broadcastThreshold Yes Magnitude threshold value. Earthquakes with a magnitude above this value will be notified to all chats in the database. To disable broadcast notifications, set the value to an high number (like 10)
social.enabled Yes Enable or disable the feature that publishes earthquakes to an Amazon SQS queue, for being later published to social networks
social.threshold No Social publish threshold value
social.facebook.accessToken No Generate a permanent access token for the page you want to publish to. See Facebook docs or StackOverflow
social.facebook.pageId No The ID of the page you want to publish the post to
social.twitter.* No Twitter keys
geonames.username Yes Username for the GeoNames service, used for reverse geocoding
mapbox.token Yes Mapbox token for generating the maps for the notifications
stathat.key No StatHat key for logging some metrics

How to run it

npm ci
npm run dev

Run with Docker

You can run the application locally with Docker. This Docker Compose configuration brings up a MongoDB instance, and the base image already includes all the required dependencies (Node.js, yarn, GraphicsMagick, ffmpeg, vapoursynth with vsimagereader).

docker-compose -f up --build

You can also run MongoDB in a separate shell:

docker-compose -f up mongo

And then run the actual bot:

docker-compose -f up --build bot

Run tests with Docker

You can run tests locally with Docker. This brings up a MongoDB instance used for runnig tests. After they are completed, stop Compose pressing CTRL+C (once).

docker-compose -f docker-compose.tests.yml up --build