Webhook

To add a webhook to LubeLogger, you just have to add the WebHook URL in the Server Settings Configurator

Example payload:

Triggers:

  • Vehicle - Create/Edit/Delete
  • Service Record/Repair/Upgrade - Create/Edit/Delete/Move/Adjust Odometer/Duplicate
  • Odometer - Create/Edit/Delete/Adjust Odometer/Duplicate
  • Fuel/Tax/Supply/Notes/Reminders - Create/Edit/Delete/Duplicate

Adding records via the API will also trigger the above webhook.

Discord Webhook

LubeLogger supports using Discord Chatrooms as a webhook as of 1.4.2, to use Discord as a webhook, change the https:// in the beginning of the webhook URL to discord://

https://discord.com/api/webhooks/...

will turn into

discord://discord.com/api/webhooks/...

Example Discord Webhook Payload:

WebSocket

Web sockets allows multiple external applications to subscribe to events, unlike webhooks which only allows for one subscriber at a time. Web Sockets also enables real-time sync within LubeLogger which is the ideal approach for Kiosk mode.

Web socket can be enabled in the Server Settings Configurator

Testing WebSocket Connection

Web sockets are implemented through SignalR hubs, which provides fallbacks such as SSE and long-polling if operating under unsupported environments. For this example, we will assume that web sockets are enabled and supported.

In PostMan(or your preferred RestApi tester), select WebSocket as the connection type:

If authentication is enabled, you will need to generate an api key(viewer permission) and append it. If your LubeLogger instance is served over a https connection, use wss:// otherwise use ws://

Example URL:

wss://your/lubelogger/domain/api/ws?apiKey=<apiKey>

Click connect and it should succeed

You will then send a few messages to set the protocol and join either one of these groups:

  • kiosk
  • vehicleId_{id of the vehicle}

The kiosk group allows you to subscribe to changes across all vehicles in the system, where as the vehicleId_{id of the vehicle} group allows you to subscribe to changes only from that vehicle.

Because the messages contains the non-printing character 0x1e (RS), they can be found on this gist instead of being in this wiki.

This message sets the protocol

This message joins the kiosk group

This message joins the group for vehicleId 1

If you're already joining the kiosk group, joining the vehicleId groups is redundant.

Notes on WebSocket Security

Note that ANY user can subscribe to ANY group, which means, that if a user has a valid API key, they can subscribe to events from any vehicles, even those they don't have access to. Only enable web sockets if you are the only user in your instance or if you fully trust all of the users in your instance. Much like webhooks, the web socket implementation in LubeLogger is one-way, meaning that users can consume events but not transmit any events back to the server via webhooks.

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9