Webhook API versus WebSocket with REST API

Hello all,

I am building a native app to control some instances in Home Assistant. I am puzzled which API I should use.

I am able to use the WebSocket (https://developers.home-assistant.io/docs/api/websocket) and REST API (https://developers.home-assistant.io/docs/api/rest) to reach my goal.

However in the official documentation for building a Native app, it advises me to use the webhook API (https://developers.home-assistant.io/docs/api/native-app-integration/sending-data).

Could someone please explain to me what the difference are between each approach. (Are there pro’s to using one compared to the other?)

Thanks in advance :)!

It all depends on your needs:

  • 1 way HA β†’ App: REST (or websockets if you want push rather than pull)
  • 1 way app β†’ HA: Webhooks
  • 2 way: Websockets