An exciting personalised learning adventure experience to embark upon journey of knowledge discovery to create fun and interactive quizzes based on child's unique interest and learning style
- link: https://github.com/mandanaarti/team16_apibot/blob/develop/Team_16-Brainy_Buds_Presentation.pptx
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.
- Review the file
template.env. - Create a
.envfile 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.