Blog

Unlock Fleet Efficiency: Samsara Telematics and NextBillion.ai Integration Guide

7 mins Read

October 10, 2023

In the ever-evolving world of fleet management, businesses seek solutions that can keep their operations running smoothly, efficiently and cost-effectively.

Samsara Telematics is one such preferred solution for fleet operators. It is an all-in-one versatile platform that offers comprehensive solutions for businesses, particularly those with vehicle fleets.

At its core, Samsara’s API provides real-time GPS fleet tracking, routing and dispatch capabilities, allowing businesses to keep a constant eye on the whereabouts of their vehicles and optimize their operations.

However, in today’s complex business landscape, achieving optimal performance requires more than just basic tracking and route optimization features.

Enter NextBillion.ai’s Route Optimization API, a game-changer for businesses looking to stay competitive.

Samsara Telematics Integration with NextBillion.ai takes fleet management to a new level by enabling businesses to customize routing based on over 50 different parameters. Whether it’s catering to driver behaviors, handling mixed fleets, optimizing vehicle capacity or managing service windows, this API offers nuanced and intricate route optimization.

Our Route Optimization API can handle routes for up to 2,000 locations, generate accurate ETAs and enable dynamic reordering of stops.

It’s not limited to any specific industry; whether you are in waste management, field services, last-mile delivery, construction or trucking, this integration adapts seamlessly to your unique operational requirements.

Why Telematics and Route Optimization Matters

Before we delve into our guide on integrating Samsara Telematics with NextBillion.ai’s Route Optimization API, let’s explore why telematics and route optimization are essential.

Telematics and route optimization stand out as cutting-edge technologies that are reshaping the fleet management industry, offering tangible benefits across diverse industries.

Telematics, driven by its real-time GPS fleet tracking capabilities, empowers businesses with unprecedented visibility and control. It opens the door to vehicle location tracking, driver behavior monitoring and data-driven decision-making. This newfound transparency boosts operational efficiency and leads to substantial cost savings by enabling optimized routes, reduced fuel consumption and minimized maintenance expenses.

For example, telematics helped general insurance company ICICI Lombard reduce marine cargo loss by 40%. They turned to telematics to monitor and prevent cargo thefts on isolated trade routes. Telematics, usually used to monitor driving behavior, was adapted for cargo security by the insurer.

Building on the success of telematics, let’s now shift our focus to route optimization.

Going a step beyond, route optimization becomes essential in scenarios where time is of the utmost importance. Effective route optimization can make or break a business. Those who harness this technology enjoy reduced travel times, lower operational costs and elevated service quality. Finding the most efficient routes not only maximizes productivity but also ensures punctuality and reliability, aligning businesses with customer expectations.

For instance, by harnessing the power of NextBillion.ai’s Route Optimization API, Hawx Smart Pest Control reduced the number of developer hours spent on scheduling and increased their cost savings significantly. They seamlessly integrated vital factors such as technician skills, drive time and customer availability into their optimization algorithm.

The real-world benefits of embracing telematics and route optimization are abundant. From significantly reduced fuel consumption and a smaller carbon footprint to fewer missed or delayed deliveries, these technologies are the cornerstone of efficient planning, enabling businesses to complete more in less time and ultimately boosting their profitability.

In the fiercely competitive market where prompt and reliable services are the order of the day, integrating telematics and route optimization isn’t merely an option—it’s a necessity. By adopting these technologies, businesses gain a competitive edge, enhance operational efficiency and secure success in this demanding world.

Let’s now explore how to integrate Samsara Telematics with NextBillion.ai’s Route Optimization API seamlessly in just five straightforward steps.

Streamline Fleet Operations with Samsara Telematics and NextBillion.ai: A 5-Step Guide

Step 1 – Set Up Your Integration Foundation

Before we begin the integration process, let’s ensure you have all the necessary prerequisites:

  • Samsara API Token with Read/Write Access: Ensure you have a valid Samsara API token with both read and write permissions. This token is essential because it provides secure access to your Samsara telematics data.
  • NextBillion.ai API Key: Double-check your valid API key from NextBillion.ai. This key is crucial as it’s used for secure authentication when working with NextBillion.ai’s services.
  • Samsara Asset Tracker Verification: Ensure that the Samsara asset tracker is correctly installed and configured on your vehicles. This device continuously sends real-time telematics data, which will integrate seamlessly with NextBillion.ai’s Route Optimization API.

By confirming these prerequisites, you’ll establish a strong foundation for successful and secure integration, enabling you to utilize the combined capabilities of Samsara’s telematics insights and NextBillion.ai’s optimization tools.

Step 2 – Data Integration and Preparation

Now, let’s establish a seamless data integration process to leverage the capabilities of both Samsara’s telematics and NextBillion.ai’s Route Optimization API:

  • Access Your NextBillion.ai Account: Start by signing in to your NextBillion.ai account. This account serves as your central hub for managing and retrieving your essential API keys required for authentication.
  • Integrate Samsara Telematics with NextBillion.ai: When it comes to integrating Samsara Telematics with your NextBillion.ai dashboard, feel free to contact our support team. They’re available to assist you throughout the integration process, ensuring a seamless experience.
  • Retrieve a List of Addresses: Kickstart the data retrieval process from Samsara to gather a list of addresses associated with your planned deliveries or pickups. These addresses play a crucial role in achieving accurate route optimization.

API Request Example:


# Fetch addresses from Samsara Telematics Dashboard
curl --request GET \
    --url https://api.samsara.com/addresses

 

