API.AI A bot that starts the conversation - bots

I am just now creating my first bot for my own use, and I want
to gather user information and search through my database for it.
I figured the best way for this is just to ask the question before the user
starts the conversation. Does anyone know how I can accomplish this (getting the bot to send a message first)?

Trigger an event as soon as user comes to the chat bot platform - see https://api.ai/docs/events. Nearly all platforms triggers an event for users first time. Check the facebook bot docs.

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.

Related

How to encounter reply when user attaches a document/image to a chatbot(Build with dialogflow and kommunicate)?

I have tried many different methods but it is not working properly.Please any one can help me how to send a reply when user uploads any attachments in a chatbot.
To be able to achieve your objective, it is important to understand what dialogflow events are: Events allow you to invoke intents based on something that has happened instead of what a user communicates. Dialogflow supports events from several platforms (like Google Assistant, Slack, and more) based on actions users take on those platforms.
When a user attaches a file or shares location, Kommunicate sends a custom event KOMMUNICATE_MEDIA_EVENT to your bot along with the attached file information. To have an upload intent respond to the KOMMUNICATE_MEDIA_EVENT, follow these steps to create this custom event in your dialogflow bot:
How to add an event to an intent
Go to the Events section of the intent.
Type the name of the event you'd like your intent to respond to (KOMMUNICATE_MEDIA_EVENT).
Press enter.
Click SAVE.
Also remember to add your response that the bot will deliver to a user when they upload a document.
References:
https://cloud.google.com/dialogflow/docs/events-overview
https://docs.kommunicate.io/docs/bot-custom-integration#send-attachments-to-bot
https://cloud.google.com/dialogflow/docs/quick/build-agent
I hope this helps?

Manage Timeout with actionon Google and DialogFlow

I'm tryng to create a Chat Bot using DialogFlow with webHooks and Actions on Google.
I need to manage a timeout i.e when the end user did not use the Chat Bot for a configured amount of time, i need to exit from conversation without user interaction, same result as described here but without any input.
conversation-exits
I cannot find info about this automatic triggered action any hint?
Is this possible?
The conversation-exits you are referring is for exiting the Conversation when the user says Cancel, Exit, Stop etc.
To handle No User Interaction, you could do the following:
Create a new Intent and set event = "actions_intent_NO_INPUT"
In the webhook, if this intent is triggered, set the rePrompt count flag and ask for user input.
If the count reaches 2-3 (as desired), end the conversation by using conv.close()
Check out the following page on RePrompts and No Inputs and Best Practices.

Can I show the quick replies everytime the user opens his messenger chat?

I want to show the quick replies in messenger bot every time they open the conversation. Is it possible?
I think you can invoke an event to get your task done. event are used to invoke intents by an event name instead of a user query. you can define the event name in the intent and call to trigger that event from your back-end implementation. please check this for more information.
https://dialogflow.com/docs/events
also if you are creating a custom UI(won't work in your case) for the chat basically you can hard code whatever the reply you want as the first message. then it will appear always when the user open the conversation.

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

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