I'm looking to build a Logic App workflow to connect to a REST API to GET a list of Products (retuned as JSON) from the Unleashed API ( https://apidocs.unleashedsoftware.com/AuthenticationHelp ).
I've prototyped the GET request in postmaan successfully generated the required HMAC-SHA256 encrypted method signature in the pre-request script. Now I need to find a way to do the same thing in my Logic Apps workflow.
Having figured out that the Logic Apps Inline Code component wouldn't give me anything but basic Javascript (no access to crypto functions), I thought of writing an Azure Function in node.js - node.js chosen primarily in order to be able to reuse my pre-request script code. Unfortunately, I'm getting absolutely nowhere with this - vertical learning curve doesn't quite cover it!
For one thing, isn't there some kind of inline trigger to allow me to access the function rather than having to send a HTTP request? And how do I populate the output bindings to get the hash value back?
My pre-request script is as follows
var urlParam = "modifiedSince2021-04-01";
var url = "https://api.unleashedsoftware.com/" + "Products?" + urlParam;
var hash = CryptoJS.HmacSHA256(urlParam, 'Customer API-KEY here');
var hash64 = CryptoJS.enc.Base64.stringify(hash);
pm.environment.set("BaseURI", url);
pm.environment.set("hmacKey", hash64);
Any help with constructing my node.js, or any other suggestions for turning this into a solution in Azure would be greatly appreciated.


