Webhook


We enable users to register their own callback URLs to receive notifications related to status change of a booking. It is recommended to use webhooks along with the Track Ride API to get the status updates of bookings, thereby reducing the poll frequency. You can register the same in your Ola developers account.

A webhook URL is a REST endpoint hosted in a publicly accessible server controlled by you, and should mandatorily satisfy the below requirements:

  • The endpoint should accept HTTPS POST requests
  • URL should begin with https://
  • URL length should be no more than 100 characters

There will be a one-time validation of the webhook with the below request:


{
  "request_type" : "WEBHOOK_URL_VALIDATION"
}

The response from the endpoint for all the requests should conform to the following format:


{
  "success": "true",
  "name": <company_name> //should match exactly with name registered in your account
}

The webhooks URL is expected to return a response as explained above. If due to some reason Ola cannot reach the webhooks URL specified, either due to network issues or application issues at your end or if the endpoint responds with a HTTP error code 500, Ola will try to retry to send the request 7 more times.


Booking state change requests

The following state changes are notified via webhooks

  • CALL_DRIVER - This event indicates that a cab has been allocated for the booking made. It event contains the details of the driver and the cab.
    {
      "timestamp": "2016-08-23T18:25:24.090+05:30",
      "booking_id": "CRN123456789",
      "booking_status": "CALL_DRIVER",
      "driver_name": "Driver Name",
      "driver_number": "9999999999",
      "cab_type": "Mini",
      "cab_number": "KA12345",
      "car_model": "Tata Indica",
      "car_color": "White"
    }
  • CLIENT_LOCATED - This event indicates that the driver has arrived at the client location. It is sent for all bookings including share.
    {
      "timestamp":"2017-12-01T14:09:57,000 +0530",
      "booking_id":"CRN123456789",
      "driver_lat":22.5187317,
      "driver_lng":88.3654213,
      "booking_status":"CLIENT_LOCATED"
    }
  • IN_PROGRESS - This event indicates that the client has onboarded the cab and the ride has started. It is sent for all events including share.
    {
       "timestamp":"2017-12-01T14:07:28.527+05:30",
       "booking_id":"CRN123456789",
       "booking_status":"IN_PROGRESS"
    }
  • BOOKING_COMPLETED - This event indicates the end of a ride and is sent for all bookings including share.
    {
       "timestamp":"2017-12-01T14:10:03.845+05:30",
       "booking_id":"CRN123456789",
       "booking_status":"COMPLETED",
       "trip_info":{
          "amount":264.0,
          "payable_amount":264.0,
          "distance":{
             "value":14.8,
             "unit":"KM"
          },
          "wait_time":{
             "value":0.0,
             "unit":"MINUTE"
          },
          "discount":0.0,
          "advance":0.0,
          "round_off_value":-0.17
       },
       "fare_breakup":[
          {
             "display_text":"Base fare",
             "value":70.0
          },
          {
             "display_text":"Distance fare for next 14.8 km",
             "value":118.4
          },
          {
             "display_text":"Ride time fare",
             "value":52.0
          },
          {
             "display_text":"Total tax",
             "value":18.62
          }
       ],
       "driver_name":"Name of the driver",
       "license_no":"MX04XX0000"
    }
  • CANCELLED - This event is sent when the booking is cancelled, either by the driver or by the customer. This is sent for all bookings including share.
    {
       "timestamp":"2017-12-01T14:09:03.231+05:30",
       "booking_id":"CRN123456789",
       "booking_status":"BOOKING_CANCELLED",
       "cancellation_reason":"customer_request"
    }
  • ALLOTMENT_FAILED - When a driver could not be allocated against a booking scheduled for the specified time.
    {
       "timestamp":"2017-12-05T12:55:45.909+05:30",
       "booking_id":"CRN123456789",
       "booking_status":"ALLOTMENT_FAILED",
       "cancellation_reason":"stock_out"
    }

Note:

  • Webhook is meant to be used only as an event update service. Please call track ride api to get the exact response.