Sending a message to user when user enters a geofence / area? - node.js

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.

Related

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

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.

Port existing custom chatbot as Google Assistant action

We have a framework that implements chatbot / voice assistant logic for handling complex conversations in the health domain. Everything is implemented on our server side. This gives us full control of how responses are generated.
The channel (such as Alexa or Facebook Messenger cloud) calls our webhook:
When user messages, the platform sends these to our webhook: hashed user id, message text (chat message or transcribed voice)
Our webhook responds with the appropriately structured response, which includes text to be displayed, spoken, possibly choice buttons and some images etc. It also includes a flag whether the current session has finished or user input is expected.
Integrating a new channel involves conversion of the response returned into the form expected by a channel and setting some flags (has voice, has display etc.).
This simple framework has worked so far for Facebook Messenger, Cortana, Alexa (a little bit of hacking was needed to abandon it's intent and slot recognition), our web chatbot.
We wanted to write a thin layer of support for Google Assistant action.
Is there any way of passing all the input from Assistant user intact into a webhook such as the one described above and taking full control of the way responses are generated and the end of conversation is determined?
I'd rather not delve into those cumbersome ways of API.AI of structuring a conversation which seems good for a trivial scenarios such as ordering an Uber but seems very bad for longer conversation.
Since you already have a Natural Language Understanding layer for your system, you don't need API.AI/Dialogflow, and you can skip this layer completely. (The NLU is useful, even for large and extensive conversations, but doesn't make sense in your case where you've already defined the conversation through other means.)
You'll need to use the Actions SDK (sometimes known as actions.json after the configuration file it uses) to define triggering phrases, but after that you'll get all the text that the user says as part of your conversation through a webhook that delivers JSON to you. You'll reply with JSON that contains the text/audio response, images on cards, possibly suggestion chips, etc.

How to use trigger event in facebook messenger bot

I'm developing Facebook messenger bot. Based on the official sample
here made by Node.js, Express, ES7.
I want to use Firebase database, trigger event.
If someone updates the database, send notice to certain people. I add source code "Child Changed" to "messages.js" in messenger-api-helpers, but it doesn't work.
I can check working "Child Changed" in HTML, but in messenger, I cannot.
Where should I write the trigger events code?
You should definitely use Facebook Messenger Broadcast API for this kind of functionality. This will broadcast a notice/broadcast to users.
Caveats:
You have to apply for this permission. (pages_messaging and pages_messaging_subscriptions.Takes about 1-2 days, but
can test on Admin/Test users of the app)
Each broadcast has to be a separate broadcast. (e.g. you can't send image and a text together, each has to be its own individual broadcast).
Have some kind of un-subscription option as well. FB user might think you are spamming even if you clearly say in the messages that your bot will send updates.
Use custom labels to create targetted sends. So you can either subdivide who you will send updates to about specific issues or just label people if they unsubscribe to your broadcast or not.
Basic workflow:
Get permission to broadcast.
On event in your Database. Start process.
Create message_creative_id via POST to endpoint
Use message_creative_id to POST a broadcast_messages
On a successful send you will get back broadcast_id

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

Facebook Messenger Chatbot messages tagging (of sorts)

I have a Facebook Messenger bot (written in NodeJS) and a separate control panel where a user can manage the information that the bot is working with (like inventory stock, etc.). One of those things is a log of all conversations between the bot and a visitor. The control panel allows the admin users to send messages to visitors through the bot. There is an input box where they can type in a message and when they click 'Send', the message goes to the bot app, which then sends it back to the user through Send API.
Messages are logged into a database; those going to the bot (from the visitor) are logged when they're received, and those the bot responds with are logged through the 'echo' callback.
The problem with this is that the bot can reply to certain visitor commands (phrases) and tries to perform certain actions based on the input. I'm using Wit.ai for this, but due to the scope of the possible phrases and keywords, the default mode when someone sends a text message is to send it to Wit.ai for processing. However, if an admin user sends the visitor a message from the control panel, the visitor could want to respond to that message (instead of sending a bot command) and that response should not go to the Wit.ai for processing. And due to the sheer scope of possible variations of what can be said, coupled with the fact that they can actually use some of the keywords in the response as well, processing the intent with Wit.ai in that case is too uncertain.
I was wondering if there's a way to somehow identify/mark the source of the messages that the bot sends to the visitor, so when an echo callback comes, I can know if it's, say, from a regular bot routine or from a user-entered reply. Like some additional meta tags that could be sent with the message that would also get returned with the echo, but that doesn't pollute the message itself. Is something like that possible? Or is there a different way I can achieve the same result.
I don't wether that helps you, but Facebook just recently integrated a quite mysterious Tag feature for bots.
https://developers.facebook.com/docs/messenger-platform/send-api-reference/tags

Resources