Skip to content

Handling events

To handle incoming events, the only thing you need is a or multiple REST endpoints on your backend. KNOT SVaaS will make a HTTP POST on the endpoints you configured on the manager.

The system is flexible, you can create a route by events or group several events on the same route. Organize yourself as you want!

Configure endpoints

To configure endpoints, please go on our manager:

Then open the menu API Keys and click on Add endpoints:

Endpoint pages

Then you need to complete the form.

Add endpoint form

  • Type: station or vehicle.
  • Url: Here you should put the url of your endpoint.
  • Events: Choose one or more events to be sent to this endpoint. In this example we check all event related to a normal usage of the station. The 5 others are related to alert / problem handling.
  • By default the request is signed with the KNOT private key, but you can specify your own key if you prefer.

Verify request signature

To ensure that the request come from KNOT and not from an attacker, you should verify the signature of the request.

Example of implementation

Here is a simple implementation in NodeJS with express

const express = require('express');
const app = express();
const rent = require('./core/rent-system');'/station/usages', (req, res) => {
    const station = req.body.station;
    const event = req.body.event;
    if (event == "boot") {
        console.log(`Station #${station} booted !`);
    else if (event == "unlocked") {
        const spot =;
        const unlockId =;
        console.log(`Spot ${spot} on station #${station} has been unlock`);
    else if (event == "locked") {
        const spot =;
        const scooterId =;
        const date = new Date(;
        console.log(`Scooter #${scooterId} returned spot ${spot} on station #${station} at ${date.toISOString()}`);
        rent.stop(scooterId, date);

app.listen(3000, () => {
    console.log('Example app listening on port 3000!');