Can API.AI take input other than JSON? - dialogflow-es

I'm new in Dialogflow and I have a report in the XML format, which is generated from my internal application. I want to use that XML file data as an input for my Agent (created in Dialogflow). Is it possible?

Yes, this is possible. What you would do in your fulfillment webhook is something like the following:
Determine which Intent was called and any parameters you may need to make the call to your internal application.
Call your internal application using REST or something similar. If you're using something like node.js, you'll need to do this as an asynchronous function with Promises.
When you get the results back, present them as part of your response.

Related

Serving a HTTP request response as a dialog response - Composer Framework

We are developing a chatbot to handle internal and external processes for a local authority. We are trying to display contact information for a particular service from our api endpoint. The HTTP request is successful and delivers, in part, exactly what we want but there's still some unnecessary noise we can't exclude.
We specifically just want the text out of the response ("Response").
Logically, it was thought all we need to do is drill down into ${dialog.api_response.content.Response} but that fails the HTTP request and ${x.content} returns successful but includes Tags, response and the fields within 1.
Is there something simple we've missed using composer to access what we're after or do we need to change the way our endpoint is responding 2? Unfortunately the MS documentation for FrwrkComp is lacking to say the very least.
n.b. The response is currently set up as a (syntactically) SSML response, this is just a test case using an existing resource.
Response in the Emulator
Snippet from FwrkComp
Turns out it was the first thing I tried just syntactically correct. For the case of the code given it was as simple as:
${dialog.api_response.content[0].Response}

Using Azure functions output in an HTML file

I use my Azure function to return a certain output after passing an HTML trigger. The webpage prints out basic output, like Hello {name}.
I would like to pass this output into an HTML file and display it via a separate HTML file. Essentially, I want to extract what my helloworld.azureapp.com?name={name} returns and push it into a JS variable in an HTML file.
How would I do this?
Note that the Azure function is written in Python.
If I understand correctly, what you're looking for is to make your web application send a GET request to your azure function endpoint and store the response you get back in a javascript variable.
You should treat the responses from an Azure function HTTP trigger just like any standard response from any API.
Instead of writing all js code in native HTML files, it is recommended you pick a simple web application framework.
For python, you can try Django or Flask (introductory tutorials here).
The code that calls your Azure function endpoint helloworld.azureapp.com?name={name}
could be in your web application (using the requests module in python). Tutorial on how to make web requests in python here.
Once you get back the response for that request, you can do further processing with the values you get back.
Depending on your web application framework, you could do many things.
Some of them are:
Save it in a hidden field and get value in JavaScript.
Render the received values to element in page on server side and show it.

Azure Remote Monitoring - How to add parameters to CloudToDeviceMethods?

In Azure Remote Monitoring, you can create your own CloudToDeviceMethods. How do you add parameters to those methods?
Usually those methods look like this:
function main(context, previousState, previousProperties) { ... }
...in a .js file that has the name of a specific method. But I don't see how I can add parameters to a method like that. I also want to see those parameters in the Azure Remote Monitoring Solution Accelerator web, so I can call that method and send in some parameters.
A CloudToDeviceMethod supports exactly one parameter, and that is the JSON payload that you can give to it. Of course you can add many properties to that payload to act like separate parameters. On the device side, reading that parameter looks like this in C# and like this in JavaScript (Node example)
You mentioned that you want to be able to add those parameters in the Remote Monitoring Solution Accelerator. This is entirely possible with some changes to the ReactJS code. The main files you need to look at are the Job page, right now it calls the device method without a body. Eventually the request is built here, you can see the JsonPayload is left empty.

Pass parameters from C# function app to another Javascript function app in Azure

I need to set up an application in Azure and make communicate 2 functions (one written in C# and one written in JavaScript).
The C# fragment consists in analyzing a XML feed, get the data and save in objects then finally send them to the other JavaScript function by parameter.
I did read that we could establish communication between both functions using HTTP calls but is it possible to do it with parameters ?
If not, would have any suggestions in order to achieve something like this properly? I'm getting started with Azure and i don't have enough visibility to know what is recommened in such a situation
Thank you for your advices
Yes, this is absolutely possible. How you do this is up to you. If you look at the default HTTP trigger templates, you can see that they take parameters (for example, as query string parameters). You can find more examples in the HTTP and webhook recipes documentation.
You can use other trigger types for cross-function communication as well. Take a look at this documentation for related best practices: https://learn.microsoft.com/en-us/azure/azure-functions/functions-best-practices#cross-function-communication

Generating object structure from SOAP WSDL

I need to call a SOAP service and I'm having trouble comming up with the correct input parameters for a call. I inspect the WSDL and it seems - to me - like the nesting for the input goes deep (looks like I have to send a very complex data structure to get a result).
I was thinking, isn't there a program or a way i can have the WSDL parsed and display the object structure? It's for a nodejs project, so i can't just import the WSDL and have Java generate the objects. If i could somehow get type completion in my editor VSC, that would be great, but i just need some way to display the hieraki.
Would importing the WSDL into a testing tool like soapUI get you what you are looking for? You could then see the structure of all of the requests expected by the web service endpoint.

Resources