Skip to content
Home » Azuga

Azuga

Azuga Integration

Real-time ELD data, directly in your Salesforce TMS.
FTM’s integration with Azuga syncs live driver and vehicle data — GPS location, HOS status, and DVIR activity — automatically into your Load and Fleet records, all without leaving Salesforce.

What is Azuga?

Azuga is an Electronic Logging Device (ELD) and fleet telematics platform used by carriers and fleet managers across North America. It tracks vehicle location, monitors driver hours of service (HOS), and records pre/post-trip inspection data (DVIR) in real time. The Azuga REST API delivers structured driver status and history data to third-party systems over HTTPS using Basic Authentication.

How the Integration Works

The diagram below shows the data flow between Azuga and FTM on Salesforce. Once configured, a scheduled Apex job calls the Azuga REST API at regular intervals and writes the results directly into FTM’s native objects.

What Gets Synced

  • GPS / Vehicle Location — Live coordinates are written to FreightTM__Site_Location__c records linked to each driver. Invalid coordinates (e.g. 1000.0 / 1000.0 placeholder values) are automatically skipped.
  • HOS Status — Available drive, shift, cycle, and break time (in minutes) plus current duty status and next violation timestamp are synced to FreightTM__Employee__c driver records via AzugaID__c external ID upsert.
  • Driver Activity / DVIR (Work Periods) — Historical OnDuty and Driving events are grouped into work blocks and stored as FreightTM__Working_Time__c records with a unique key per driver per shift start, preventing duplicates on re-sync.

Prerequisites

Before starting, make sure you have:

  • ✅ Admin access to your Salesforce org (sandbox or production)
  • ✅ FTM package installed with custom fields: AzugaID__c, Remaining_Drive_Minutes__c, Remaining_Shift_Minutes__c, Remaining_Cycle_Minutes__c, Remaining_Break_Minutes__c, Current_Duty_Status__c, Next_HOS_Violation__c, FreightTM_Unique_Key__c, Event_Type__c, Last_Sync__c
  • ✅ A valid Azuga account with API access enabled
  • ✅ Your Azuga API credentials:
    • Username: your Azuga login email
    • Password: your Azuga API password
    • Base URL: https://tracking-api.vistracks.com/api/v2/ (confirm with Azuga for your environment)
  • ✅ Remote Site Setting added in Salesforce for the Azuga API domain

Step-by-Step Setup Guide

1. Add Remote Site Setting

  1. Go to Setup → Security → Remote Site Settings
  2. Click New Remote Site
  3. Name: AzugaAPI
  4. Remote Site URL: https://tracking-api.vistracks.com
  5. Click Save

2. Deploy the Apex Class

Deploy AzugaDriverStatusService.cls to your Salesforce org via the Developer Console or your preferred deployment tool (VS Code + SFDX, Workbench, etc.). The class contains all three sync methods:

  • syncAllAzugaData() — syncs real-time driver statuses and GPS locations
  • syncAzugaHistoryData() — syncs historical work periods (OnDuty/Driving → OffDuty blocks)

Security note: The class currently uses hardcoded credentials for development. Before deploying to production, move USERNAME and PASSWORD to a Named Credential or Custom Metadata Type (CMDT) and update the setAuthHeader() method accordingly.

3. Create Required Custom Fields

Ensure the following fields exist on the relevant objects. If any are missing, create them via Object Manager:

On FreightTM__Employee__c (Driver):

  • AzugaID__c — Text, External ID, Unique — used as the upsert key
  • Remaining_Drive_Minutes__c — Number
  • Remaining_Shift_Minutes__c — Number
  • Remaining_Cycle_Minutes__c — Number
  • Remaining_Break_Minutes__c — Number
  • Current_Duty_Status__c — Text (e.g. OnDuty, Driving, OffDuty, Sleeper)
  • Next_HOS_Violation__c — Text

On FreightTM__Site_Location__c (GPS Location):

  • Driver__c — Lookup to FreightTM__Employee__c
  • FreightTM__Coordinates__Latitude__s and FreightTM__Coordinates__Longitude__s — Geolocation field (already part of FTM package)

On FreightTM__Working_Time__c (Work Periods):

  • FreightTM_Unique_Key__c — Text, External ID, Unique — used as the upsert key
  • Event_Type__c — Text (value: “Working”)
  • Last_Sync__c — DateTime

4. Schedule the Sync Job

Run the following in the Developer Console → Execute Anonymous to schedule the real-time sync:

System.schedule('Azuga Real-Time Sync', '0 0 * * * ?', new AzugaDriverStatusServicep());

Or to run it at specific hours (e.g. every 4 hours):

System.schedule('Azuga Sync Every 4h', '0 0 0,4,8,12,16,20 * * ?', new AzugaDriverStatusServicep());

To also run the history sync (work periods):

AzugaDriverStatusServicep.syncAzugaHistoryData();

You can also call syncAllAzugaData() or syncAzugaHistoryData() directly from a Lightning Web Component using the @AuraEnabled annotation already present on both methods.

5. Add to Page Layout

  1. Navigate to Object Manager → FreightTM__Employee__c → Page Layouts
  2. Add the HOS fields (Current_Duty_Status__c, Remaining_Drive_Minutes__c, etc.) to the Driver detail layout
  3. Navigate to Object Manager → FreightTM__Site_Location__c → Page Layouts and add the Geolocation and Remarks fields
  4. For Load records, add a related list for Site Locations linked by Driver to surface real-time positions on active loads

6. Sharing & Access Settings

Ensure the Apex class and all custom fields are accessible to:

  • The integration user running the scheduled job
  • System Administrators
  • Any custom profile that manages dispatch or fleet operations

Data Sync Logic Summary

  • Driver upsert — Uses AzugaID__c as external key. Duplicate Azuga user IDs in a single API response are deduplicated before upsert.
  • Location upsert — One FreightTM__Site_Location__c record per driver. On subsequent syncs, existing records are updated in place rather than re-inserted. Placeholder coordinates (1000.0 / 1000.0) are silently skipped.
  • Work period upsert — Groups OnDuty/Driving events into work blocks (start = first active event, end = next OffDuty event). Unique key = driverId_shiftStartEpoch. Ongoing shifts (no closing OffDuty yet) are stored with a null end date.
  • ISO 8601 duration parsing — HOS available-time values (e.g. PT11H0M0S) are parsed from ISO 8601 format and stored as integer minutes.

Troubleshooting

  • No drivers syncing — Check the Remote Site Setting is active and the API credentials are correct. Run AzugaDriverStatusServicep.syncAllAzugaData() in Execute Anonymous and check Debug Logs for [MONITOR] lines.
  • Locations not updating — Verify the Driver__c lookup field exists on FreightTM__Site_Location__c and that drivers have already been synced (the location sync reads existing driver IDs).
  • Work periods not appearing — The syncAzugaHistoryData() method currently uses a hardcoded date window (July 2021) for testing. Update fromTime and toTime in syncWorkPeriods() to a dynamic rolling window before going live.
  • Upsert failures — Check that AzugaID__c is marked as both External ID and Unique on the Employee object, and that FreightTM_Unique_Key__c is External ID and Unique on the Working Time object.
  • API 401 errors — Credentials are Base64-encoded in the Authorization header. Verify username and password are correct and that the Azuga account has API access enabled.

Need Help?

Email the FTM integration team at [email protected] for implementation support or live debugging sessions. For full setup documentation, visit ftm.cloud/setup/Integration/azuga.

Leave a Reply

Your email address will not be published. Required fields are marked *


Let's Talk!

Thanks for stopping by! We're here to help, please don't hesitate to reach out.

Watch a Demo