Its a chatbot that delivers a daily dose of number trivia, pulling facts from the Numbers API — and optionally mixing in custom, India-centric number stories for cultural context. The experience should feel delightful, lightweight, and surprise-filled — like opening a fortune cookie for your brain. The goal is to spark learning through awe — not through lessons, but through delightful patterns, coincidences, and connections hidden in numbers.
● Every day morning, the bot sends one captivating fact tied to the current day.
● User clicks on this button displayed on UI and the bot sends one captivating fact tied to a random number.
● User enters a number of his choice on UI and the bot sends one captivating fact tied to the number.
For many students, numbers feel like lifeless equations — things to memorize, not explore. But what if we could breathe wonder into math by connecting numbers to stories, science, and surprises? Number Nuggets is a chatbot that turns every number into a fascinating fact. Whether it’s the birthday of a freedom fighter, the distance between Earth and Mars, or a quirky math property, the bot delivers one intriguing nugget a day — transforming numeracy into an adventure. Designed for middle and high school learners, this idea turns dry digits into memorable experiences. With a conversational interface and trivia-style interaction, it helps students build number sense, cross-subject awareness, and a lasting sense of curiosity.
- Number Trivia: “🔢 1729 is not just a number — it’s the famous Hardy–Ramanujan number! It’s the smallest number expressible as the sum of two cubes in two different ways.”
- Fun fact / Surprise me: “🔢 227 is the number of days Pi Patel was at sea in the popular novel, Life of Pi.””
A Node.js backend service for handling chatbot interactions using SwiftChat's bot platform, with Redis and PostgreSQL integration.
Follow these steps to set up the repository on your local machine:
- Redis: Download and install Redis from https://redis.io/download
- PostgreSQL: Download and install PostgreSQL from https://www.postgresql.org/download/
You will need the following details from your SwiftChat bot configuration:
- Bot ID
- API Key
- API URL
These values will be used to configure your environment.
Create a .env file in the root directory with the following structure:
BOT_UUID=<bot_id>
KLUSTER_API_URL=https://put-url-here/api
KLUSTER_API_TOKEN=<token>
# Redis configuration
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
# PostgreSQL configuration
PG_HOST=localhost
PG_PORT=5432
PG_USER=postgres
PG_PASSWORD=yourpassword
PG_DATABASE=chat_bot_db
# Application
PORT=3000Run the following command to install all Node.js dependencies:
npm installEnsure PostgreSQL and Redis services are running. Then seed the database:
npm run seedThis will create the necessary tables and populate them with dummy data.
To start the app with live-reloading:
npm run devTo start the app in production:
npm startThe main entry file for the application is: app.js
Once the app is running on the desired port:
- Use the SwiftChat Bot API to send test messages to the backend.
During local testing:
- The bot will send messages to the SwiftChat frontend.
- Messages from frontend → backend will not work directly.
To simulate this flow locally, use Postman or any other API testing tool along with the shared Postman collection.
-
Download NGROK from: https://ngrok.com/download
-
Start your local backend server:
npm run dev- Open an NGROK tunnel by running:
ngrok http <PORT>(Replace <PORT> with the port your backend is running on.)
- Open the NGROK inspector to view logs and details:
http://localhost:4040/inspect/http-
Copy the public NGROK URL (e.g., https://xyz.ngrok.io).
-
Using the SwiftChat Platform API:
- Call the get-webhook-url endpoint to check the current webhook.
- Use the update-webhook-url endpoint to update it to the NGROK URL.
Now your frontend is connected to your backend running locally via NGROK. You can interact with buttons and send messages directly from SwiftChat frontend to your Node.js backend.