Webhooks
Webhook Setup
Once you have created an API key (refer to the authentication section for detailed instructions), the process of configuring webhook URLs for monitoring status changes and ETAs becomes straightforward. Use our booking portal seamlessly to manage this integration effortlessly.
Webhook Security
In order to verify that webhooks are coming from gophr, we'll send you an API-KEY
header containing your account API key e.g . API-KEY: sand-2a7df6bd-8ed3-48ad-b801-05093a866e66
. Below is an example request:
curl --request POST \
--url https://api-sandbox.gophr.com/v2-commercial-api/your-status-update-webhook-url \
--header 'API-KEY: dev-2a7df6bd-8ed3-48ad-b801-05093a866e66' \
--header 'Content-Type: application/json' \
--data '{
"delivery_id": "74afea12-24aa-44c7-a55b-b2dc2a9a02d3",
"external_id": "12345",
"pickup_eta": "2019-08-24T14:15:22Z",
"delivery_eta": "2019-08-24T14:15:22Z",
"courier_location_lat": 0,
"courier_location_lng": 0,
"status": "CANCELED",
"leg_type": "STANDARD",
"price_net": 2.95,
"price_gross": 4.56,
"meta_data": [
{
"key": "string",
"value": "string"
}
],
"courier_name": "string",
"courier_notes": "string",
"courier_mobile_number": "string",
"cancellation_comment": "string",
"proof_of_pickup": {
"type": "Photo",
"url": "https://test.com"
},
"proof_of_delivery": {
"type": "Photo",
"url": "string"
},
"events": [
{
"timestamp": "string",
"status": "NEW"
}
]
}'
Testing Webhooks
Webhooks can be tested using our POST /jobs/{job_id}/deliveries/{delivery_id}/progress
endpoint. Hitting this endpoint will progress the delivery to the next status and cause the status update webhook to be fired.
If you wish to receive the webhook locally then we suggest using a tool like ngrok which will allow you to expose a public URL locally for the payload to be sent to. We'll also need to configure this url on your account.
Updated 10 months ago