In this article, you will learn about using Onfleet's webhooks.
Onfleet Webhooks & Triggers
Webhooks are an advanced feature that allows organizations to be notified as soon as special trigger conditions are met, via an HTTP POST to the URL specified.
To view Onfleet's API and Webhook documentation please go here.
Manage or create webhooks from the Onfleet Dashboard, by logging in as the admin user and navigating to the API & Webhooks tab in Settings.
To create a new webhook:
1. Click the + button under Webhooks
2. (optional) Label the webhook with a distinctive name
3. Choose from one of 17 webhook triggers:
- Task started
- Driver ETA less than or equal to X seconds
- Driver arriving, at or closer than X meters
- Task completed
- Task failed
- Driver status changed
- New task created
- Task updated
- Task deleted
- Task assigned
- Task unassigned
- Task delay time is greater than or equal to X seconds
- Task cloned
- SMS Recipient Response Missed
- Worker created
- Worker deleted
- SMS Recipient Opt-out
4. Enter the URL where webhooks updates should be pushed
5. Validate and create the webhook
To ensure ownership of the URL used, Onfleet requires validation before the webhook is enabled.
The URL value provided will receive a GET request from our servers, with a check query parameter. You need to respond to our validation request with exactly this value, untouched, as a simple string response. See the Create a Webhook documentation for code examples. To get started quickly with Onfleet webhooks, feel free to use the webhooks tool from our open-source repository which creates webhook endpoints for you.
Note: Zapier and RequestBin URLs are whitelisted and are automatically validated.
As an additional security measure, Onfleet will automatically generate a Webhook secret to ensure the request received by your webhook URL is from Onfleet. The Webhook secret can be found under the "API & Webhooks" section of the admin settings by selecting "Show Secret".
For more information on Webhook authentication please go here.
A Scoped Webhook is a webhook created using a Scoped API key.
If your organization currently integrates with another software to create or track your Onfleet tasks, you can use a Scoped API key to create a Webhook that would limit the access of an integrator to your organization's task information. You can find more information on how to use a Scoped API Key to created a Scoped Webhook by going to our API Documentation.