How to use webhooks

Listen for events in your Crowdsender account so your integration can trigger reactions automatically.

Crowdsender avatar
Written by Crowdsender
Updated over a week ago

Crowdsender uses webhooks to notify your app when an event occurs in your account. Webhooks are especially useful for asynchronous events such as when a shipment status change, label is created or other fields of the order change, such as the courier, the date of shipment or the address of the recipient.

A webhook enables Crowdsender to send real-time push notifications to your app. Crowdsender uses HTTPS to send these notifications to your app as a JSON payload. You can then use these notifications to take action on your back-end systems.

Steps to receive webhooks from Crowdsender

  1. Subscribe to one of the events we offer going to Integrations > Api & Webhooks > Webhooks and click on Webhooks and then on Add new webhook

  2. Fill the requested info: Description to identify your webhook, mode, event to subscribe, url to receive the event, and the authentication required needed to call your endpoint where to receive notifications.

Events supported to subscribe

Update tracking status

Every time there is a change in the tracking status of a box of an order, Crowsender will send a message with the order id, order number, box id, previous status, the new one, and the documents and the tracking id if available.

Example of event received:

{
"apiVersion": 1,
"createdAt": "2022-01-09T18:30:00.000Z",
"liveMode": true,
"type": "trackingUpdated",
"source": "crowdsender.webhooks.order.box.tracking",
"data": {
"orderId": "3LkOSOBBZrw7oS2I1tbxaco5",
"boxId": "3LkOSOBBZrw7oS2I1tbxaco4",
"object": "order",
"orderNumber": "CF2230949033",
"_externalReferenceId": "999833jdkek39ldldldk39",
"newValue": "generated label",
"previousValue": "waiting",
"documents": [{uri: "https://jjkdjk.label.pdf", typeFile: 'label'}],
"trackId": "88938849309"
}

The data.documents and data.trackId fields only come with data when the new tracking is 'generated label'.

Possible values:

  • data.previousValue y data.newValue: 'waiting', 'generated label', 'scanned', 'on route', 'last mile', 'incident', 'possible delay', 'returned', 'destroyed', 'lost', 'delivered', 'damaged', 'not available', 'depot', 'delivery point', 'reprint'.

  • data.documents.typeFile: 'label', 'exportDocs', 'soivre'

Update order status

Crowsender will send a message to the configured webhook every time an order changes status with the order id, order number, previous and new status.

Example of event received:

 {
"apiVersion": 1,
"createdAt": "2022-01-09T18:30:00.000Z",
"liveMode": true,
"type": "statusUpdated",
"source": "crowdsender.webhooks.order.status",
"data": {
"orderId": "3LkOSOBBZrw7oS2I1tbxaco5",
"object": "order",
"orderNumber": "CO2230949033",
"_externalReferenceId": "999833jdkek39ldldldk39",
"newValue": "PENDING_TO_SHIP",
"previousValue": "REGISTERED",
}

Possible values:

  • data.previousValue and data.newValue: 'REGISTERED', 'PENDING_TO_SHIP', 'SHIPPED', 'SHIPMENT_FAILED', 'COMPLETED', 'CANCELED', 'TO_REVIEW'

Update send date

Crowsender will send a message to the configured webhook every time an order changes the shipping date with the order id, order number, previous and new value.

Example of event received:

{
"apiVersion": 1,
"createdAt": "2022-01-09T18:30:00.000Z",
"liveMode": true,
"type": "sendDateUpdated",
"source": "crowdsender.webhooks.order.box.tracking",
"data": {
"orderId": "3LkOSOBBZrw7oS2I1tbxaco5",
"object": "order",
"orderNumber": "CO2230949033",
"_externalReferenceId": "999833jdkek39ldldldk39",
"newValue": "2022-01-02T00:00:00.000Z",
"previousValue": "2022-01-01T00:00:00.000Z",
}

Possible values:

  • data.previousValue and data.newValue: Date in ISO format.

Update courier

Crowsender will send a message to the configured webhook every time an order changes courier with the order id, order number, previous value, and new value.

Example of event received:

{
"apiVersion": 1,
"createdAt": "2022-01-09T18:30:00.000Z",
"liveMode": true,
"type": "courierUpdated",
"source”: "crowdsender.webhooks.order.box.tracking",
"data": {
"orderId": "3LkOSOBBZrw7oS2I1tbxaco5",
"object": "order",
"orderNumber": "CF2230949033",
"_externalReferenceId": "999833jdkek39ldldldk39",
"newValue": "9459fjkt4554ldldl009y",
"previousValue": "112jhdn344nb4o49dj9jejj",
}

Possible values:

  • data.previousValue and data.newValue: courier id's

Update Destination Address

Crowsender will send a message to the configured webhook every time an order changes courier with the order id, the order number, and the previous and new full addresses.

Example of event received:

{
"apiVersion": 1,
"createdAt": "2022-01-09T18:30:00.000Z",
"liveMode": true,
"type": "destinationAddressUpdated",
"source": "crowdsender.webhooks.order.box.tracking",
"data": {
"orderId": "3LkOSOBBZrw7oS2I1tbxaco5",
"object": "order",
"orderNumber": "CF2230949033",
"_externalReferenceId": "999833jdkek39ldldldk39",
"newValue" :{
"name" : "aaaa",
"surnames" : "bbbb",
"phone" : {
"prefix" : "+00",
"number" : "000000000"
},
"street" : "street",
"number" : "1",
"details" : "",
"city" : "München",
"zip" : "80469",
"province" : "Bavaria",
"country" : "de",
"email" : "xxxxxx@gmail.com"
},
"previousValue": {
"name" : "aaaa",
"surnames" : "bbbb",
"phone" : {
"prefix" : "+00",
"number" : "000000000"
},
"street" : "street",
"number" : "1",
"details" : "",
"city" : "München",
"zip" : "80469",
"province" : "Bavaria",
"country" : "de",
"email" : "xxxxxx@gmail.com"
}
}

Possible values:

  • data.previousValue and data.newValue:

{
"name" : "aaaa",
"surnames" : "bbbb",
"phone" : {
"prefix" : "+00",
"number" : "000000000"
},
"street" : "street",
"number" : "1",
"details" : "",
"city" : "München",
"zip" : "80469",
"province" : "Bavaria",
"country" : "de",
"email" : "xxxxxx@gmail.com"
}

Did this answer your question?