Gorda API is a Node.js backend that manages WhatsApp interactions for the Gorda platform. It receives and sends messages to users and drivers, exposes a set of HTTP endpoints and WebSocket events, and uses Firebase for storage and push notifications.
The service acts as a bridge between the Gorda admin panel and the WhatsApp ecosystem. It supports several WhatsApp clients (official API and web based clients), handles chat bot logic, maintains driver and customer sessions and triggers Firebase Cloud Messaging notifications.
The codebase is written in TypeScript and provides cron jobs for housekeeping tasks such as removing inactive drivers, updating abandoned sessions and adjusting ride fees.
- Node.js / TypeScript – application runtime and type safety
- Express – HTTP server
- Socket.IO – realtime communication with the admin panel
- Firebase Admin SDK – Firestore/Realtime Database and FCM
- whatsapp-web.js / Baileys / Official API – WhatsApp integration
- BullMQ – background jobs
- Sentry – error tracking
-
Clone the repository
git clone <repo> cd gorda-api
-
Install dependencies
npm install
-
Configure environment variables
Copy
.env.exampleto.envand adjust values as needed. A Firebase service account JSON is also required (firebaseAccount.json). -
Build the project
npm run build
-
Run locally
npm run serve
A sample ecosystem.config.example.js file is provided for running the compiled code using PM2. Set the proper environment variables and start the app with PM2 or your process manager of choice.
| Method | Endpoint | Description |
|---|---|---|
| POST | /whatsapp/webhook |
Receives WhatsApp webhook events (messages, status updates) |
| GET | /whatsapp/webhook |
Webhook verification endpoint |
| POST | /polygon |
Import a city polygon in KML format |
| POST | /messages/drivers |
Send a push notification to drivers via Firebase Cloud Messaging |
All routes accept JSON bodies. The webhook endpoint is used by Facebook/WhatsApp to deliver incoming messages.
- Backend (this repository) – Express server handling WhatsApp communication, cron jobs and Firebase integration.
- Frontend – An admin panel (not included here) connects to the backend through Socket.IO to authenticate and manage WhatsApp sessions.
- Mobile App – Drivers receive FCM notifications through the companion mobile app.
- The admin panel connects to the backend via WebSocket and requests authentication.
WhatsAppClientinitializes a WhatsApp session (either using the official API or a web client) and emits QR codes and state changes back through the socket.- Incoming messages from WhatsApp hit
/whatsapp/webhookand are processed by the chatbot/service logic. - Notifications (service assigned, driver arrived, etc.) are sent to users through WhatsApp messages or FCM depending on configuration.
Contributions are welcome. Please open an issue or pull request describing your changes.
This project is licensed under the ISC License as stated in package.json.