How to Redirect to an MVC web app controller from azure logic app - azure

I am using azure logic app which consumes a web API via a connector and based on some condition, I want to send some data to a controller of my web application.
any ideas how this can be done ?

You can use an HTTP action in your Logic App to send data to a specific endpoint:
As you can see you're also able to add dynamic content to the body you would like to send.
For more information, check Get started with the HTTP action.

I would say don't over think this too much. It's a pretty basic process.
Get the response form your API.
Extract the values you need to test for the condition
Test the values in a Condition Action
Call the end points based on each Condition.

Related

Response from `InvokeRESTAPI` on my Azure pipeline

My InvokeRESTAPI displays the following if executed:
I can see a Response field printed that is empty.
Can I somehow use this to get a value back from the API reply and use it to call another template with it?
On the task itself I am using this parameter:
successCriteria: eq(root["status"], "successful")
So I would assume that if there is some custom success criterion then I would be able to use a value from the response in order to define it.
Based on your screenshot, you are using the API to post the json content to Azure Logic App workflow.
So you need to add the Response Action in Azure Logic App to add response content to the work flow.
Here are the steps:
In Logic App:
Then when you run the API in Invoke Rest API task, it will show the customer response.
For more detailed info, you could refer to this doc: Construct the response

How to determine which app in web connector is calling the web service?

I have created a webservice by implementing the web connector callback methods and I have 2 apps running in webconnector for 2 usecases: invoices and customers.
I want to determine which app is triggering my web service so that I can decide whether to push customers or invoices to QB. How do I do it? I was hoping to do it through 'AppID' field but its not returned in every SendRequestXML call. In fact, not even in the first SendRequestXML call. Has anyone implemented these scenarious?
If you have two apps in the Web Connector, then each app should be using a different username, and pointing to a different URL.
If they're using the same URL or the same username... then you did something wrong and you should fix your implementation.
With that said... it sounds like you have sort of a wonky implementation anyway. Why do you have two apps for two different use-cases? Why not just send BOTH customers and invoices through the same app...?

custom input & output fields for azure function

I am not sure if this is an option. I require it badly, and cannot find any references of it.
When integrating between an HTTP Triggered Azure Function within your Logic App flow, you are requested to pass a body object for the function to digest:
I am hoping for a way to customize the Request Body inputs, to make it have a strict template structure, in and out.
In:
Out:
(The function returns an Object)
Is there any way I can achieve this?
You could create a Logic Apps Custom Connector.
You can create one of these from a Postman collection or using an OpenAPI definition. You can get hold of the OpenAPI definition from the Function App.
With a custom connector, you have a bit more control over the request and response. This will allow the users of your connector to provide inputs when used in a Logic App and also receive tokens from the response. These can then be used in further Logic App steps.
Just hard coded it to the fields I require it using the Logic App syntax and it responds to satisfaction
#{body('function-name')?['property']}
Haven't tried the Custom Connector

Azure Logic App - Simple Email Template for JSON Request Body

I've got a simple Azure Logic App, which receives and emails out JSON data in a very basic HTML table format (created with a convertToTableAction).
Does anyone know of a way to instead send this out using an email template?
I've got a SendGrid account set up with my Azure subscription, but there doesn't seem to be any way to specify a template id with the Send email (v2) action in Logic apps.
I can't quite see how I'd edit the Logic App code to use the only SendGrid api that seems to support sending templates V3 either. (It is my first Logic app though, so I could well be missing a trick)
Really, any advice on how to send out a templated email would be appreciated.
As you mentioned that the logic app integrate the Sendgrid(V2) currently. You could give your feedback to Azure team.
If azure function is acceptable, you could add and run custom code for logic apps through Azure Functions
there is two way to do it ..
1) Using SendGrid Connector :
You need to create one azure function or web API pass request as your JSON outout string and replace with html content and get html in response
Pass html response in body of the send email action of SendGrid Connector
Details of SendGrid Connector
Please refer this link for Json data replaced to html
my explanation is very short but if you don't understand then i will help you in details

How to make an Approval step in Azure Logic app calling my own APIs similar to office365 approval connector?

I wanna build a small workflow using Azure Logic Apps that contains an "Approval" step, which is simply an API call in my own system, similar to office 365 approval connector.
However, from what I found on the internet, the only way to make a long running task in Azure Logic Apps is to use Webhooks.
In Webhooks, I could not set a value to the parameter I created "Bool-Approved".. so, How can I check it later in a condition step?
The other possible solution maybe is to use Swagger to have an "Bool-Approved" parameter. However, it does not support long running action!
What's the possible solution for me?
As you mentioned, the way to do it is to use the Webhook action, and for that you need to implement the Subscribe/Unsubscribe pattern described here. The webhook action will allow you to get any payload (via an HTTP Post) from the instance-based webhook you are subscribing to.
The points below are a summary of this blog post:
https://www.mexia.com.au/correlation-identifier-pattern-on-logic-apps/
To implement the Subscribe/Unsubscribe Webhook pattern you need to consider:
Subscription store: A database to store the unique message Id and the
instance-based callback URL provided by the webhook action.
Subscribe and Start Request Processing API: this is a RESTful API that is in charge of starting the processing of the request and storing the
subscription.
Unsubscribe and Stop Request Processing API: this is another RESTful API that is only going to be called if the webhook action on the main workflow times out. This API is in charge of stopping the processing and deleting the subscription from the store.
Instance-based webhook: this webhook is to be triggered by your own custom approval event. Once triggered, your webhook is in charge of getting the instance-based callback URL from the store and invoking it. After making the call back to the main workflow instance, the subscription is to be deleted. This is the webhook that is in charge of sending the payload you require to the waiting webhook action in your Logic App.
The subsequent actions will be able to use that response body, so you can implement your conditions, etc.
You can follow the blog post mentioned above to see a detailed example and get more details on how to implement it.
make you api return HTTP code 200 if the response if "ok" and 400 if the response is "not ok". This way you can force logic app to behave the way you need it to behave..

Resources