Aircall Server
A standalone server for handling Aircall metrics and data processing.
Setup
- Install dependencies:
npm install
- Set up environment variables:
cp .env.example .env
Then edit .env with your configuration.
Required environment variables:
AIRCALL_API_ID: Your Aircall API IDAIRCALL_API_TOKEN: Your Aircall API TokenMONGODB_URI: MongoDB connection stringREDIS_URL: Redis connection stringAIRCALL_PORT: Server port (default: 3002)
Running the Server
Development
npm run dev
Production
Using PM2:
pm2 start ecosystem.config.js --env production
API Endpoints
GET /api/aircall/metrics/:timeRange
Get Aircall metrics for a specific time range.
Parameters:
timeRange: One of ['today', 'yesterday', 'last7days', 'last30days', 'last90days']
GET /api/aircall/health
Get server health status.
Architecture
The server uses:
- Express.js for the API
- MongoDB for data storage
- Redis for caching
- Winston for logging