Is there an issue access rules from smartapps

I am not getting any returnedl

I have some simple code

const Locations = await context.api.locations.list();
const Location = Locations[0];
console.log( " LocationID returned " + Location.locationId);
const Rules = await context.api.rules.list(Location.locationId);
if (!Rules) console.log(“No rules returned”);;

My smart app has permissions
.permissions([“r:devices:", "r:locations:”, “w:rules:*”])

I have rules

1 Fountain Rules 17ef0864-b44a-4ea0-a49e-fdc4fd7bb4e9 fd64e95a-22a4-4b70-83b2-2c8a9561278c Home
2 Relay Rules 6a8c25bf-0da0-4f96-b3b0-ea38797adc32 fd64e95a-22a4-4b70-83b2-2c8a9561278c Home

(The locationID is consistent)

One thought is the lack of read permission for Rules.

The other is that I’m unclear if the scope is the same when using a SmartApp token. Certainly Rules created in apps in Glitch only appeared in the app they were created by, but that was a long time ago.

sigh I did try that…,…

Can I try anything to check this?
Wait…I guess I could try creating a rule in the app and seeing if it is returned

Ok…this is interesting.
So the rules I created using the REST API do not show up
The rules created by the app do show up.

Oh and vice versa as well.
The REST API rules do not show the rules created in the App…


What does this mean???

@nayelyz Any thoughts?

1 Like

I thought I was remembering it right. I don’t find it particularly remarkable as WebHook Endpoint apps are largely used for automations and I’d expect them to manage their own private set of Rules. They aren’t really acting as ‘me’, they are acting as themselves. Well I know what I mean, I just can’t express it.

mmmmh. Ok So if I create a load of rules in a smartapp, they will execute but not be visible or be manageable anywhere else. They will somehow count against my automations limit??

Would be nice for an engineer to provide some context around this design decision

The documentation suggest that there is a limit of 100 Rules for ‘User’ and 50 Rules for ‘ISA’. I suppose ISA could mean installed Smart App or something like that which might suggest each instance of an app has a limit. Whatever they mean it makes you wonder where the 200 Routines limit materialised from.

1 Like

Hi, there!
The Rules listed will depend on the token type used to create them. This means, those created using a PAT won’t appear using a SmartApp token, etc.

Ok Thanks for the answer