Overview

Webhooks send real-time data or notifications to a system or an application when a specific event happens. Unlike APIs that require manually triggering an event to database, Webhooks rely on specific events, such as departure of a truck, delivery of goods, or completion of a dispatch to automatically send out relevant information.

For Fleet Managers or operations Webhooks play a crucial role in sending out real-time information.

This overview covers the Webhooks that you can use in your regular day-to-day operations.

Fetch a list of all the company's Webhooks

  • Endpoint:v1/company_webhooks
  • Description:Use this endpoint to fetch all the available webhooks that you can use at your organization.
  • Use Case: View all the available Webhooks that you've created for your company using this endpoint. This allows you to know which of the events you are tracking. If you think there are other events that you are required to track, then you can add new Webhooks using the Create a new company Webhook endpoint.

Fetch a Webhook using its ID

  • Endpoint:v1/company_webhooks/{id}
  • Description:Use this endpoint to see the detail of a specific Webhook, using its ID.
  • Use Case: View the details of a specific Webhook, using its ID. Enter the ID of the Webhook in the query params to see the following details of the Webhook:
    • ID
    • URL
    • Secret
    • Format
    • Actions

If you feel that this Webhook is not gathering enough info, you can update it by using the Create a new company Webhook endpoint.

Create a new company Webhook

  • Endpoint:v1/company_webhooks
  • Description:Use this endpoint to create a new Webhook for your company.
  • Use Case: As a Fleet Manager you will require lots of data to be present for you to optimize your operations and to run them efficiently. To this end, Motive allows you to create Webhooks, which will either take an automated action or present the info to you, so that you act on it accordingly.

Update an existing Webhook

  • Endpoint:v1/company_webhooks/{id}
  • Description:Use this endpoint to update an already existing Webhook.
  • Use Case: There may be times when the Webhook response or the event that triggers the Webhook, has either changed or requires you to make some updates to it. In such cases, you can update the existing Webhook by adding its ID in the query params. To update, you must also enter specific information in the body of the endpoint. The body params are as follows:
    • URL: Mention the new Wehbook URL (if any).
    • Secret: Enter the secret of the location from when you want to fetch the data. If left blank, a new secret is generated automatically.
    • Format: JSON
    • Actions: Specify the action that the Webhook must take. For example, vehicle_location_updated, vehicle_id updated, or others.
    • Enabled: Specify true or false here.

NOTE: Update either one or all of the body parameters.

Fetch all the Webhook requests

  • Endpoint:v1/company_webhook_requests
  • Description:Use this endpoint to view all the available Webhook requests for your company.
  • Use Case: The Webhook requests are triggered based on the configurations in the first endpoint i.e Fetch a list of all the company's Webhooks. These requests occur when an event such as vehicle_location_updated is triggered. This response shows the actual data being sent when an event is triggered. It also shows if the status of the event is a success or a failure.

Trigger a specific Webhook

  • Endpoint:v1/company_webhook_requests/retry
  • Description:Use this endpoint to trigger a particular Webhook.
  • Use Case: Check out how usually the particular Webhook is triggered and what sort of information you are able to obtain. This will allow you to tweak the existing Webhook or make necessary changes as per your requirement. If the Webhook is not meeting your expectations, then you can simply copy the ID of the Webhook, and make the required changes using the "Update an existing Webhook" endpoint.