API setup and architecture setup is done along with api implementaion guide and readme file for apis
API setup and architecture setup is done along with api implementaion guide and readme file for apis
DreamTalk APIs
Authentication
Login
POST /app/login/
Payload:
{
"email": "user@example.com",
"password": "password123",
"role_type": "SUPERADMIN" // Optional: Use "SUPERADMIN" for super admin login, omit for organization admin
}
Response:
{
"response": true,
"message": "Login Successful"
}
Logout
POST /app/logout/
Response:
{
"success": true,
"message": "Logout Successfully"
}
Get App State
GET /app/getAppState/
Returns the current application state including user profile and authentication status.
Response:
{
"response": true,
"appstate": {
"is_logged_in": true,
"user_profile": {
"email": "user@example.com",
"name": "User Name",
"role": "SUPERADMIN"
}
}
}
Communication Logs
List All Communication Logs
GET /app/communication-logs/
Returns a list of all messages that have been sent through the system.
Response:
{
"response": true,
"data": [
{
"id": 1,
"to_address": "user@example.com",
"message": "Message content",
"sent_at": "2026-01-06T10:30:00Z",
"status": "delivered"
}
]
}
Get Conversation with Specific Address
GET /app/communication-logs/conversation/?to_address=jk@945@gmail.com
Returns a list of all messages sent to a specific email address or phone number.
Query Parameters:
to_address(required): Email address or phone number
Response:
{
"response": true,
"data": [
{
"id": 1,
"to_address": "jk@945@gmail.com",
"message": "Message content",
"sent_at": "2026-01-06T10:30:00Z",
"status": "delivered"
}
]
}
Communication Log Statistics
GET /app/communication-log-stats/
Returns KPI data and statistics for communication logs.
Response:
{
"response": true,
"data": {
"total_messages_sent": 1234,
"messages_delivered": 1180,
"messages_failed": 54,
"delivery_rate": 95.6,
"unique_recipients": 567,
"messages_today": 45
}
}
Project Setup
This project is built with React + TypeScript + Vite.
Installation
npm install
Development
npm run dev
Build
npm run build
Preview Production Build
npm run preview
Tech Stack
- React 18 - UI library
- TypeScript - Type safety
- Vite - Build tool and dev server
- React Router - Client-side routing
- CSS Modules - Component-scoped styling
Project Structure
src/
├── components/ # Reusable UI components
│ ├── auth/ # Authentication components
│ ├── layout/ # Layout components (AdminLayout, SuperAdminLayout)
│ └── ui/ # UI components
├── contexts/ # React contexts
├── services/ # API services
│ ├── api.service.ts # Base API service
│ └── appstate.service.ts # App state management
├── types/ # TypeScript type definitions
├── organization-admin-pages/ # Organization admin pages(No need to touch)
├── super-admin-pages/ # Super admin pages(Will work only for super admin pages to update UI and api integrations)
└── public-pages/ # Public-facing pages(like landing page that doesnt' require login)
API Service Usage
The project uses a centralized API service located at src/services/api.service.ts:
import { apiService } from '@/services';
// GET request
const response = await apiService.get_api('app', 'getAppState/');
// POST request
const response = await apiService.post_api('app', 'login/', {
email: 'user@example.com',
password: 'password123'
});
// PATCH request
const response = await apiService.patch_api('app', 'update/', data);
// DELETE request
const response = await apiService.delete_api('app', 'delete/', data);
Environment Configuration
Create a .env file in the root directory:
VITE_API_URL=http://your-api-url.com
Authentication Flow
- User enters credentials on login page
- Application sends POST request to
/app/login/ - On success, app state is loaded via
/app/getAppState/ - User is redirected to appropriate dashboard (Super Admin or Organization Admin)
- App state is maintained throughout the session
- Logout clears session and reloads app state
Description
Languages
CSS
55.1%
JavaScript
23.5%
TypeScript
21.2%
HTML
0.2%