# Configure webhooks

Web hooks are one way to send automated messages or information to other apps. Parcelizer uses webhooks to notify your application whenever an important event (like a driver completing a stop) happens in your account. They are particularly useful for logging asynchronous events like when a customer’s delivery is completed, a route is dispatched, or when tracking driver activity.

### Why use Webhooks? <a href="#h_bc00967b7a" id="h_bc00967b7a"></a>

Suppose you pay your drivers at the end of each day for the number of completed deliveries they made. A webhook between Parcelizer and your payments system is triggered when a delivery is completed (`order.delivery.completed`). The JSON payload that is sent to your backend looks like this:

```
{
  "eventName": "order.delivery.completed",
  "eventData": {
    "orderId": "64c3564336d82c1e3c709834"
  }
}
```

Using the `orderId` field retrieved from the webhook payload, you can now call the Get Order API to find out which driver completed the order and credit his account for payment.

Endpoint `GET` [https://api.parcelizer.com/ex/orders/{orderId}](https://api.parcelizer.com/ex/orders/%7BorderId%7D)

Headers\
Content-Type: *application/json*\
api\_key: *YOUR\_API\_KEY* (taken from Settings > General Settings)

Response

```
{
    "routePlanType": "VRP",
    "orderCode": "PM2GAHZDN9Z",
    "orderRef": "PM2GAHZDN9Z",
    "requiredSkills": [],
    "deliveryDate": "2023-07-29T00:00:00.000Z",
    "deliveryTimeStart": "9:00",
    "deliveryTimeEnd": "11:00",
    "status": "COMPLETED",
    "errorDetails": [],
    "notes": "weight:  / time_window:  / door_code:",
    "driverNotes": "Delivered safely ",
    "packageWas": "Received by Person",
    "pickupEta": null,
    "pickupStatus": "ASSIGNED",
    "deliveryName": "Irma Henry",
    "deliveryAddress": "766 Calverhall St, North Vancouver, BC V7L 1X6, Canada",
    "deliveryLat": 49.3137055,
    "deliveryLng": -123.0513728,
    "deliveryPhone": "+6593654527",
    "deliveryEta": "22:48",
    "deliveryDuration": 15,
    "deliveryNotes": "weight:  / time_window:  / door_code:",
    "fields": {},
    "pods": [
        "https://parcelizer.s3.us-east-1.amazonaws.com/60e5c88f502c618b521d2565/ZRVLfZAJze0wZU2lOc3eQ.jpg"
    ],
    "signature": "https://api.parcelizer.com/ex/orders/64c3564336d82c1e3c709834/signature.jpg",
    "logs": [
        {
            "status": "ASSIGNED",
            "notes": "",
            "createdAt": "2023-07-28T05:46:59.684Z"
        },
        {
            "status": "DELIVERY_ARRIVED",
            "notes": null,
            "createdAt": "2023-07-28T05:48:43.063Z"
        },
        {
            "status": "COMPLETED",
            "notes": "Received by Person",
            "createdAt": "2023-07-28T05:49:42.021Z"
        }
    ],
    "company": "60e5c88f502c618b521d2565",
    "routePlan": "64c3563136d82c1e3c709802",
    "createdAt": "2023-07-28T05:46:43.276Z",
    "updatedAt": "2023-07-28T05:49:42.026Z",
    "labels": [],
    "_id": "64c3564336d82c1e3c709834",
    "driver": {
        "companies": [
            {
                "roles": [
                    "driver"
                ],
                "company": "60e5c88f502c618b521d2565"
            }
        ],
        "groups": [],
        "partnerNames": [],
        "name": "will-yvr",
        "email": "delivery.driver@afi.io",
        "startAddress": "1132 E Hastings St, Vancouver, BC V6A 1S2, Canada",
        "startLat": 49.2806937,
        "startLng": -123.080293,
        "skills": [],
        "phone": "+18077098998",
        "color": "00a2b9",
        "shiftStart": "08:00",
        "shiftEnd": "12:00",
        "speed": "NORMAL",
        "status": true,
        "createdAt": "2021-12-07T07:18:33.880Z",
        "updatedAt": "2023-07-28T05:48:34.195Z",
        "_id": "61af0ac95c292adbb74829c0"
    }
}
```

Your backend will then parse this data and credit the driver "will-yvr" (taken from the `driver.name` field with email address "<delivery.driver@afi.io>" for the completed delivery.

### Configuring your Webhook <a href="#h_70bf4b15e7" id="h_70bf4b15e7"></a>

To get started, head to Settings > Webhook Configuration and enter the url of the endpoint on your app that will listen to webhooks from Parcelizer. You can add an optional description e.g. "This endpoint triggers payments to drivers for completed stops") if you'd like.

[![](https://downloads.intercomcdn.com/i/o/764971129/748a7dc8938e255a58d8ade5/Settings+%283%29.jpg?expires=1757505600\&signature=83dc2b4b0a005ca3196489f901895f0203260103e2d467b329f884fa8e6b3e8a\&req=cyYjH85%2FnINWFb4V1XW4gWv9pXRDxXjrLkDkMBe40mL1b8oTDTh2dDEmL5fr%0API%2BWaoDwuQOc31ZUZIUL3uoO3w%3D%3D%0A)](https://downloads.intercomcdn.com/i/o/764971129/748a7dc8938e255a58d8ade5/Settings+%283%29.jpg?expires=1757505600\&signature=83dc2b4b0a005ca3196489f901895f0203260103e2d467b329f884fa8e6b3e8a\&req=cyYjH85%2FnINWFb4V1XW4gWv9pXRDxXjrLkDkMBe40mL1b8oTDTh2dDEmL5fr%0API%2BWaoDwuQOc31ZUZIUL3uoO3w%3D%3D%0A)

Hit \[Update] and your webhook is all set up. [Create a route plan](https://intercom.help/parcelizer/en/articles/5974503-how-to-create-a-route-plan) and start completing some stops to check if the webhook is firing correctly (a tool like [ngrok](https://ngrok.com/) or [RequestBin](https://pipedream.com/requestbin) is perfect for setting up a temporary webhook endpoint for testing).

### Supported Events <a href="#h_3ba298f155" id="h_3ba298f155"></a>

Parcelizer supports the following events with webhooks:

| Event Name                 | Trigger                                                             |
| -------------------------- | ------------------------------------------------------------------- |
| `routeplan.dispatch`       | When the user dispatches a route to drivers for the first time.     |
| `routeplan.dispatchUpdate` | When the user updates a route and dispatches it again.              |
| `order.pickup.arrived`     | When the driver presses the \[Arrive] button on a pickup stop.      |
| `order.pickup.completed`   | When the driver presses the \[Completed] button on a pickup stop.   |
| `order.pickup.failed`      | When the driver presses the \[Failed] button on a pickup stop.      |
| `order.delivery.arrived`   | When the driver presses the \[Arrive] button on a delivery stop.    |
| `order.delivery.completed` | When the driver presses the \[Completed] button on a delivery stop. |
| `order.delivery.failed`    | When the driver presses the \[Failed] button on a delivery stop.    |

If there is an event that you need to capture that is not listed here, please reach out to <support@parcelizer.com> and we'll try to support your use case.

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.packagelytics.com/integrations/configure-webhooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
