Webhooks
Webhooks are the most common way to interact with the Openvolt platform in an asynchronous way. With the launch of our Events Platform you can now subscribe to get notified of different types of events through email or webhooks.
A webhook is a HTTP POST message we send to your server when something interesting happens on the Openvolt platform.
Subscribing to a Webhook notification
To subscribe to an event webhook, visit the "Event Subscriptions" part of the developer dashboard and click on "Subscribe to an Event".
- Choose "Webhook" as the subscription type
- Enter a public URL that Openvolt can send information to
- Description of the event subscription
- Events you are subscribing to. You can subscribe to one or multiple events for the same webhook URL or create a new subscription and webhook url for each event. The schema of the event message contains the type of event, so you can process them differently when needed.
Event Notification Schemas
Each event notification will be sent in JSON format with the following schema
{
"subscription_id": "0318df2f-7b9c-4b2e-bf8d-113919ab1e78",
"event_id": "meter_data.received",
"event_timestamp": "2024-05-02T12:31:26.257Z",
"delivery_id": "c9d893a1-11dc-4063-834f-35bff4437ca2",
"payload": ""
}
Each payload
will differ depending on the event type. Please see Event Types for further details on each
A Working Example
One example is the processing a webhook
from the meter_data.received
notification. In this scenario, notifications will be sent to your webhook endpoint when any of your meters receive new data on Openvolt under the following conditions
- A meter receives a backfill of 13 months of interval data. In the case of commercial meters, one webhook will be sent for the entire 13 months. For UK residential, it will result in a webhook notification for each of the 13 months
- A meter receives a daily update from it's respective data source. This ensures you get the data as soon as Openvolt receives it
- A meter gets updates due to missing data gaps. Openvolt has a comprehensive retry mechanism that ensures data gaps are at a minimum
A working example of setting up a simple server endpoint using an Express server, and processing the payload of a meter_data.received
payload can be found here
Testing Webhooks
When testing your webhook endpoints, we recommend using a couple of external services to make the process easier. Both https://webhook.site for hosted webhooks or https://ngrok.com/ for tunnelling to your local machine are super useful.
Updated 7 months ago