๐Ÿ•ธ๏ธ ๐Ÿช Webhook Receivers Example Project Published

Webhook Receivers are used to get notifications about state changes in gridX/XENON within your app. A webhook receiver is a publicly accessible endpoint on a server that is called by gridX when domain events, e.g., when an appliance goes online, occur. By implementing a webhook receiver, you can react on these events within your custom application. This allows for push based delivery of events as opposed to your app having to pull gridXโ€™s API constantly.

Currently, the following event types being emitted:

  • appliance/create: Appliance was created
  • appliance/offline: Appliance went offline
  • appliance/online: Appliance went online
  • inverter/status: Inverter status has changed
  • gateway/create: Gateway was created
  • gateway/offline: Gateway went offline
  • gateway/online: Gateway went online
  • ev/plugged: Vehicle was plugged into the charging station, charging state changed
  • commissioning/done: Commissioning of a gateway was completed

To make it easy to get started using it, we published some code samples and explanations on GitHub.

If contains the following examples:

  • NodeJS/Express: Hand-written webhook receiver that writes the IDs of appliances coming online to the console.
  • Go: Server with stubs for all supported event types generated using openapi-generator.
  • Python/aiohttp: Server with stubs for all supported event types generated using openapi-generator. For the sample, we print information about appliance/online events.
  • Go Signature Verification: Example implementation of signature validation in go.
  • Reactive Webapp: A webhook receiver that relays events to a React client app through websockets

You might, e.g., build a reactive dashboard for appliances connectivity state based on the information in there.

Curious? Hop over to GitHub and start poking around! :point_down:

3 Likes

To stay save and offer unlimitted requests to your local webhook receiving server we changed our example workflow to use zrok instead of ngrok. Check out the latest version of our repo to try it out.

1 Like