Images can be received as input in Dialogflow Chatbot? - dialogflow-es

i have a Use Case where i need to receive image as input from user in dialogflow chatbot. This images is require to send in webhook request to rest end point as fulfillment.
I couldn't find anything which resembles to my requirement and also not sure whether it is supported in dialogflow or not.
Thanks in advance!

Dialogflow cannot take an image as input and map it to an intent directly. However, what you can do is process that image and send some text to dialogflow which will trigger specific intent and then proceed to perform the desired action.
You need to have a bridge between your user agent and Dialogflow, which will handle all the text/image request. It will do all the pre-processing and then call Dialogflow.
In this way, you need to send message to the messenger user using it's API's and call dialogflow using API/SDK as well.
Hope it helps.

Related

Triggering next intent without user input in Dialogflow

I'm building my first chatbot using Dialogflow. During my chat sessions, I would like to move on from one intent to another, without having user input in between. This can be seen in this image on Imgur.
The layout of the chat so far can be seen here.
I'm supposed to move from showing the video or article directly to "allright has your car..." without any user input, but I don't seem to be able to. How do I solve this?
I've tried using in and output contexts, but that didn't seem to work.
Thanks in advance!
Events can be triggered through Dialogflow fulfillment or the
detect intent API. These events can be handled in your Dialogflow agent or in fulfillment.
Check documentation here: Dialogflow Events
This means you will need to programmatically do this

Act on non-text telegram messages in Google Dialogflow. Fallback intent should forward everything

I'm building a chatbot with Telegram and Google Dialogflow. When I integrate Dialogflow into Telegram via the Dialogflow "Integrations" tab, Dialogflow registers as a Webbhook service to intercept all received Telegram messages. Unfortunately, I cannot act on non-text messages like stickers, images and Telegram payment checkout messages.
I wish Dialogflow would forward all the received messages to my custom fulfillment webhook in the Fallback intent. In my webhook, I would be able to parse the received body and act on the unsupported telegram messages accordingly.
I know that there is a FACEBOOK_MEDIA event in Dialogflow. This event is fired when an image is sent via a Facebook messenger to Dialogflow. Is there something like a TELEGRAM_MEDIA or even a TELEGRAM_UNSUPPORTED event available?
I would really like to be able to act on more than just text messages in Dialogflow.
Do I need to add another layer between Telegram and Dialogflow to be able to act on all Telegram messages?
What I have analyzed so far:
I forward all Google Dialogflow interaction logs to Google Cloud stackdriver. It seems as if non-text messages are completely ignored by Dialogflow. I see no log entry at all when I send a non-text message to my telegram bot. On the other hand, when I send a text, the log and its JSON payload appears immediately in the stackdriver.
I created a fallback intent in Dialogflow and enabled "Enable webhook call for this intent" in the Fulfillment section. Unfortunately, my fulfillment function doesn't fire on any non-text events. Dialogflow blocks it in the first place.
For future reference, I will try to give a possible, but not an out-of-the-box solution to my own question. If someone has a better solution, this would be great.
It seems to me, that at the moment of writing this, a full interaction experience is only possible by implementing an intermediate layer between Telegram and Dialogflow. Telegram might contact this intermediate layer, which processes the received message and uses the Dialogflow SDK/API for the Google NLP goodness. For the (not yet) supported Telegram messages this intermediate layer must implement its own logic.
Currently, there seems to be no way to handle non-telegram text messages via dialogflow, however there is an open report about it here if it may interest https://issuetracker.google.com/issues/157202508

Any ideas/ examples on how to use the detect-intent api on dialogflow to read the intent from a json file?

Any idea or examples as to how to detect intent using the Dialogflow detect-intent api(https://cloud.google.com/dialogflow/docs/reference/rest/v2/projects.agent.sessions/detectIntent) from a JSON file?
Thank you in advance.
The function is supposed to be hosted on Firebase functions and I am using nodejs.
I will try to explain what I am trying to do.
So I have a bunch of Intents on Dialogflow already. And I know that the starting intent is going to be the Welcome intent. After the Welcome Intent I want to shape the conversation according to the intent list on the json file.
The entire flow is something like this.
Bot: Hello, What form would you like to fill up today?
User: Leave form
Dialogflow matches the leave form with the leave form entity and pulls the leave form json from the storage. The json will contain the fields that are required to be filled up for the form
Bot: Hi, so I would need some details to fill this form.
Bot: Let's start with your name ..... etc etc
So, instead of detecting the intent from the user's side, I need to detect what intent, from the json. The Webhook fulfillment is currently being hosted on Firebase functions and the json is being stored on Firebase Storage(not Database)
The Detect Intent API only helps you to detect the intent from the text sent by you to the Dialogflow agent using the API. So you cannot read the intent from the JSON file using the Detect Intent API, your intent must be imported to the Dialogflow agent.

How to show a greeting message when BOT starts api.ai / dialogflow in App

I am creating a BOT in Dialogflow on Android.
I want to show a greeting message every time user launches the app.
How to achieve this ?
You just need to mention in the default welcome intent or add an event for that particular intent. If you're using Dialogflow with kommunicate then to show different welcome messages on different pages of your website. Please refer to this doc for info.
You can create a welcome event and when user first time opens the chatbot you have to send just event name in parameter there is no need for the query parameter.
There is provision to do so in api.ai. The event is a feature that allows you to invoke intents by an event name instead of a user query. You just need to define event names for intents. Then, you can trigger these intents by sending a /query request containing an event parameter. Please read the document here: https://dialogflow.com/docs/events

How to get dynamic response based on the result of the action performed in Api.ai?

I'm trying out few examples in Api.ai console. I see there are examples where the agent responds by using the values that are extracted from the user query or from the context. But is there a way to display response that is formed using the output of the action performed?
For example -
User: Is my pizza order confirmed?
Action: check order status
Response: Yes, it's confirmed (or "No, it's not")
You will have to use some custom webhook to do this, either integrating with a 3rd party API or will a server side call of your own to a database- in this case the webhook would take the user's ID and query if their pizza is ready or not, and this would then be passed back to API.ai.
Here is an example using a 3rd party webhook to do what you are asking:
https://github.com/api-ai/apiai-weather-webhook-sample
Yes you can do this with webhooks.
Typically, you would save the status of the order in your db, then you could have an intent that would:
Understand the query of your user (Is my pizza order confirmed)
The intent would call your webhook
the webhook would return the status order.
Api.ai would then give the answer.
When you use webhooks you need to return the speech response, the displayText, optionally the data that your apps need, the contextOut and the source.
I guess you would also need to have implement some context in api.ai so that you could now who is asking about the satus of the order. You would then be able to use the sessionId
Matt is correct here. You must use a webhook. Unfortunately the documentation from API.AI is currently very poor. Here's a screenshot example of an incoming post request. My message function will return an object with a desired response. In this case, I am using a Telegram chat bot. If you are not using any messenger, you can drop the data key: value. FollowupEvent is also optional.
Node.JS code with Restify
On your API.AI intent, make sure to check off Webhook. If you end getting the text response 'Broken' here, then something went wrong and you should check your error codes.
API.AI intent
And lastly, under the fulfillment tab, make sure to enable the webhook and point it at the right endpoint.

Resources