# Webhook HTTP binding

**URL:** <https://community.openhab.org/t/webhook-http-binding/152184>\
**Category:** Bundles\
**Tags:** binding, beta, published\
**Created:** [December 20, 2023, 10:06pm UTC](https://community.openhab.org/t/webhook-http-binding/152184 "2023-12-20T22:06:15Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Piotr\_Bojko](https://community.openhab.org/user_avatar/community.openhab.org/piotr_bojko/32/50845_2.png) [@Piotr\_Bojko](https://community.openhab.org/u/Piotr_Bojko)\
**Post date:** [December 20, 2023, 10:06pm UTC](https://community.openhab.org/t/webhook-http-binding/152184/1 "2023-12-20T22:06:15Z")

</div>

# Webhook Binding

This even lets you describe your own API/WebHooks for OpenHab. This is sometimes needed for external services or hardware that has limited ability to call http webhooks.

## Supported Things

Only one thing is supported - webhook. This thing does not have any channels at first but let you add any number of it.

## Discovery

Discovery is not supported

## Binding Configuration

Main configuration of the created thing lies in its unique id. This is will be part of the url for a webhook endpoint processed by this thing.

Optional config is to fill _Response expression_ / _Expression_ . However for most cases you can leave with

```auto
resp.status=200

```

## Channel configuration

Within a channel you configure only an expression property. Configuration is in form of a script written in Apache JEXL language. Return value of this expression will be a value that updates/commands the channel.

As for now in the expression there is only a simple object req which has only two properties:

1. **parameters** - under this property all query parameters and form-encoded post parameters are placed. So you can define in your http requests query params and extract it to channels.
2. **body** - unders this property the body of the POST requests is stored. body has two properties text and json. With this you can post a json file to you openhab and use an expression to extract an value from the json and place it into channel. See further examples.
3. **method** - POST/GET/PUT/DELETE

Context for expressions can be enriched with more than one req object in future.

### Example

Following exaple of channel expression will update value of the channel whenever someone make a request to **http://[youropenhab]/webhook/[thingid]/[channelid]**.

```auto
if (req.parameters.action[0] == "call") {
  return "CALLING";
};

```

# Suppport this project

You can support this project by sponsoring its maintainers:  
[Piotr Bojko](https://github.com/sponsors/ptrbojko?frequency=one-time)

## Changelog

Please see [all release notes here.](https://github.com/ptrbojko/openhab-webhook-binding/releases)

## Resources

[org.openhab.binding.webhook-0.2.0.jar](https://github.com/ptrbojko/openhab-webhook-binding/releases/download/0.2.0/org.openhab.binding.webhook-0.2.0.jar)

[Release 0.2.0](https://github.com/ptrbojko/openhab-webhook-binding/releases/tag/0.2.0)

---

<div class="post-metadata">

**Author:** ![Oliver2](https://community.openhab.org/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@Oliver2](https://community.openhab.org/u/Oliver2)\
**Post date:** [July 13, 2024, 11:22am UTC](https://community.openhab.org/t/webhook-http-binding/152184/2 "2024-07-13T11:22:19Z")

</div>

Hey Piotr,  
could you have a look? After an update or after a cleancache your binding gets uninstalled by openhab.

---

<div class="post-metadata">

**Author:** ![Piotr\_Bojko](https://community.openhab.org/user_avatar/community.openhab.org/piotr_bojko/32/50845_2.png) [@Piotr\_Bojko](https://community.openhab.org/u/Piotr_Bojko)\
**Post date:** [July 16, 2024, 9:51pm UTC](https://community.openhab.org/t/webhook-http-binding/152184/3 "2024-07-16T21:51:42Z")

</div>

yeah, could you elaborate more on this? You can log the ticket at github.

> **[ptrbojko/openhab-webhook-binding](https://github.com/ptrbojko/openhab-webhook-binding/issues)**
>
> Contribute to ptrbojko/openhab-webhook-binding development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![jswim788](https://community.openhab.org/user_avatar/community.openhab.org/jswim788/32/36341_2.png) [@jswim788](https://community.openhab.org/u/jswim788)\
**Post date:** [July 17, 2024, 4:00pm UTC](https://community.openhab.org/t/webhook-http-binding/152184/4 "2024-07-17T16:00:02Z")

</div>

I don’t think this is unique to the Webhook binding - I’ve seen it happen to other bindings from the marketplace as well.

---

<div class="post-metadata">

**Author:** ![Oliver2](https://community.openhab.org/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@Oliver2](https://community.openhab.org/u/Oliver2)\
**Post date:** [July 17, 2024, 6:35pm UTC](https://community.openhab.org/t/webhook-http-binding/152184/5 "2024-07-17T18:35:50Z")

</div>

I don’t think, too, that it is unique to webhook binding. But maybe the deletion of bindings appear if the binding does not meet any kind of minimum criteria or some meta data are missing?  
It is not a big deal. I just wanted to bring this to the attention of the developer.

---

<div class="post-metadata">

**Author:** ![fals3illusion](https://community.openhab.org/user_avatar/community.openhab.org/fals3illusion/32/18884_2.png) [@fals3illusion](https://community.openhab.org/u/fals3illusion)\
**Post date:** [November 21, 2024, 12:33am UTC](https://community.openhab.org/t/webhook-http-binding/152184/6 "2024-11-21T00:33:41Z")

</div>

Just wondering if anyone has any idea how to get this to work with the new Unifi Protect Alarm manager. It has a webhooks option. Im not very familiar with how webhooks work or where to begin.

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/0/4/0447d4f1e0edb57e830438e83cf478fe2ab31e40.png)

I created a Channel named Test1

not sure how to edit the above emaple script to get it to do anything .

```php
if (req.parameters.action[0] == "call") {
  return "CALLING";
};

```

when i go to “[http://192.168.2.100:8080/webhook/testProtect/Test1](http://192.168.2.100:8080/webhook/testProtect/Test1)”  
the LastCall channel does update. I just am unsure how to script/ what headers i need to add to make this work some how.

This is from UniFi’s Site about webhooks.

Not sure if this helps any

> Advanced Settings  
> By default, the webhook will create an HTTP GET request each time an alarm is triggered.
> 
> For advanced cases, use the Advanced Settings:
> 
> HTTP GET allows custom headers for security tokens or other additional information.  
> HTTP POST delivers additional information about the alarm to your service.  
> Here is an example of the HTTP POST structure:

```php
{
  "alarm": {
    "name": "test post",
    "sources": [],
    "conditions": [
      {
        "condition": {
          "type": "is",
          "source": "motion"
        }
      }
    ],
    "triggers": [
      {
        "key": "motion",
        "device": "74ACB99F4E24"
      }
    ]
  },
  "timestamp": 1722526793954
}

```

Thanks for any help.

---

<div class="post-metadata">

**Author:** ![Oliver2](https://community.openhab.org/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@Oliver2](https://community.openhab.org/u/Oliver2)\
**Post date:** [November 21, 2024, 6:06pm UTC](https://community.openhab.org/t/webhook-http-binding/152184/7 "2024-11-21T18:06:31Z")

</div>

Your device supports http/post. You do not need the webhook binding.  
Create an http request:  
url = ‘[http://61:8080/rest/items/testItem](http://61:8080/rest/items/testItem)’  
contentType = “text/plain”  
content = “ON”  
headers:  
‘Accept’: ‘_/_’  
‘Authorization’: ‘Bearer oh.rules.DhBqiiRJiotlpI2…….’

You can create an authorization token in MainUI. Click on your name in the lower left corner.

---

<div class="post-metadata">

**Author:** ![daspid92](https://community.openhab.org/letter_avatar_proxy/v4/letter/d/ecb155/32.png) [@daspid92](https://community.openhab.org/u/daspid92)\
**Post date:** [November 30, 2024, 7:20pm UTC](https://community.openhab.org/t/webhook-http-binding/152184/8 "2024-11-30T19:20:35Z")

</div>

I’ve just configured a Custom Webhook on UniFi to  
[http://openhabip:8080/webhook/ef07c36f7b/scan](http://openhabip:8080/webhook/ef07c36f7b/scan)  
Where “scan” is a trigger channel I’ve added to the thing with expression:

```yaml
return "ON";

```

The thing is configured with Response expression:

```yaml
resp.status=200

```

Then I’ve created a rule with condition:  
When channel webhook:Webhook:ef07c36f7b:scan was triggered

---

<div class="post-metadata">

**Author:** ![bastler](https://community.openhab.org/user_avatar/community.openhab.org/bastler/32/78117_2.png) [@bastler](https://community.openhab.org/u/bastler)\
**Post date:** [July 8, 2025, 4:06pm UTC](https://community.openhab.org/t/webhook-http-binding/152184/9 "2025-07-08T16:06:13Z")

</div>

i am very happy with this binding because it enables me to communicate from my mobotix cameras to openhab (habapp).

i have it working with a thing created in mainui. my code here is:

```yaml
UID: webhook:Webhook:d74c46e691
label: Webhook thing
thingTypeUID: webhook:Webhook
configuration:
  expression: resp.status=200
channels:
  - id: lastCall
    channelTypeUID: webhook:lastCall-channel
    label: Last request
    description: Timestamp of the last request to the webhook.
    configuration: {}
  - id: mobotixTssPrivat
    channelTypeUID: webhook:trigger-channel
    label: Mobotix TSS-privat
    description: ""
    configuration:
      expression: req.parameters.mobotixTssPrivat[0];
  - id: mobotixTssHoftor
    channelTypeUID: webhook:trigger-channel
    label: Mobotix TSS-Hoftor
    configuration:
      expression: req.parameters.mobotixTssHoftor[0];

```

i would like to use this data in a things-file but i am lost. i tried several notations like eg:

```yaml
Thing webhook:Webhook:my_webhook "Webhook call" [
    id="my_webhook",
    expression="req.body"
    // expression="resp.status=200"
] {
    Channels:
    - id: mobotixTssPrivat
        channelTypeUID: webhook:trigger-channel
        label: Mobotix TSS-privat
        description: ""
        configuration:
            expression: req.parameters.mobotixTssPrivat[0];
    - id: mobotixTssHoftor
        channelTypeUID: webhook:trigger-channel
        label: Mobotix TSS-Hoftor
        description: ""
        configuration:
            expression: req.parameters.mobotixTssHoftor[0];
}

```

but the part with the `channels` gives me an error. could somebody please point me to the correct notation? thanks in advance.

---

<div class="post-metadata">

**Author:** ![scheuerer](https://community.openhab.org/user_avatar/community.openhab.org/scheuerer/32/47609_2.png) [@scheuerer](https://community.openhab.org/u/scheuerer)\
**Post date:** [December 23, 2025, 10:59am UTC](https://community.openhab.org/t/webhook-http-binding/152184/10 "2025-12-23T10:59:51Z")

</div>

Hello first of all, thanks for this binding.  
It brings my MyStorm Buttons to the possibly to use them by Openhab.  
I have installed them on OH 5.0.2 and it works perfect.

After I have upgraded from 5.0.2 to 5.0.3 I have have the need, to install the binding manual once again, because it was not there anymore.

The same happens now at the major update from 5.0.3 to 5.1.0-1

What can I do, that also the WebHook binding will be updated and installed automaticly?

Thanks  
Jochen

---

<div class="post-metadata">

**Author:** ![Oliver2](https://community.openhab.org/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@Oliver2](https://community.openhab.org/u/Oliver2)\
**Post date:** [December 23, 2025, 11:08am UTC](https://community.openhab.org/t/webhook-http-binding/152184/11 "2025-12-23T11:08:20Z")

</div>

I assume you have installed the addon through marketplace. By intention marketplace bindings are removed if their version number does not match to your openhab version.

You could create a rule which reinstalls the binding during start up or copy the binding to your addon folder.

---

<div class="post-metadata">

**Author:** ![scheuerer](https://community.openhab.org/user_avatar/community.openhab.org/scheuerer/32/47609_2.png) [@scheuerer](https://community.openhab.org/u/scheuerer)\
**Post date:** [December 23, 2025, 2:07pm UTC](https://community.openhab.org/t/webhook-http-binding/152184/12 "2025-12-23T14:07:19Z")

</div>

Thanks for this information. I was not aware, the bindings from the Marketplace will not be used, when an update happened.

---

<div class="post-metadata">

**Author:** ![sebastian-h](https://community.openhab.org/user_avatar/community.openhab.org/sebastian-h/32/73892_2.png) [@sebastian-h](https://community.openhab.org/u/sebastian-h)\
**Post date:** [October 7, 2026, 3:34pm UTC](https://community.openhab.org/t/webhook-http-binding/152184/13 "2026-10-07T15:34:43Z")

</div>

This is also for my mobotix doorcam.. during initial configuration within MainUI on OH 5.2.1, Addon installed through the UI, i see a Configuration option for “Response expression”.

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/7/9/794b480526624d4116b753f967e5b737094d7ff6.png)

Upon clicking either of the “buttons” to add an expression, the loaded “modal-window” is always empty. Whatever i type into the window is not persisted, its gone when the window is reopened.

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/e/3/e3310be2b7fde1de896292014a01e51cb5962013.png)

I had to add the option in “code” block, there named “expression” for the thing to come online initially.

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/5/b558b75581f5cdb8dee240f6a0aae45afc2d1e3d.png)
