Webhooks
Your application can receive a webhook notification for certain driver events. Webhooks notifications are sent as an HTTP POST request to your server. You can specify a webhook URL in your application settings on the developer dashboard.
¶ JSON Body Parameters
Webhooks notifications have a standard format. The POST parameters are outlined below.
Name | Type | Description |
---|---|---|
event_id |
string |
Unique event identifier, which can be used to ensure that events are only digested once. |
event_time |
integer |
Unix timestamp of the time the event occurred. |
event_type |
string |
The type of event that occurred. |
meta |
object |
The object containing additional information that is specific to the event_type . |
meta.user_id |
string |
Unique identifier of the user this event was generated for. |
meta.resource_id |
string |
Unique identifier of the resource this event has been generated for. |
¶ Example Payload
{
"event_type":"driver.status_changed",
"resource_href":"https://api.uber.com/v1/partners/trips/f57276c0-1341-4585-9a72-cda28624360f",
"event_time":1463687270,
"event_id":"a53b019a-0943-4243-87fa-f839a91d90c0",
"meta":{
"user_id":"7528309f-644a-41cc-8b7c-bba57046e916",
"resource_id":"f57276c0-1341-4585-9a72-cda28624360f"
}
}
¶ Reference
¶ Security
Webhook messages are signed so that your app can verify that the sender is Uber. Webhooks requests contain an X-Uber-Signature
header. The value of this field is a hexadecimal HMAC signature of the webhook HTTP request body, using the client secret as a key and SHA256 as the hash function.
Python Example
digester = hmac.new(client_secret, webhook_body, hashlib.sha256)
return digester.hexdigest()
¶ Headers
The Uber API will insert specialized headers for all requests made to your webhook URL to help your application utilize them appropriately.
Header | Description |
---|---|
X-Environment |
Indicates if this request is coming from the production or sandbox API. |
X-Uber-Signature |
SHA256 hash of the request body, using the client secret as the key. |
¶ Retry Attempts
If for some reason the Uber API cannot reach the webhook URL you specified either due to networking issues or application issues on your end, the Uber webhook service will retry to make a request.
We have implemented an exponential back-off algorithm with a back-off multiplier of 30 seconds which will make up to 7 attempts. This means we will attempt to request your webhook URL up to 7 times across roughly 1 hour.