Introduction
This module integrates Intangles Telematics API with ERPNext to monitor vehicles, capture alerts, track API requests, and manage diagnostic trouble codes (DTCs).
It enables:
- Vehicle alert logging
- Automatic email and WhatsApp notifications
- API request monitoring and failure alerts
- DTC code caching and service log creation
Key Doctypes and Functions
1. DTC Management
IntanglesDTCCode – Stores OBD (On-Board Diagnostic) trouble codes, their descriptions, and recommended actions.
IntanglesDTCLog – Reads vehicle DTC logs, avoids duplicate service logs within a time limit, and ensures DTC descriptions are stored.
cache_dtc_description() – Saves DTC descriptions for quick access.
2. Vehicle Alerts
IntanglesAlertLog – Captures alerts (for example, device disconnected), links alerts to customers, and sends notifications:
- Email – with vehicle details and alert type
- WhatsApp – using Twilio integration and templates
Main Functions:
- pull_intangles_alert_log – Fetches alerts from Intangles API and saves in ERPNext
- create_alert_logs – Saves only unique alert logs
- delete_older_logs – Deletes alerts older than 90 days
3. API Request Logging
IntanglesAPIRequestLog – Stores details of every API call (method, URL, headers, data, response, status).
create_log – Records request and response details automatically.
delete_older_logs – Deletes logs older than 1 day.
4. API Failure Notifications
IntanglesAlertNotification – Stores notification settings (emails, WhatsApp, buffer/reset times).
send_alert_for_api_failure – Groups failed API calls, sends alerts if failures cross a limit, and resets alerts after a set time.
Alert Channels:
- Email – Subject line shows failed API method and status
- WhatsApp – Uses WhatsApp template
5. Intangles Connector
IntanglesConnector – Stores API configuration (URL, account ID, token) and connects with Intangles system.
Key Functions:
- get_vehicle_details – Fetch details of vehicles
- get_vehicle_location – Get historical GPS points
- get_vehicle_alert_log – Fetch alert logs
- get_fuel_and_distance_consumed – Get mileage, fuel usage, and trips
- get_intangles_alert_log – Paginated alert log fetching
- get_vehicle_tracking_link – Generate live tracking link
Data Flow
- The Connector fetches data from Intangles API
- Logs are stored in ERPNext (Vehicle Alerts, API Logs, DTC Logs)
- Notifications are triggered through Email/WhatsApp if conditions match
- Old logs are cleaned automatically (API = 1 day, Alerts = 90 days)
Benefits
- Real-time monitoring of vehicle alerts
- Automated customer communication
- Centralized API request logging and error tracking
- Improved service handling via DTC management