How do i make my Chatbot Message have some seconds of delay response in dialog flow? - dialogflow-es

I'm creating a chatbot for a Facebook page to solve people's questions and I wanted to make the bot messages 1 or 2 seconds of delay between each of the bot's replies. Could someone tell me how to do it in dialog flow? I couldn't find any answer around my research so hopefully someone could help me.

This isn't possible if you're using Dialogflow's built-in rich messages. It also wouldn't be possible using only webhook fulfillment and the Dialogflow Facebook integration, as you can only deliver a full set of messages as a reply at one time, and can't specify how they are delivered.
The only way to achieve that level of control would be to build the bot yourself (perhaps using an existing Messenger bot framework), and make calls from that code to Dialogflow to handle natural language understanding.

Related

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

Sending a message to user when user enters a geofence / area?

I'm making a dialogflow agent that will be integrated with various platforms (Facebook messenger, slack and maybe a few others) that will have the basic functions of a informational chatbot.
The agent will be for a specific store and I'm wondering if it's possible to trigger some sort of welcome message once the user enters the geofence (in this case, the store)?
Thanks for the help. I haven't found any documentation for this on dialogflow specifically or anywhere else so anything will be awesome.
Note: I'm am not by any means dead set of dialogflow, if AWS Lex offers something like this and it's better, I will take a look. I'm just a bit more used to dialogflow.
This cannot be achieved just by using either Lex or Dialogflow. Because at the end of the day, you are using them to integrate with Messenger/Slack/Whatsapp and these apps will (for obvious good reasons) not share the user's location information with the bot. You will need a helper app which takes the user's location permission as well and triggers the bots for you.
Keep in mind that channels like Messenger and Whatsapp have restrictions over sending messages willy-nilly to users. Messenger has a '24+1' policy Whatsapp also you can only send free form messages in the 24 hour window. But after that you can send chargeable pre-approved "hsm" message templates.

Chat messages from Dialogflow don't appear in Slack

I'm creating a bot with Dialogflow. It's quite straigtforward, and it worked on Telegram in no time. But things complicated when trying to integrate Dialogflow with Slack.
My bot is able to read direct messages from Slack, and I'm sure of it because the messages from Slack appear in the History section of Dialogflow. Good news there. In the same screen, I can see that Dialogflow answered all the messages Slack sent to it. But sadly, those answers don't appear in Slack.
By the way, just to confuse me more, the Dialogflow's test bot works flawlessly with Slack, publishing there with no issue. So, it's not anything related with the common values you have to copy from Slack and paste to Dialogflow to enable the integration.
It seems that my bot on Slack misses some kind of permission of the OAuth & Permissions screen, but I've tried some of theme, and I can't find the good one. Right now I'm using bot, chat:write:bot, im:write, and channels:read. I guess that only the two first ones are needed, but I'm totally lost and tried adding permissions with no reason. And then, I wrote this post.
Is there someone who has a simple bot that sends messages in direct messages on Slack? What are the needed permissions?
I had the same issue, it's quite easy to solve: just go on Manage Distribution in your bot's Slack API panel and click on the "Add to Slack" button.
That's all!
Under OAuth & Permissions, add "chat:write" to OAuth Scope. That will allow your bot to send messages to other users.

How to end bot conversation and let real person handle responses in Dialog Flow?

I am developing a bot for business using Dialogflow. I want to keep an option "Talk to real person". When my customer wants to talk to real person, bot should stop and someone from my support staff will take care of that user.
How is it possible?
How can I pause/stop my bot and let real person handle conversation?
While searching for answer, I send an email to Dialogflow support and got this reply next day.
At this moment, you'll need to handle the task of passing conversations from bot to humans in your custom implementation. You can take a look at the following sample: https://github.com/dialogflow/agent-human-handoff-nodejs.
Hope this may help someone else having similar issue.
By native google, Dialogflow doesn't support bot to human handoff or provide any Web interface to achieve this, but in dialogflow normally the action “input.unknown” used to hand off the conversation to a Human. The “input.unknown” action is built into Dialogflow and used with the default fallback intent. When none of the intents is matched, the default fallback intent is triggered and action associated with it is added in the response also you need to write a logic what bot should do after that.
But to make things easier you can integrate dialogflow with any third-party tool like Kommunicate. As they provide pre-built chat widget user interface and bot to human handoff can be enabled on a click of a button, Please click here for more detailed information
PS: I work for Kommunicate
The issue is related more to the external software that implements Dialogflow than Dialogflow itself.
You can use the PHP code of Support Board as a starting point, or you can use the Support Board software for that directly. It has the feature that asks the user if he/she wants to contact a human agent when the bot does not understand the question. If the user accepts the bot is automatically disabled and an email is sent to the agents.
More details at https://board.support/
PS: I work for Support Board

How to detect bot message/user message?

My FB-NodeJS-API prototype is not working correctly because my webhook is receiving the bot respond which is then sent to API.AI.
I need to set a condition where only a user's message should be received on the webhook request or only user's message should be sent to API.AI.
Can anyone advise me on this?
Can you explain the problem better? Please add the relevant code.
The bot response should go the user, not the webhook. The user input will come to the webhook.
I would suggest getting the bot to work without API.AI first and then adding support. My bot is in node.js so you may just want to jump to the source code.
For more information on setting up a bot see my article Facebook Bots for Fun and Profit
The example bot is DMS Software Bot
The source code is Github fb-robot

Resources