Diagnostic Webhooks
Diagnostic webhooks send events whenever a state change occurs within the vehicle’s Health Status or a Diagnostic Trouble Code (DTC) is reported
Beta
Diagnostic webhooks are available in beta throughout December 2024 - January 2025 for organizations with Enterprise plans with Smartcar.
Brand Support
Diagnostics provide visibility into Diagnostic Trouble Codes (DTCs) for GM vehicles and System Status information for GM and FCA vehicles.
Supported Events
Diagnostic Trouble Codes (DTCs), which are 5-digit codes that indicate the component and fault type. DTC webhooks will send events for each active DTC including a timestamp it became active. A webhook event will also trigger when a DTC is no longer active.
System Status, where an OEM application’s “Vehicle Health” or “System Health” reports provide a list of components and their health status. System Status webhooks will send events whenever a system reports a change from Healthy to Alert and vice-versa. A list of diagnostic systems is available in our Help Center.
Prerequisites
For this tutorial it is recommended to have the following in place:
-
To receive webhooks you’ll need to set up a callback URI on your server.
-
To subscribe a vehicle you’ll want to have Connect integrated into your application.
Setting up a Diagnostic Webhook
Navigate to Webhooks from the Smartcar Dashboard, select + Add webhook and select Event-based from the Webhooks config wizard.
Name your webhook and specify a callback URI
. Your callback URI
is where Smartcar will send payloads from vehicles connected to your webhook. Click Next.
Select which event types you wish to receive from System Status or Diagnostic Trouble Codes and hit Add. To receive both event types, create a second webhook.
Hit Add when ready.
After adding your webhook, you’ll need to verify your callback URI. This is to ensure Smartcar is sending data to the correct place!
Please see our API reference on how to verify a webhook, or Part II on this blog post for a more in depth guide.
Subscribing vehicles to a webhook
Now you’ve got your webhook set up, you can subscribe vehicles to start getting data. If you haven’t done so already, please set up Connect for your application.
After going through Connect and receiving your initial access_token
, you’ll first want to hit the All Vehicles endpoint to fetch the Smartcar vehicle_ids
of the authorized vehicles.
With your access_token
and webhook_id
you can hit the Subscribe endpoint for each vehicle_id
to start receiving data.
Example Diagnostic Trouble Code Payload
Response
The unique ID of the event delivered.
The ID for the vehicle.
The ID for the user impacted by the event.
The date and time the event was reported.
Indicates the event is a DTC.
the Diagnostic Trouble Code.
The date and time the DTC became active. ISO 8601, millisecond precision, UTC time zone.
Example System Status Payload
Response
The unique ID of the event delivered.
The ID for the vehicle.
The ID for the user impacted by the event.
The date and time the event was reported.
Indicates the event is a System Alert
the system reporting alert or OK status. See Smartcar Systems.
Either “ALERT” or “OK”.
A plaintext, readable description when available.
The date and time the DTC became active. ISO 8601, millisecond precision, UTC time zone.
FAQs
How often will I get data?
How often will I get data?
Smartcar will handle regular polling for diagnostic events to provide them as quickly as possible.
Can I use the same callback URI for all my webhooks?
Can I use the same callback URI for all my webhooks?
Yes! You can distinguish between webhook types based on the eventName
field. Dynamic Webhooks will have eventName
set to dynamic
.
What happens if my webhook destination goes down temporarily?
What happens if my webhook destination goes down temporarily?
Smartcar will attempt to resend payloads with an exponential backoff. Once your server is back online you’ll continue to receive data from the vehicles.
I've stopped receiving events
I've stopped receiving events
-
Once a webhook is configured and a vehicle is subscrbied, we’ll begin sending data to your Callback URI. We’ll expect a 2xx response to each. In the event that we don’t receive a 2xx response, we’ll retry 6 times with exponential backoff. If we continue not to receive a successful response, we’ll automatically disable your webhook.
-
If you haven’t made any major changes to your callback URI, commonly our request payload may have hit the request size limit for you server.
What happens if a vehicle encounters an error? Will you retry?
What happens if a vehicle encounters an error? Will you retry?
Smartcar will attempt to get data from the vehicle with retries. However if we are unable to we’ll return the relevant error response in the payload for that vehicle.
For example, if a vehicle owner changes the credentials to their connected services account we’ll return a CONNECT_SERVICES_ACCOUNT:AUTHENTICATION_FAILED error prompting you to have the vehicle owner go through Connect again to reauthenticate their vehicle.
How do I unsubscribe a vehicle from a webhook?
How do I unsubscribe a vehicle from a webhook?
To unsubscribe a vehicle you can hit the unsubscribe endpoint or disconnect the vehicle from your application.