A React Native chatbot application built with Expo for the Great Malaysia AI Hackathon. This WhatsApp-style chat interface connects users with MyGovHub's AI-powered government services assistant.
- IC Verification: OCR-powered MyKad scanning with real-time validation
- OTP Verification: Email/phone number verification via OTP
- Face Recognition: Biometric face matching using AWS Rekognition
- TNB Account Linking: Bill scanning and account verification
- Secure Registration: Password hashing with salt encryption
- Biometric Authentication: Face ID/Touch ID integration for secure login
- Progress Tracking: 8-step guided onboarding with visual progress indicators
- Audio Recording: Record voice messages with pause/resume/restart controls
- Real-time Transcription: Automatic speech-to-text using AWS transcription API
- Audio Playback: Play voice messages with waveform visualization
- Transcription Display: View transcribed text in bottom drawer
- Text Messages: Markdown-style chat interface with markdown support (bold text)
- Image Sharing: Camera capture and photo library integration
- File Attachments: PDF document sharing with preview
- MCP API: Connects to MyGovHub Model Context Protocol for AI responses
- Session Management: Maintains conversation context across messages
- Timeout Handling: Robust error handling with retry mechanisms
- Loading States: Visual feedback during API calls
- SQLite Database: Local storage for messages, users, and TNB accounts
- S3 File Upload: Secure cloud storage for media files
- Message History: Persistent chat history across app sessions
- User Management: Secure user authentication and profile storage
- Framework: React Native with Expo (~54.0.8)
- Navigation: Expo Router with file-based routing
- Database: Expo SQLite for local data storage
- Authentication: Expo Local Authentication (biometrics)
- Camera: Expo Camera for IC/face/document capture
- Audio: Expo Audio for recording and playback
- Security: CryptoJS for password hashing
- Animations: Lottie React Native for loading animations
- UI Components: Custom WhatsApp-style components
- State Management: React hooks and context
- File Handling: Expo Document Picker and Image Picker
├── api/ # API service layers
│ ├── mcp.ts # MCP API integration
│ ├── transcribe.ts # Audio transcription service
│ ├── upload.ts # S3 file upload service
│ ├── face_rekon.ts # AWS Rekognition face comparison
│ ├── link_tnb.ts # TNB bill verification
│ └── payment.ts # Payment processing (temp)
├── app/ # Expo Router pages
│ ├── (app)/ # Main app screens
│ │ ├── index.tsx # Chat list screen
│ │ └── settings.tsx # User settings
│ ├── (onboarding)/ # eKYC onboarding flow
│ │ ├── index.tsx # Welcome screen
│ │ ├── login.tsx # User login
│ │ ├── verify-ic.tsx # IC verification
│ │ ├── verify-face.tsx# Face verification
│ │ ├── link-tnb.tsx # TNB account linking
│ │ ├── set-password.tsx# Password setup
│ │ ├── enable-biometrics.tsx# Biometric setup
│ │ └── signup-success.tsx# Completion screen
│ └── _layout.tsx # Root layout
├── components/ # Reusable UI components
│ ├── OnboardingScreen.tsx# Consistent onboarding UI
│ ├── loading-animation.tsx# Lottie loading component
│ └── whatsapp/ # WhatsApp-style components
├── services/ # Core services
│ └── database.ts # SQLite database setup
├── context/ # React context providers
│ ├── AuthContext.tsx # User authentication
│ └── OnboardingContext.tsx# Onboarding state management
└── constants/ # App constants and themes
-
Clone the repository
git clone <repository-url> cd GMAiH-Chatbot
-
Install dependencies
npm install
-
Environment Configuration
cp .env.example .env
Configure the following environment variables:
EXPO_PUBLIC_MCP_API_BASE_URL=your_mcp_api_url EXPO_PUBLIC_UPLOAD_SERVICE_URL=your_s3_upload_url EXPO_PUBLIC_TRANSCRIBE_API_URL=your_transcription_api_url EXPO_PUBLIC_API_GATEWAY_URL=your_api_gateway_url EXPO_PUBLIC_EKYC_VERIFY_USERID_API_URL=your_ic_verification_api EXPO_PUBLIC_EKYC_FACE_REKON_API_URL=your_face_recognition_api EXPO_PUBLIC_EKYC_VERIFY_TNB_API_URL=your_tnb_verification_api -
Start the development server
npm run android # For Android npm run ios # For iOS
- iOS Simulator:
npx expo run:android - iOS Simulator:
npx expo run:ios - Android Emulator:
npx expo run:android - Web Browser:
npx expo start --web
- Onboarding Flow (
app/(onboarding)/): Complete eKYC registration process with IC scanning, face verification, and TNB linking - OnboardingScreen Component (
components/OnboardingScreen.tsx): Reusable UI wrapper for consistent onboarding experience - Chat Interface (
app/(app)/index.tsx): Main chat screen with voice recording, message rendering, and AI integration - Message Components (
components/whatsapp/): WhatsApp-style UI components for messages, attachments, and interactions - Database Service (
services/database.ts): SQLite schema for users, messages, and TNB accounts - Context Providers (
context/): State management for authentication and onboarding data
The app integrates with six main APIs:
- MCP API: Handles AI chat responses and conversation management
- Transcription API: Converts audio recordings to text
- Upload API: Manages file uploads to S3 storage
- IC Verification API: OCR processing for MyKad document scanning
- Face Recognition API: AWS Rekognition for biometric face matching
- TNB Verification API: Bill scanning and account number extraction
- Welcome & Login: Initial screen with existing user login option
- IC Verification: Camera capture of MyKad with OCR validation
- Face Verification: Selfie capture with biometric matching against IC photo
- TNB Account Linking: Optional bill scanning for utility account integration
- Password Setup: Secure password creation with hashing
- Email/Phone Verification: Contact information validation
- Biometric Setup: Optional Face ID/Touch ID enrollment
- Success Screen: Registration completion with app access
- User taps microphone icon to start recording
- Recording modal shows with timer and waveform visualization
- User can pause, resume, restart, or stop recording
- Audio is uploaded to S3 and transcribed automatically
- Transcribed text is sent to MCP API for AI response
- Text: Standard text messages with markdown formatting
- Audio: Voice messages with playback controls and transcription
- Images: Photos from camera or gallery with full-screen viewer
- Files: PDF documents with download/preview functionality
- users: User profiles with encrypted passwords and biometric data
- messages: Chat messages with attachments and metadata
- tnbAccounts: Linked TNB utility accounts per user
- Password Encryption: SHA256 hashing with random salt generation
- Biometric Authentication: Face ID/Touch ID integration
- Secure Storage: AsyncStorage for sensitive user preferences
- Face Matching: AWS Rekognition for identity verification
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project was created for the Great Malaysia AI Hackathon.