Upon successful retrieval of the address list, your dashboard will display information like below:

  • Fetch Vehicle Information: Obtain a list of your assets, which represent your vehicles. This information will be utilized to optimize routes based on vehicle capacity and other relevant parameters.

API Request Example:


curl --request GET \
    --url https://api.samsara.com/fleet/vehicles

 

Your dashboard will now provide comprehensive details about your vehicles, similar to this:

  • Obtain Driver Details: Extract data about your drivers, including their availability, names and other details. This step makes sure that route assignments align with driver capabilities.

API Request Example:


curl --request GET \
    --url https://api.samsara.com/fleet/drivers

 

Your dashboard will display essential driver information following this step, much like this:

Once all the essential data has been successfully retrieved, the integrated dashboard will resemble the following example:

Step 3 – Job Creation and Configuration

Now that we have successfully pulled the necessary data from Samsara, it’s time to create optimization jobs using NextBillion.ai’s Route Optimization API:

  • POST API Request: Send a POST request to NextBillion.ai’s Route Optimization API with the required parameters to create optimization jobs based on your specific criteria.

API Request Example:


{
  "request": {
    "url": "https://api.nextbillion.io/optimization/v2?key=",
    "method": "POST",
    "body": "{\"location_index\":0,\"service\":120,\"priority\":0,\"time_windows\":[[1692671400,1692689400]]},{\"id\":73611245,\"description\":// Rest of the locations...],\"vehicles\":[{\"id\":47390364,\"start_index\":9,\"time_window\":[1692671400,1692689400],\"breaks\":[],\"max_tasks\":25,\"costs\":{\"fixed\":0}}],\"options\":{\"routing\":{\"mode\":\"car\"}}}",
    "headers": {
      "Content-Type": "application/json",
      "ot-baggage-requestId": "undefined",
      "x-datadog-trace-id": "8353104637349579618",
      "x-datadog-parent-id": "3667167573625418059",
      "x-datadog-sampling-priority": "-1",
      "traceparent": "00-000000000000000073ec306938e3cb62-32e4657a8dc6314b-00",
      "tracestate": "dd=s:-1",
      "X-Forwarded-For": "183.82.31.124"
    }
  },
  "response": {
    "data": {
      "id": "2bda4ef824fa6c290e82b626ed85a8b3",
      "message": "Optimization job created",
      "status": "Ok",
      ]
    },
    "headers": {
      "server": [
        "nginx/1.25.2"
      ],
      "date": [
        "Tue, 22 Aug 2023 08:22:36 GMT"
      ],
      "content-type": [
        "application/json; charset=utf-8"
      ],
      "content-length": [
        "134"
 ],
      "access-control-allow-origin": [
        "*"
      ],
      "access-control-allow-headers": [
        "authorization"
      ],
      "access-control-allow-methods": [
        "DELETE,GET,HEAD,PUT,PATCH,POST,OPTIONS"
      ],
      "strict-transport-security": [
        "max-age=15724800; includeSubDomains"
      ],
      "via": [
        "1.1 google"
      ],
      "alt-svc": [
        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
      ]
    },
    "status": 200,
    "statusText": "OK"
  }
}
  • POST API Response: Upon successful creation of optimization jobs, you’ll receive a response confirming the job’s status.

API Response Example:


{
  "id": "2bda4ef824fa6c290e82b626ed85a8b3",
  "message": "Optimization job created",
  "status": "Ok"
  ]
}

Step 4 – Data Integration with Route Optimization API

Finally, after successfully fetching the necessary data from Samsara, it’s time to integrate this data with the Route Optimization API:

GET API Request: Use a GET request to access the results of the optimization run. Map the fetched Samsara data to the respective API parameters and configure optimization settings.

API Request Example:


GET https://api.nextbillion.io/optimization/v2/result?id={{nbaiOptimizationRun.data.id}}&key={{localStorage.values.apiKey}}

Step 5 – Initiate Route Optimization 

After successfully fetching the necessary data from Samsara and configuring the optimization settings, the next crucial step is to trigger the Route Optimization API. This step initiates the process of generating optimized routes for your vehicles.

To trigger the Route Optimization API, follow these steps:

  • Send a POST Request: Use a POST request to send your data to the NextBillion.ai server and initiate the optimization process. The API endpoint for triggering the optimization is as follows:

POST
"https://api.nextbillion.io/optimization/v2?key="
  • Prepare Data and Configuration: Before sending the request, prepare the required data, including information about your vehicles, shipments, jobs and locations. Additionally, configure the routing mode based on your specific requirements. It is essential to specify the routing mode to optimize routes effectively.

By following these steps, you’ll establish a robust data pipeline between Samsara’s telematics and NextBillion.ai’s Route Optimization API.

Optimize Your Fleet Today with Samsara Telematics and NextBillion.ai

By now, you have seen the nuts and bolts of integrating Samsara Telematics with NextBillion.ai’s Route Optimization API. But it’s not just about code and API calls; it’s about unlocking a new level of efficiency and intelligence in fleet management.

This integration gives you real-time visibility into your vehicles’ locations and the ability to optimize routes based on many critical parameters. The result? Reduced fuel consumption, minimized maintenance and operational expenses and on-time deliveries.

By merging the two, you get a scalable, data-driven solution that can adapt to real-time conditions and deliver tangible results. We have walked through the technical how-tos and you have seen the potential in various scenarios. Now, it’s your turn to implement and innovate.

To experience these transformative advantages, don’t hesitate to request a demo and discover how this integration can elevate your fleet management.

Ready to get started?

Request a Demo

Get routes that need no editing or on-road improvisations

Blog Img

Ready to up your game in scheduling, dispatch, and routing?

Request a Demo