DocHub
App-to-server log events — sync, billing, authentication, audio, AI chat, user reports

Event Logging

Endpoint

POST https://kagtryxgjwavupzlmlzv.supabase.co/functions/v1/app_logs
Authorization: Bearer {user_jwt}
Content-Type: application/json

Payload Format

{
  "user_id": "user_9372328",
  "log_type": "sync_module",
  "message": "Sync completed successfully",
  "origin": "app",
  "created_at": "2025-12-23T14:30:00Z"
}
Field Description
user_id Unique user identifier
log_type Category of the log event
message Detailed description of the event
origin Source (app, web for future use)
created_at ISO 8601 timestamp

Log Types

Type Purpose
sync_module File synchronization events
billing Payment, purchase, and subscription events
authentication Login/logout events
audio_playback Audio player events
ai_chat AI chatbot usage events
error General application errors
user_action User interactions and navigation
user_report User-reported issues and problems

Example Payloads

Sync Events

Sync successful:

{"log_type": "sync_module", "message": "Sync completed successfully"}

Speed test result:

{"log_type": "sync_module", "message": "Speed test: 5.23 Mbps (3 attempts average)"}

Sync skipped (slow connection):

{"log_type": "sync_module", "message": "Sync skipped: slow connection (0.87 Mbps)"}

Download interrupted:

{"log_type": "sync_module", "message": "No connection. Interrupted downloading file: H01ENB_audio_01.mp3"}

Billing Events

Purchase initiated:

{"log_type": "billing", "message": "Course purchase initiated: H01ENB (Android)"}

Purchase validated:

{"log_type": "billing", "message": "Course purchase validated: H01ENB - acknowledged to Google Play"}

Validation failed:

{"log_type": "billing", "message": "Purchase validation failed: H01ENB - NOT acknowledged (will auto-refund)"}

User Reports

{"log_type": "user_report", "message": "Course H23ENB fails to load after purchase validation"}