0

I am using Azure blockchain Service and I made a logic app to call a function inside a smart contract whenever a particular trigger occurs. While creating the logic app it asks me the argument with which I want to call the function. Now, I do not want to hard code the argument.

It is something like on my website, there are multiple products available, and whichever product the user chooses, the function should be called with the name of the product as the argument.

Raghav Arora
  • 148
  • 1
  • 14

1 Answers1

1

You have two options here

  1. HTTP triggered function and pass parameters using POST request
  2. Queue triggered function and pass parameters using Azure Storage Queue

In first case you simply create HTTP trigger

enter image description here

Body configured as

{
    "type": "object",
    "properties": {
        "product": {
            "type": "string"
        }
    }
}

This means logic app request expects JSON like this

{
    "product" : "abc"
}

This way you can use product from trigger

enter image description here

And use it as parameter for function call using either HTTP action

enter image description here

or Azure Function action

enter image description here

If you want to learn more about logic apps feel free to check my video intro on it https://youtu.be/ZvsOzji_8ow

If you are worried about publicly accessible webhooks for logic apps use Azure Storage Queue with Azure AD authentication or cover logic app with API management like described here https://marczak.io/posts/2019/08/secure-logic-app-with-api-management/

Adam Marczak
  • 2,257
  • 9
  • 20
  • This makes sense. I also realised that while using the Ethereum connector for a Logic app, the logic app is triggered whenever the ```emit event``` command is executed. And in that case, I can use the variables sent by event as parameters for the function call. I did not try the Http Request/Response logic app. Thanks. – Raghav Arora Aug 18 '19 at 06:17