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
Related
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
I am trying to use Azure Logic Apps to read data from one of the Salesforce objects which has huge number of records. The Salesforce connector fetches the record and returns the pagination link as #odata.nextLink. But when I try to use a JSON parser to read the value it’s coming as null.
I tried to access the nextlink in a browser but it requires authentication. What authentication do we pass here ?
I would like to use an until action to iterate till I get a next link . So how do I check the condition for the until loop ?
nextLink doesn't look like core Salesforce thing, it might be the OData connector preprocessing the results for you. You'd have to consult the documentation for the connector (if any).
Salesforce's REST API will return field with nextRecordsUrl if there's next page of results, you'd call that in loop until the field disappears. You'd call it like any other REST API resource available after login, by passing Authorization: Bearer <sessionId also known as accessToken here>. Again - probably the connector abstracts this away from you. Don't think you can send headers like that in browser, you'd need curl, Postman, SoapUI or similar http client.
If you don't get better answer and documentation is scarce - consider using raw REST API. Or Azure Data Factory has an almost-decent Salesforce connector?
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm
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.
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
I am not able to make the azure generic webhook function work with
authlevel keys (function/host/anonymous etc.)
I created a generic webhook function. I understand it is by default protected with function key auth level - is this correct? In such case how to change the authlevel to Host or anonymous?
Next I am calling it from a request-response logic app flow. So I get a request, call the function and then respond back with the result from the function. From the code view of logic app I cannot see any function call that is taking the code and client as parameters. So my question is why is the function call not failing. Is this happening in anonymous mode? Or is there any way the logic app is calling the function with the appropriate parameters (code and clientid) which is not shown even in the code view? Perhaps I am missing some very basic thing - appreciate any help in this regard.
In such case how to change the authlevel to Host or anonymous?
When creating a generic webhook function, you could set the mode for your trigger and the Mode notes as follows:
The mode of the trigger. "Standard" means that the request will be standard HTTP with no additional semantics. "Webhook" means that the request will be processed according to a specified webhook type.
The authLevel property in function.json file does not apply to the WebHook triggers. To trigger a WebHook function the HTTP request must include an API key (e.g. https://<yourapp>.azurewebsites.net/api/<function>?code=<Host key or Function key>). You could choose your generic webhook function, choose your HTTP trigger, then click the Documentation link for more detailed tutorials about HTTP and webhook bindings.
Next I am calling it from a request-response logic app flow. So I get a request, call the function and then respond back with the result from the function.
Based on your scenario, I did the sample flow as follows:
You just need to choose your generic webhook function and logic app would handle the authorization for you. Moreover, the API keys are stored under D:\home\data\Functions\secrets folder, you could use kudu and find them in the host.json or <function-name>.json file. Also, here is a tutorial using PowerShell to access KUDU REST API for retrieving Azure Function key. Additionally, you could add your comment here.