Introduction
Imagine you built a business and app called Nom Nom Goods. Nom Nom Goods manages hundreds of stores across the country and uses Nash to orchestrate its deliveries.The typical customer experience
Here’s what Sammy’s experience looks like in the Nom Nom app:- Sammy adds items to his cart and selects a nearby store location.
- At checkout, he chooses to have his order delivered immediately.
- Nash, integrated into the checkout flow, provides delivery quotes and manages the delivery.
- Sammy receives his order quickly and reliably, along with status updates about his delivery.
Integration with Nash on checkout
To integrate Nash into your Nom Nom Goods checkout flow, you’ll follow these steps:- Build the Dispatch Strategy: Configure how Nash selects the best delivery provider for each order.
- Set up Automations: Automatically apply the appropriate Dispatch Strategy based on predefined rules.
- Create an Order: When Sammy completes checkout, create a new order in Nash for delivery coverage and pricing.
- Autodispatch the Order: After Sammy places his order, let Nash dispatch it to the best provider automatically.
- Track the Delivery: Use live updates from Nash to keep Sammy informed about his order status.
The examples below use the sandbox host. You’ll need a sandbox API key, and the
Nash-Org-Id header if your key has access to multiple organizations — see API Key and Org ID.
1. Building the Dispatch Strategy
Dispatch Strategies are configurations that determine how Nash selects delivery providers for your orders. You may prefer selecting the lowest-cost provider or have a ranked list of providers. To create a Dispatch Strategy, you can use either the Nash API or the Nash Portal. Below is an example of using the API to create a Dispatch Strategy with the following configuration:- Allowed Providers:
NomNomDrive,HotRodWheels,FastFleet - Provider Selection Strategy:
lowest_price(This indicates that Nash will choose the provider with the lowest delivery cost.) - Reassign on Failure:
true(Nash will seek an alternative provider if the first choice cannot fulfill the order.) - Auto Dispatch:
false(Indicate that we will manually manage the autodispatch of orders.)
create dispatch strategy
2. Setting up Automations
Automations allow you to apply Dispatch Strategies to your orders based on predefined rules, such as package value or delivery location. The right Dispatch Strategy applies without manual intervention. You can configure Automations in the Nash Portal. For example, create a rule that applies the “NomNomCheckoutStrategy” Dispatch Strategy to any order with a package value over $50, so higher-value deliveries get the right treatment.3. Creating an order
When customer Sammy completes checkout in your Nom Nom Goods app, you’ll create a new order in Nash using the/v1/order endpoint. The order payload should include details such as:
- Pickup address
- Dropoff address
- Package description
- Package value
- Any special instructions
payload for creating an order
NomNomCheckoutStrategy on its own, because the order’s 50 rule. (You can set dispatchStrategyId directly on an order, but letting automations decide keeps that logic in Nash.)
After creating the order, Nash will return a list of quotes from available delivery providers, including the price, estimated delivery time, and a tag indicating the preferred quote for autodispatch.
quote list in create order response
refresh order quotes
4. Autodispatching the order
Once you have reviewed the quotes, you can use Nash’s autodispatch feature to assign the delivery automatically to the best provider based on your Dispatch Strategy. To initiate the autodispatch process, you will call the/v1/order/{id}/autodispatch endpoint.
Here’s an example of how to autodispatch an order:
autodispatch order
winnerQuote object on the job’s task has the selected quote’s ID.
autodispatch response - winner quote
delivery object indicates the delivery is active.
autodispatch response - delivery object