I just started learning dialogflow, and I am following the instruction here to make fulfillment on intent. However I can't make it work even though it seem to be correct, what am I doing wrong?
I create the buy-car intent with webhook enabled:
Fulfillment is enabled and the intent is already mapped:
function BuyCar(agent) {
agent.add(`Sure I can help you with that`);
agent.add(`Web hook response`);
agent.end("");
}
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('Buy-Car', BuyCar);
agent.handleRequest(intentMap);
No response thought:
In diagnostics, it gave this error for fulfillment:
What am I doing wrong?
The following error also appear in log, what does it mean?
The error is caused by testing multi line responses in the Web Demo provided by Dialogflow console. The Web Demo is limited to "single text responses" only. See Web Demo limitations for reference.
If the responses are multi line or have rich messages, a possible workaround is to execute testing in the "test console" located at the right side of the Dialogflow console or try using a different integration like the Dialogflow Messenger.
Related
I built a bot that is integrated to messenger and default bot on website using dialogflow now the bot have default response and messenger response but when I go to the fullfilment i cant set a specific response for each
here is my code
function time(agent) {
if (currentlyOpen()) {
agent.add(`Hi, We're open now! We close at 11pm today.`);
} else {
agent.add(`We're currently closed, but we open every day at 6am!`);
}
}
I want to have a diffrent response if I am using messenger as the default response goes to the default bot
"I know I can inrtegrate messenger in the website but I want to know this way as I use it for more bots"
You can do that using the same library that you are using for agent. To send specific platform response just add the platform to the response. For example, if you want send a text specifically to Google Assistant then you can do that using agent.add(new Text({ text: 'text_here', platform: 'ACTIONS_ON_GOOGLE'}));.
The full Dialogflow fulfillment code is available on GitHub. https://github.com/dialogflow/dialogflow-fulfillment-nodejs. I have also modified some code to set some other responses that are not available in this library such as telephony transfer and speech responses. So, if you want you can do that too.
I am trying to program DialogFlow application with integration to Google Assistant (Actions on Google). What I need is periodical execution of my script in a certain time over chosen Google Home device - I managed to do that through Routines.
Unfortunately the settings of Routines is not as easy as I expected (you need go through several click and typing of custom action name). Then I found that it is possible to ask the user for that in the Assistant (Routine suggestions) and let him set that with fewer necessary steps.
But my implementation is not working:
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
...
function scheduleRoutine(agent) {
const intent = agent.arguments.get('UPDATE_INTENT');
agent.add(new RegisterUpdate({
intent: intent,
frequency: 'ROUTINES'
}));
}
let intentMap = new Map();
...
intentMap.set('setup_update', scheduleRoutine)
agent.handleRequest(intentMap);
});
because I am using WebhookClient I am not able to call conv.arguments.get('UPDATE_INTENT') as in the example. But I can get to that part of code through fulfilment which leads to error:
TypeError: Cannot read property 'get' of undefined
at scheduleRoutine (/user_code/index.js:71:34)
Have anybody already implemented Routine suggestion with Dialogflow?
Are you trying to use RegisterUpdate from the actions-on-Google library? You cannot mix features from that library with the dialogflow-fulfillment library. They're incompatible.
If you want to use features specific to actions on Google, you must use that library for your webhook.
Is it possible to format a conversation so that the bot initiates conversation using dialogflow in a web demo integration?
The objective is to say something like “Hi, I’m a bot, I can do x” to establish that it’s a chatbot rather than a human.
Can anyone suggest any idea for this?
You can set a welcome intent, then send a /query request containing an event parameter. Set the event parameter to WELCOME and your chatbot will respond with whatever conversation opening you set.
More info here: https://dialogflow.com/docs/events
If you are using something other than the API for interacting with your Dialogflow agent (Slack, Facebook Messenger, etc.) you will need to add an appropriate event under "intents" in your console (such as the "Facebook Welcome" event).
For interacting with your Dialogflow agent via the API, see below.
In the API interaction quickstart documentation, Dialogflow gives you the SessionClient's detectIntent method for sharing messages with your bot.
Each language has a different solution. But on an abstract level, you want to change the request object that you send to Dialogflow to include a "Welcome" event (no input message required), as Omegastick described.
For example, in Node.js, your request object would look like this:
// The text query request.
const request = {
session: sessionPath,
queryInput: {
event: {
name: "Welcome",
languageCode: languageCode
}
},
};
This assumes you have an appropriate intent set up in your Dialogflow console to handle Welcome events. One is provided by default that you can observe.
You can also add contexts, so that your agent gives a different greeting message based on some condition.
Following this guide:
https://actions-on-google.github.io/actions-on-google-nodejs/
I created an action for DialogFlow
import { dialogflow, Image, Conversation, BasicCard } from 'actions-on-google';
const app = dialogflow();
app.intent('test', (conv, input) => {
conv.contexts.set('i_see_context_in_web_demo', 1);
conv.ask(`i see this only into actions on google simulator`);
conv.ask(new Image({
url: 'https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/imgs/160204193356-01-cat-500.jpg',
alt: 'cat',
}));
});
I then activated Web Demo integration
I saw that the Web Demo integration does not show the cards, the images. I hypothesize that it only shows text, no rich text
I understand that it elaborates only JSON like this:
{
"fulfillmentText": "Welcome!",
"outputContexts": []
}
But I did not find any method in the library used to enhance fulfillmentText
can you help me?
You're using the actions-on-google library, which is specifically designed to send messages that will be used by the Google Assistant. The Web Demo uses the generic messages that are available for Dialogflow. The actions-on-google library does not send these generic messages.
If you want to be able to create messages that are usable by both, you'll need to look into the dialogflow fulfillment library, which can create messages that are usable by the Google Assistant as well as other platforms. Be aware, however, that not all rich messages are available on all platforms, but that the basic text responses should be.
You also don't need to use a library - you can create the JSON response yourself.
I've built a bot using LUIS framework which works fine.
while working on it came through few points as mentioned below
After connecting with LUIS intent; bot is unable to check with regex intents
like
for ex dialog.matches('^helpdesk/i',function()) which i'm trying to setup
var dialog = new builder.IntentDialog({ recognizers: [recognizer] });
How to proactively send greetings message to user before inititates conversation like i would send prompt of choices to user which user can select. If nothing is fitting to that requirement i want LUIS to work and understand on that
How to know the logged in user context in Skype for Business channel
cards are not working in skype for business
For your code; I'm assuming your recognizer is your only IntentRecognizer and is the LUIS model you mention.
In this case, dialog.matches('^helpdesk/i',function()) is incorrect; your code to match against a regex should be dialog.matches(/^helpdesk/i, function())
Alternatively you could add a RegExpRecognizer to your IntentDialog:
var helpdesk = new builder.RegExpRecognizer('HelpDeskIntent', /^helpdesk/i);
var dialog = new builder.IntentDialog({ recognizers: [helpdesk, recognizer] });
As Bob said you're looking for conversationUpdate, here's an example on it sending a message when a user joins
To clarify, is this a question on having your bot know when a user is logged in? Or are you asking about session.userData?
Skype for Business does not currently support cards.
You can catch when the user is added to conversation. Check conversation.update.
Each activity has its own properties. One of them is serviceUrl.
For the third question, please provide your code.