Interface WebhookService


@NonNullByDefault public interface WebhookService
Service interface for requesting webhook URLs that are publicly reachable and proxied to a local path on this openHAB instance. Implementations (e.g. the openHAB Cloud addon) register themselves as an OSGi service. Bindings consume this service via @Reference to obtain a public URL that external services can call; the implementation proxies those incoming requests back to the specified local path.
Author:
Dan Cunningham - Initial contribution
  • Method Details

    • requestWebhook

      CompletableFuture<Webhook> requestWebhook(String localPath)
      Request a webhook for the given local path. The implementation returns a Webhook carrying a public URL that proxies incoming requests to the specified local path on this openHAB instance, together with the instant at which the registration expires.

      Implementations should treat this call as idempotent when possible: calling it with the same localPath should return a stable URL and refresh the expiration.

      Parameters:
      localPath - the local openHAB path to forward webhook requests to (e.g. "/rest/webhook/foo"); must start with "/"
      Returns:
      a CompletableFuture that completes with the registered Webhook, or completes exceptionally if registration fails
    • removeWebhook

      CompletableFuture<Void> removeWebhook(String localPath)
      Remove a previously registered webhook for the given local path.
      Parameters:
      localPath - the local openHAB path whose webhook should be removed
      Returns:
      a CompletableFuture that completes when the webhook is removed, or completes exceptionally if removal fails