# Need help with webhook/web api

**URL:** <https://community.homey.app/t/need-help-with-webhook-web-api/97792>\
**Category:** Developers\
**Tags:** app\
**Created:** [December 13, 2023, 9:54pm UTC](https://community.homey.app/t/need-help-with-webhook-web-api/97792 "2023-12-13T21:54:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bazeloth](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bazeloth/32/79224_2.png) [@Bazeloth](https://community.homey.app/u/Bazeloth)\
**Post date:** [December 13, 2023, 9:54pm UTC](https://community.homey.app/t/need-help-with-webhook-web-api/97792/1 "2023-12-13T21:54:05Z")

</div>

Im writing an app for the aqara fp2 sensor. In order to receive device events i need to configure the following in the aqara developer dashboard:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/2/d261432be9010d6d7b8ba79be982ab5baeae5a9c.png)

As you can see i need a public endpoint where i can alter the response. I need to return { code: 0 } as the body response.

**What i’ve tried:**

- Webhooks can’t return a response (only receive them).
- Web API is a thing, but how do i get the public http address that points to my homey api endpoint? ofcourse the route is set to public because Aqara doesnt grant a proper bearer token

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [December 14, 2023, 4:14am UTC](https://community.homey.app/t/need-help-with-webhook-web-api/97792/2 "2023-12-14T04:14:40Z")

</div>

Might be relevant, there’s an app for the FP2 already:

> [@\[APP\]\[Pro\] HomeKit Controller - for a better Homey](https://community.homey.app/t/app-pro-homekit-controller-for-a-better-homey/94520):
>
> Project started as a way to include the Aqara FP2-sensor via Homekit into Homey. App is now more generic, many services and capabilities are supported. If you encounter problems, please PM me a short note and a copy of the log where you add the device. Generic procedure to add a device. Add your Homekit capable device to the app that came with the device and configure it. If added with iOS device, remove the device from the iOS Home app, a device only can have one controller. Most of the tim…

When you just like to build an app for it anyways, please ignore my reply 😉

Also, Adrian tried the way you seems to want to go already:

> [@Aqara FP2, mmWave presence detection on WiFi](https://community.homey.app/t/aqara-fp2-mmwave-presence-detection-on-wifi/76955/193):
>
> here is currently no way to connect locally to the FP2, so the only option is via their cloud API, which is a complete mess.

---

<div class="post-metadata">

**Author:** ![Bazeloth](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bazeloth/32/79224_2.png) [@Bazeloth](https://community.homey.app/u/Bazeloth)\
**Post date:** [December 14, 2023, 1:52pm UTC](https://community.homey.app/t/need-help-with-webhook-web-api/97792/3 "2023-12-14T13:52:50Z")

</div>

I know about the HomeKit controller app. I’m trying to make something similar as it’s buggy as hell and i’d like a challenge to make one myself.

I know Adrian has tried it before, but gave up. Their cloud API may be a mess, but with a public endpoint it can still be feasible. I just need to know if it’s possible with Homey to have something like a webhook where you can reply with a custom response; in my case a code 0 json response.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [December 15, 2023, 7:07am UTC](https://community.homey.app/t/need-help-with-webhook-web-api/97792/4 "2023-12-15T07:07:17Z")

</div>

> [@Bazeloth](#):
>
> I just need to know if it’s possible with Homey to have something like a webhook where you can reply with a custom response

No, that’s the roadblock that @Adrian_Rockall ran into as well AFAIK.

But it should be possible to use a Web API endpoint that’s marked as public, and from what I remember those won’t require a token or anything.

The external hostname would be `https://CLOUDID.connect.athom.com`, and the cloud id can be retrieved using [`this.homey.cloud.getHomeyId()`](https://apps-sdk-v3.developer.homey.app/ManagerCloud.html#getHomeyId)

---

<div class="post-metadata">

**Author:** ![Bazeloth](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bazeloth/32/79224_2.png) [@Bazeloth](https://community.homey.app/u/Bazeloth)\
**Post date:** [December 15, 2023, 8:03am UTC](https://community.homey.app/t/need-help-with-webhook-web-api/97792/5 "2023-12-15T08:03:12Z")

</div>

If that’s the case i’m wondering how the HomeKit Controller app tries to achieve this then. Unless they have a separate rabbit mq server hosted somewhere and route traffic to the respective Homey’s i dont see this working.

I suppose i’ll have to contact Athom about this.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [December 15, 2023, 8:06am UTC](https://community.homey.app/t/need-help-with-webhook-web-api/97792/6 "2023-12-15T08:06:02Z")

</div>

> [@Bazeloth](#):
>
> i’m wondering how the HomeKit Controller app tries to achieve this then

It uses the HomeKit protocol to communicate with the FP2, not the Aqara cloud API.

---

<div class="post-metadata">

**Author:** ![Adrian\_Rockall](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/adrian_rockall/32/13209_2.png) [@Adrian\_Rockall](https://community.homey.app/u/Adrian_Rockall)\
**Post date:** [December 15, 2023, 8:06am UTC](https://community.homey.app/t/need-help-with-webhook-web-api/97792/7 "2023-12-15T08:06:22Z")

</div>

Homekit is all local.

---

<div class="post-metadata">

**Author:** ![Bazeloth](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bazeloth/32/79224_2.png) [@Bazeloth](https://community.homey.app/u/Bazeloth)\
**Post date:** [December 15, 2023, 8:33am UTC](https://community.homey.app/t/need-help-with-webhook-web-api/97792/8 "2023-12-15T08:33:43Z")

</div>

I didnt realize HomeKit could be used to communicate with Homey as its not an iOS device like an iphone, ipad or a mac. How does that work? Im asking because i added my fp2 using the HomeKit Controller app, but i didnt have to specify an apple id or anything; only a code that’s on the fp2 itself.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [December 15, 2023, 9:32am UTC](https://community.homey.app/t/need-help-with-webhook-web-api/97792/9 "2023-12-15T09:32:26Z")

</div>

> [@Bazeloth](#):
>
> How does that work?

HomeKit is a fairly open protocol so if you implement the controller part of it you can communicate with devices that support HomeKit. Those devices basically think they are talking to an iDevice.

Since it’s all 100% local, there is no need to use an Apple ID. In fact, you don’t need any Apple devices for it to work.
