Learn how to use Smartcar webhooks to detect when a vehicle starts and ends charging, and how to process charging session data.
Configure Your Webhook for Charging Events
Validate Webhook Events
Subscribe a vehicle to a webhook in the Smartcar Dashboard
eventId
and an eventType
field. The eventType
will indicate the type of event that occurred, such as VEHICLE_STATE
or VEHICLE_ERROR
.
Your handler should gracefully handle both event types. For VEHICLE_STATE
events, you will receive the updated vehicle data. For VEHICLE_ERROR
events, you may want to log the error.
For VEHICLE_STATE
events, you will receive the data in a data
property of the payload. There will also be an array of signals under a triggers
property that caused the event to be sent. Lastly, you will also receive a meta
property with additional context about the event, such as the webhook ID, name, delivery ID, delivery timestamp, etc.
eventType
of VEHICLE_STATE
and the Charge.IsCharging
signal set to true
. When the vehicle stops charging, you will receive another event with Charge.IsCharging
set to false
. You can use these events to track the start and end of each charging session.
Example event payload: