How to make 3rd party api call in dialogflow's inline editor - node.js

How to make 3rd party api call in dialogflow using inline editor please share if you have some code regarding this.
Thank you

You cannot make external network requests (for example an API call) from the inline editor. You need to deploy your code elsewhere. The easiest way to do this is by deploying to a paid Firebase plan. From Google:
Network calls originating from your Cloud Function for Firebase to destinations outside Google's network require billing to be enabled for the underlying Google Cloud or Firebase project.

You can create an API with the technology that you want, as long as the response from the API can be understand by Dialogflow.
You need to configure it by going to Fulfillment, and point it to your API.
The API needs to respond with this structure: Dialogflow.
And If you plan to integrate with Actions on Google, you have this repository which includes some examples of responses.
And here you have some libraries to interact with Dialogflow with different languages.

Related

What is Direct Line in Azure?

I am starting to develop a bot for Teams and I do not understand the various channel offerings. I know I need to add Microsoft Teams to the channel list in Azure for the bot to be able to message people through chat channels, but I can't figure out how to allow the bot to communicate with an API that is hosted in AWS. Maybe Direct Line is what I'm supposed to use, but the documentation is very unclear. Here is what I can find about Direct Line:
Direct Line. This is the standard channel offering of Direct Line. It works by default with bot templates via the Azure portal, bots from the Bot Builder Samples, and bots created with the Azure CLI. This is the Direct Line best suited in the majority of the cases. See Connect a bot to Direct Line.
If anything, I became more confused after reading that. It raises more questions than it answered. If Direct Line is supposed to allow me to communicate with third-party APIs, I don't know how to get started even if I enable it. The BotBuilder repository documentation does not mention Direct Line channels, at least not in an obvious way, so that hasn't been much help either.
I have very little clue about how this works even though I spent my whole day reading about it. Deploying a bot to Teams that can make a call to another API is much more difficult than I anticipated. All I want to do is say #bot command and have it call an API to make a GET request. Once I am able to do that, I will be able to develop the rest of the application, but using the requests module in Python has not worked and I don't know why.
Anything you can offer about how this should work would be greatly appreciated.
Direct Line, as the name implies, is a direct line of communication to an Azure bot. Essentially, it is a set of APIs that you can use to communicate with an Azure Bot outside the set of provided channels. If you are building a custom application that none of the other channels such as Web Chat, Teams, Email, etc. would be appropriate for, then you can use the Direct Line API to send and receive messages to and from a hosted bot with REST calls. The API reference in the documentation explains how to connect to and use Direct Line. You would implement these calls into your application as you would calls to any other REST API and display the responses in whatever manner fits your use case.
The key intuition here is that Direct Line is only for communicating with the bot. It has nothing to do with connecting to outside services. Communicating with 3rd party services would be accomplished in the same manner as any other application. I don't know how you've implemented your application or what service you're connecting to, but I would suggest you double check that your calls to that service work outside your bot using Postman or curl before attempting to implement them into the bot.
Your use case would appear to be the Microsoft Teams channel, and not Direct Line.
I'm not totally clear either on what Direct Line is for, but from what I can understand it would be if you want to include a bot experience in your own custom app, like a desktop app with a "chat" feature. It's definitely not needed for Teams though - you only need the Teams channel.
With regards calling an API from within your bot, essentially your bot is just a standard web service - it can do anything any other kind of web service / web api can do, e.g. calling a 3rd party API.

Does Google Actions Support Websockets?

I am trying to build a Rocket Chat Google Action and one of the major advantage of RC is it's Realtime API's however they require Websocket to get access. I know that Dialogflow can be used for Websocket's but does Google Actions support it?
I am using Dialogflow along with Firebase as backend for my Action.
Actions on Google is a platform for stateless applications running through a REST API call. In this model, the user sends one request to your server and they get back one response.
Actions on Google itself doesn't support web sockets, but you are able to define a cloud function like Firebase to do advanced fulfillment. While you may be able to get web sockets to work in your function, you'd still need to adjust the Action's conversational flow to work in a request/response fashion instead of listening to web sockets continually.

Can Amazon Pinpoint Monetization events be created via the REST API?

I'm investigating Amazon Pinpoint as an SMS campaign engine which we would integrate via the REST APIs.
Having reviewed the documentation about Monetization events, they are only discussed in the context of iOS/Android SDKs or the JavaScript SDK.
https://docs.aws.amazon.com/mobileanalytics/latest/ug/defining-a-monetization-event-sdk.html
The REST API documentation does not specifically mention Monetization events.
https://docs.aws.amazon.com/pinpoint/latest/apireference/rest-api-events.html#rest-api-events-attributes-eventsrequest-table
Is it possible to use the REST API to create a monetization event? If possible, I'm assuming it is a particular value of EventType which I need to use for a monetisation event but this is not documented anywhere.
Thanks!
Michael

How to create a custom webhook in Dialogflow based on Azure?

So I would like to implement Dialogflow fulfilliment using a custom node.js webhook. I've created a node.js app in Azure (I have my own .azurewebsites.net site), however I'm not quite sure how to link it to Dialogflow. How do I do this? Thank you.
On the dialog flow side Go to dashboard and click on fulfillment on side bar provide the web hook and basic authentication and headers.
On nodeJs make sure you provide POST Webhook API where dialogflow app sends requests.
Are you familiar with Express or any other framework to create REST APIs with Node?
There are tons of material on the web, but this is a starting point if you like.
In this link you'll find the documentation that shows which fields will be posted to your endpoint and those that you'll want to send back to Dialogflow.

ChatBot QnaMaker(Microsoft Azure) vs Lex (Amazon AWS)

Looking to make a chatbot on either Microsoft QnaMaker or Lex.
I would like to be able to make API calls to request answer to the question (node.js), train the bot using the API.
Currently I am using QnaMaker but unfortunately it doesn't seem to have response cards where user can click on it.
I know that Amaazon Lex allows this but do they allow training of bot through API?
Yes, you can make intents, put utterances and slots using the API's.
Lex support two types of API's - Model Building API and Runtime API. What you need is Model Building API.
As you are working with node.js, you should be referring this page and read more and more about putIntent() method.
Hope it helps.

Resources