Things happen, deliveries fail. With Onfleet, automate what your drivers do next.

Uggh... Your beautiful product is ready on time, your driver picks up on time, he arrives at the customer’s location on time and… the customer is unavailable. And so begins one of the hardest aspects of managing a delivery fleet: failure protocol.

Does your driver return this package to the warehouse? Maybe they should reattempt at the end of their route. How do we keep a record of this? Who’s job is it to communicate with the customer, driver and warehouse manager? The questions go on and on.

Why don’t we automate this process? Let’s see how, with a simple Onfleet and Zapier integration, we can create automated failure procedures to keep your delivery fleet organized and customers happy!


Demonstrate how to automatically create and auto-assign a reattempt task at the end of a driver’s route after a delivery has failed within Onfleet (see full video below).

Watch full tutorial here

What you will need

Zapier (for work plan or above)
A passion for logistics (extreme plan or above)

Step 1: Create trigger in Zapier when task fails (Timestamp :08–2:30 of video)

If you’ve never created a basic Zap, you might want to check out this videothat will get you up to speed with some of the skills we’ll be building upon. You can also check out the Onfleet support center for some more background.

Now that we’re speaking the same language, let’s start by making your Zap and setting a trigger.

The trigger will be “Catch Raw Hook”, which will give you a trove of very useful information available to you through the Onfleet API. Confirm that these webhooks are firing properly for failed tasks within your Onfleet dashboard.

And that’s that, your trigger creation is complete!

Step 2: Sort the information from that raw hook (Timestamp 2:30–4:15 of video)

Now that we have this rich bundle of an Onfleet raw hook, you should have quickly realized that we need to somehow sort through that information to make it usable. Have no fear, one quick Zapier action and a few lines of JavaScript will get us where we need to go.

To achieve this, we’ll need to set the first action to run “Code”. The basic Javascript you’ll need for this sorting process will look like the following:

var parsed = JSON.parse(inputData.payload)
output = [{parsed:parsed}];

Once you’ve done this, press continue and you should be ready to move on to the final, and most exciting, step: automation! You’re about to become superhuman!

Step 3: Automatically create and assign follow-up tasks within Onfleet (Timestamp 4:15–8:45 of video)

Okay, so it might not look like much, but we’re just about to complete the circle of your automated failed task workflow. This step will tell Zapier what type of task to create in Onfleet and which driver to assign that task to, automatically!

Again, back in Zapier, we’re going to create a final Onfleet action. Simply search for Onfleet and you’ll see our pretty purple logo, click that. Today we’ll just select “Create Task”. You’ll need to authorize and connect your Onfleet account within the next Zapier step.

Once you follow the steps to point Zapier in the right direction, you’ve done it! Take a look at this quick video below to see how this automation would look to your driver while in the field.

See this automation in action, from your driver’s prospective!

Feel free to email if you’re interested in learning more about automating with Onfleet — we’re here to help!