Webhooks


Webhook Events
Introduction
eDRV provides developer applications a near real time stream of network wide events via Webhooks. We highly recommend developers use Webhooks to listen for events instead of polling for data.
Available Event Types
Currently eDRV reports events of the following types:
- users
- chargestations
- connectors
- commands
- transactions
Event Data
For further information on each event type and the data fields, see the API Reference and Data Hierarchy
Use Cases
Some of the possible use cases for Webhooks are:
- Build No-Code applications: Connect your EV charging network to thousands of other apps via Zapier and IFTTT. See Zapier Incoming Webhooks
- Integrate with Mapping providers: Report the availability of your chargestations in real time to drivers
- Onboard Users: Send a welcome set of emails helping Users who have just registered on eDRV
- Smart Charging: Build intelligent power management applications for EV charging and react in real time to upstream power congestion. See Real Time Transaction Power Management
- Reservation Systems: Use real time connector status events to build a queueing system for drivers in real time.
Subscribe to Webhooks


Navigate to the edrv dashboard > Integrations page. Add a new Webhook and paste your application's Webhook handler endpoint. eDRV will post all event types to this URL as an HTTP POST request.
Expected Response
Your application servers must respond to each request with
200
OK status code- Empty response Body
No response or other errors
If there is continuously no response from your application or there are other errors in the POST request, eDRV will automatically disable your Webhook
Processing Webhook Data
The Webhook Body contains the following fields that your application must handle:
collection string
Reports event type. See Event Types above.
operation string
Event trigger. Can be one of the following:
create: Newly created e.g. when a User signs up for the first time
update: For e.g. with the connector state changes from "charging" to "available"
{
"collection": "connectors",
"operation": "update",
"document": {
"_id": "5f72f55431a6770a131db279",
"endpoint": "r9l5",
"active": true,
"status": "Preparing",
"type": "Type 2",
"format": "Cable",
"power_type": "AC Single Phase",
"power": 11.1,
"rate": "60eedeab96248f1a221104fb"
"organization": "5e7e6c058a6deccfefdf4223",
"evse": "5f72f55431a6770a131db278",
"ocppId": 1,
"createdAt": "2020-09-29T08:50:28.558Z",
"updatedAt": "2021-07-26T14:14:01.790Z",
}
}
Demo Webhook Server
As Webhook server in Node.js with some examples on how you can process the data delivered by eDRV within your application.
var express = require('express');
var app = express();
const port = 3000;
app.use(express.json());
app.listen(port, () => {
console.log(`Listening on port: ${port}`)
});
app.route('/').get(function (req, res) {
res.send('Sample Webhook Handler');
})
app.route('/webhook').post(function (req, res) {
//Immideately respond to eDRV servers
res.send();
//Process webhook data
let data = req.body;
switch (data.collection) {
case 'connectors':
if (data.operation === "update") {
console.log(`New connector state is: ${data.document.status}`)
//New connector state is: Preparing
}
//Process other connector operations
break;
case 'users':
//Process user data
break;
case 'chargestations':
//Process chargestation data
break;
case 'commands':
//Process commands
break;
case 'transactions':
//Process transactions
break;
default:
console.error(`Sorry, unrecognized event type: ${data.collection}.`);
}
});
Quick View
If you want to quickly test Webhook data received you may consider a disposable Webhook url from a service like Webhook.site.
Remember to delete your disposable webhook from the eDRV dashboard after you have tested it.
Updated 8 months ago