I am using this function system.alarm.getShelvedPaths and even using the example code in the manual
However, it is returning usr:gateway-script as the user who shelved the alarm. I am getting the same result when when running it in a perspective session
Where/how are you shelving the alarms? The 'user' return value will depend on where the shelve operation happened - it is identifying the source as a gateway script calling system.alarm.shelve.
However, is there alternative way to get a Gateway context that one can direct me too instead of installing a module in the gateway as the link above instructs to do?
There's no supported way to do so statically; once you've reached to the context you are outside the boundaries of supported behavior.
I'm being deliberately obtuse in the linked post because doing things like this is subject to break between Ignition versions (even minor version changes), unlike the guarantees you get with our scripting functions.
That said, Nick has an example in lines 3 and 4 of his script here: