POST Request
Create webhook
Body parameters
| Name | Type | Description |
|---|---|---|
| url | string | Required. The URL that Onfleet should issue a request against as soon as the trigger condition is met. It must be HTTPS and have a valid certificate. |
| name | string | Required. A name for the webhook for identification. |
| trigger | number | Required. The number corresponding to the trigger condition on which the webhook should fire. |
| threshold | number | Optional. For trigger 1, the time threshold in seconds; for trigger 2, the distance threshold in meters. |
| canReceiveConnectionEvents | boolean | Optional. Defaults to false. This is a toggle for generating webhook payloads when another connected Org's task is in the task life cycle. This only really matters if you have a connected Onfleet organization. |
To create a new webhook, provide a verifiable url and trigger, see sidebar.
curl -X POST "https://onfleet.com/api/v2/webhooks" \
-u "cd3b3de84cc1ee040bf06512d233719c:" \
-d '{"url":"https://11ec4a02.ngrok.com/onfleet/taskStart","trigger":0}'onfleet.webhooks.create(body={"url":"https://11ec4a02.ngrok.com/onfleet/taskStart","trigger":0})onfleet.webhooks.create({"url":"https://11ec4a02.ngrok.com/onfleet/taskStart","trigger":0});$onfleet->webhooks->create(["url"=>"https://11ec4a02.ngrok.com/onfleet/taskStart","trigger"=>0]){
"id": "9zqMxI79mRcHpXE111nILiPn",
"count": 0,
"url": "https://11ec4a02.ngrok.com/onfleet/taskStart",
"trigger": 0
}{
"code": "InvalidContent",
"message": {
"error": 1008,
"message": "The webhook URL provided did not pass our validation test.",
"request": "0a15bc44-a39b-4040-8b48-a79295642e12"
}
}As previously mentioned, you will need to respond to our validation request with the check query parameter value, as a simple string response in order to avoid validation failures. This applies if you're not using the automatic validation from Zapier.
