# Permissions when creating a service

**URL:** <https://forum.webostv.developer.lge.com/t/permissions-when-creating-a-service/4189>\
**Category:** Web App Development\
**Created:** [October 20, 2023, 6:02am UTC](https://forum.webostv.developer.lge.com/t/permissions-when-creating-a-service/4189 "2023-10-20T06:02:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![thebogeyman](https://avatars.discourse-cdn.com/v4/letter/t/f17d59/32.png) [@thebogeyman](https://forum.webostv.developer.lge.com/u/thebogeyman)\
**Post date:** [October 20, 2023, 6:02am UTC](https://forum.webostv.developer.lge.com/t/permissions-when-creating-a-service/4189/1 "2023-10-20T06:02:39Z")

</div>

Hi,  
  
I created a simple JS service that sends an HTTP GET request and looks like this:

```auto
var config = require('./config.json');
var Service = require('webos-service');
var service = new Service("com.ha.webhook.service");
const http = require('http');

const url = `http://${config.ha_url}/api/webhook/`;

service.register("webhook", function (message) {
    var id = message.payload.id;
    http.get(url + id);
    message.respond({
        returnValue: true,
        data: url + id,
    });
});

```

When I try to run this service using a helper WebApp, I get the following log entries:

```auto
[18:52:37.257][WARNING] ls-hubd LSHUB_NO_NAME_PERMS Can not find match for 'com.ha.webhook.service' in pattern queue '["com.webos.service.*", "com.webos.service.*", "com.webos.*", "com.palm.service.*", "com.palm.*", "com.palm.*", "com.lge.*", "com.lge.*", "airplay.service"]' {}
[18:52:37.257][ERR] ls-hubd LSHUB_NO_OUT_PERMS "com.webos.surfacemanager" does not have sufficient outbound permissions to communicate with "com.ha.webhook.service" (cmdline: /usr/bin/surface-manager -platform starfish) {"DEST_APP_ID":"com.ha.webhook.service","SRC_APP_ID":"com.webos.surfacemanager","EXE":"/usr/bin/surface-manager","PID":1853}
[18:52:37.257][WARNING] ls-hubd LSHUB_NO_SERVICE _LSHubSendQueryNameReplyMessage: Failed Connecting to Service err_code: -2, service_name: "com.ha.webhook.service", unique_name: "(null)", static, fd -1 {}
[18:52:37.260][INFO] VOICEFW VOICEUI_FOREGROUND foreground changed {"foreground":"com.webos.app.hdmi1"}
[18:52:37.262][WARNING] surface-manager LSM Hub error detected for token: 724 "webhook" "PermissionDenied" {}
[18:52:37.262][WARNING] surface-manager LSM Error response for token: 724 -1 "Not permitted to send to com.ha.webhook.service." {}

```

I tells me that my service name must match any of these patterns:

```auto
["com.webos.service.*", "com.webos.service.*", "com.webos.*", "com.palm.service.*", "com.palm.*", "com.palm.*", "com.lge.*", "com.lge.*", "airplay.service"]

```

So I tried to change my service name to `com.webos.ha.service` so that it fits the proposed patterns.  
  
Unfortunately, this does not work and I get the following errors:

```auto
ares-install ERR! [com.webos.appInstallService failure]: luna-send command failed <Cannnot install privileged app on developer mode>
ares-install ERR! [Tips]: Please change the app id (app id should not start with 'com.lge', 'com.webos', 'com.palm')

```

So I experimented a bit and the only name that worked for me was `com.webos`.  
And to be honest, I think this is a bug because based on the error message above, this name shouldn’t work either.  
  
Therefore my question: Is there a way to take a freely chosen service name and fix the original permission problem?

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [October 23, 2023, 6:07am UTC](https://forum.webostv.developer.lge.com/t/permissions-when-creating-a-service/4189/2 "2023-10-23T06:07:54Z")

</div>

The service name must begin with the app name. If your service name is com.ha.webhook.service, the app name must be com.ha.webhook. For more information, please refer to [JS Service Usage](https://webostv.developer.lge.com/develop/guides/js-service-usage) and [Hello World Service](https://github.com/webOS-TV-app-samples/HelloWorldService) sample app. Thank you.

---

<div class="post-metadata">

**Author:** ![thebogeyman](https://avatars.discourse-cdn.com/v4/letter/t/f17d59/32.png) [@thebogeyman](https://forum.webostv.developer.lge.com/u/thebogeyman)\
**Post date:** [October 23, 2023, 2:11pm UTC](https://forum.webostv.developer.lge.com/t/permissions-when-creating-a-service/4189/3 "2023-10-23T14:11:27Z")

</div>

Yes, I know that and that’s what I did.  
But then I still get the following error when calling the service:  
  
`[18:52:37.257][ERR] ls-hubd LSHUB_NO_OUT_PERMS "com.webos.surfacemanager" does not have sufficient outbound permissions to communicate with "com.ha.webhook.service" (cmdline: /usr/bin/surface-manager -platform starfish) {"DEST_APP_ID":"com.ha.webhook.service","SRC_APP_ID":"com.webos.surfacemanager","EXE":"/usr/bin/surface-manager","PID":1853}`

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [October 24, 2023, 12:37am UTC](https://forum.webostv.developer.lge.com/t/permissions-when-creating-a-service/4189/4 "2023-10-24T00:37:15Z")

</div>

com.ha.webhook.service cannot communicate with com.webos.surfacemanager. As we said, it should be com.ha.webhook. And we do not guarantee the compatibility of webOS TV apps with webOS OSE resources. For webOS TV apps, please use webOS TV resources in this website only. Thank you.

---

<div class="post-metadata">

**Author:** ![thebogeyman](https://avatars.discourse-cdn.com/v4/letter/t/f17d59/32.png) [@thebogeyman](https://forum.webostv.developer.lge.com/u/thebogeyman)\
**Post date:** [October 29, 2023, 7:14am UTC](https://forum.webostv.developer.lge.com/t/permissions-when-creating-a-service/4189/5 "2023-10-29T07:14:10Z")

</div>

I have to add or correct something.  
I have now adjusted the service name again to `com.ha.webhook.service` (and the app name accordingly to `com.ha.webhook`) and calling the service from the app and via `ares-shell` works perfectly.  
  
I only get the above error message when I call the service from a notification, which I create via Home Assistant with the command `system.notifications/createAlert`.

 ![34940adc9c583eb9c014fe8ebc7335ac01418924_2_999x750](https://canada1.discourse-cdn.com/flex030/uploads/webostv/original/1X/f6acdcdbcbd224ec5dace72077777f2ffbc9292c.jpeg)  
  
When I click on the first button, I call up `luna://com.ha.webhook.service/webhook`.  
Only then do I get the error:  
  
`ls-hubd LSHUB_NO_OUT_PERMS "com.webos.surfacemanager" does not have sufficient outbound permissions to communicate with "com.ha.webhook.service" (cmdline: /usr/bin/surface-manager -platform starfish) {"DEST_APP_ID":" com.ha.webhook.service","SRC_APP_ID":"com.webos.surfacemanager","EXE":"/usr/bin/surface-manager","PID":1853}`

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [October 29, 2023, 11:24pm UTC](https://forum.webostv.developer.lge.com/t/permissions-when-creating-a-service/4189/6 "2023-10-29T23:24:13Z")

</div>

As we said above, we do not guarantee the compatibility of webOS TV apps with webOS OSE resources. Please do not use the webOS OSE API in your webOS TV app. Thank you.

---

<div class="post-metadata">

**Author:** ![thebogeyman](https://avatars.discourse-cdn.com/v4/letter/t/f17d59/32.png) [@thebogeyman](https://forum.webostv.developer.lge.com/u/thebogeyman)\
**Post date:** [October 30, 2023, 6:27am UTC](https://forum.webostv.developer.lge.com/t/permissions-when-creating-a-service/4189/7 "2023-10-30T06:27:03Z")

</div>

I just don’t understand which part of my code is a webOS OSE resource.  
It must then probably be the `require('http')` because the rest of the code is exactly the same as in the linked Hello World Service, which I used as a template.  
If that is the case, how can I call an HTTP GET via webOS?  
  
Or is it the use of the Luna Service API when I try to call the service?  
But that’s also part of the webOS developer site: [Luna Service API Introduction | webOS TV Developer](https://webostv.developer.lge.com/develop/references/luna-service-introduction) and [JS Service Usage | webOS TV Developer](https://webostv.developer.lge.com/develop/guides/js-service-usage#calling-services-from-another-service)

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [October 31, 2023, 12:03am UTC](https://forum.webostv.developer.lge.com/t/permissions-when-creating-a-service/4189/8 "2023-10-31T00:03:14Z")

</div>

Currently, we do not provide notification-related APIs. So if you only use the webOS TV API, you won’t get any notifications. We are not sure exactly what Home Assistant and system.notifications/createAlert are, but we are guessing they are using webOS OSE APIs like com.webos.notification somewhere. For further questions, please contact Home Assistant support. Thank you.
