Closed iMoses closed 5 years ago
Agreed, would be very useful..
I've created a workaround on my private repository.
A middleware that fills the fulfillmentText
with the textToSpeech
of the first simpleResponse
it finds.
app.use(conv => {
const { handler } = conv;
conv.handler = async function() {
const res = await handler.apply(this, arguments);
const { simpleResponse } = res.body.payload.google.richResponse.items.find(item => item.simpleResponse) || {};
if (simpleResponse) res.body.fulfillmentText = simpleResponse.textToSpeech;
return res;
};
});
Do you think this is a stable enough approach?
Would you like me to create a pull request for a solution such as this?
I currently have no idea where this middleware would fit with Botium - so I suggest you create a pull request and we work on it
Good support for DialogFlow and Google Assistant is the first thing I look for, after Facebook Messenger.
I'm a bit confused now to see some things working partially with DialogFlow but not seeing it mentioned on the website anywhere.
Any update as to whether this has been implemented yet, or any functional workarounds? Appreciate it
has not yet been implemented. it is in the backlog and will be implemented for sure, as lots of users asking for it.
thanks codeforequity-at, appreciate your feedback. any idea of how to implement a quick work-around for it for the time being? as we're looking to build our test suit this week on dialoguflow / google assistant
Encounter this as well. Agreed this would be very useful. There are responses from the fulfillment but botium is not displaying anything. The rest is pretty easy to setup and use.
With the latest build of the Botium Dialogflow connector it is possible to filter the fulfillmentMessages for the platform you are targeting.
@codeforequity-at How do I filter the fulfillmentMessages for Dialogflow/AoG, I'm using the emulator and it is currently returning the name of the Intent:
Is the capability "DIALOGFLOW_USE_INTENT" set ? in this case, Botium always outputs the detected intent instead of the fulfillment text.
@codeforequity-at Yes, "DIALOGFLOW_USE_INTENT" is set to true in the root folder in botium.json. I tried setting the aforesaid property to false and/or removing it, but doing so results in no output. What am I missing? Appreciate your feedback
Please enable debug mode and post output and your botium.json file content here (pls remove secret keys etc first).
@codeforequity-at Sure thing! Requested data:
Debug mode output:
botium-connector-dialogflow "query": { botium-connector-dialogflow "structValue": { botium-connector-dialogflow "fields": { botium-connector-dialogflow "keyword": { botium-connector-dialogflow "stringValue": "Banana", botium-connector-dialogflow "kind": "stringValue" botium-connector-dialogflow } botium-connector-dialogflow } botium-connector-dialogflow }, botium-connector-dialogflow "kind": "structValue" botium-connector-dialogflow }, botium-connector-dialogflow "any": { botium-connector-dialogflow "stringValue": "", botium-connector-dialogflow "kind": "stringValue" botium-connector-dialogflow }, botium-connector-dialogflow "command": { botium-connector-dialogflow "stringValue": "Add", botium-connector-dialogflow "kind": "stringValue" botium-connector-dialogflow } botium-connector-dialogflow } botium-connector-dialogflow }, botium-connector-dialogflow "allRequiredParamsPresent": true, botium-connector-dialogflow "fulfillmentText": "", botium-connector-dialogflow "webhookSource": "", botium-connector-dialogflow "webhookPayload": null, botium-connector-dialogflow "intent": { botium-connector-dialogflow "inputContextNames": [], botium-connector-dialogflow "events": [], botium-connector-dialogflow "trainingPhrases": [], botium-connector-dialogflow "outputContexts": [], botium-connector-dialogflow "parameters": [], botium-connector-dialogflow "messages": [], botium-connector-dialogflow "defaultResponsePlatforms": [], botium-connector-dialogflow "followupIntentInfo": [], botium-connector-dialogflow "name": "*REDACTED**", botium-connector-dialogflow "displayName": "ProductSearch", botium-connector-dialogflow "priority": 0, botium-connector-dialogflow "isFallback": false, botium-connector-dialogflow "webhookState": "WEBHOOK_STATE_UNSPECIFIED", botium-connector-dialogflow "action": "", botium-connector-dialogflow "resetContexts": false, botium-connector-dialogflow "rootFollowupIntentName": "", botium-connector-dialogflow "parentFollowupIntentName": "", botium-connector-dialogflow "mlDisabled": false botium-connector-dialogflow }, botium-connector-dialogflow "intentDetectionConfidence": 1, botium-connector-dialogflow "diagnosticInfo": { botium-connector-dialogflow "fields": { botium-connector-dialogflow "webhook_latency_ms": { botium-connector-dialogflow "numberValue": 91, botium-connector-dialogflow "kind": "numberValue" botium-connector-dialogflow } botium-connector-dialogflow } botium-connector-dialogflow }, botium-connector-dialogflow "languageCode": "en-us" botium-connector-dialogflow }, botium-connector-dialogflow "webhookStatus": { botium-connector-dialogflow "details": [], botium-connector-dialogflow "code": 5, botium-connector-dialogflow "message": "Webhook call failed. Error: 404 Not Found" botium-connector-dialogflow } botium-connector-dialogflow } +499ms
botium.json:
{ "botium": { "Capabilities": { "PROJECTNAME": "REDACTED", "CONTAINERMODE": "dialogflow", "DIALOGFLOW_PROJECT_ID": "REDACTED", "DIALOGFLOW_CLIENT_EMAIL": "REDACTED", "DIALOGFLOW_PRIVATE_KEY": "-----BEGIN PRIVATE KEY-----REDACTED\n-----END PRIVATE KEY-----\n" } } }
In this case you should find out what this webhook error 404 means
mahmeds7777 notifications@github.com schrieb am Di., 30. Okt. 2018, 19:12:
@codeforequity-at https://github.com/codeforequity-at Sure thing! Requested data:
Debug mode output:
botium-connector-dialogflow "query": { botium-connector-dialogflow "structValue": { botium-connector-dialogflow "fields": { botium-connector-dialogflow "keyword": { botium-connector-dialogflow "stringValue": "Banana", botium-connector-dialogflow "kind": "stringValue" botium-connector-dialogflow } botium-connector-dialogflow } botium-connector-dialogflow }, botium-connector-dialogflow "kind": "structValue" botium-connector-dialogflow }, botium-connector-dialogflow "any": { botium-connector-dialogflow "stringValue": "", botium-connector-dialogflow "kind": "stringValue" botium-connector-dialogflow }, botium-connector-dialogflow "command": { botium-connector-dialogflow "stringValue": "Add", botium-connector-dialogflow "kind": "stringValue" botium-connector-dialogflow } botium-connector-dialogflow } botium-connector-dialogflow }, botium-connector-dialogflow "allRequiredParamsPresent": true, botium-connector-dialogflow "fulfillmentText": "", botium-connector-dialogflow "webhookSource": "", botium-connector-dialogflow "webhookPayload": null, botium-connector-dialogflow "intent": { botium-connector-dialogflow "inputContextNames": [], botium-connector-dialogflow "events": [], botium-connector-dialogflow "trainingPhrases": [], botium-connector-dialogflow "outputContexts": [], botium-connector-dialogflow "parameters": [], botium-connector-dialogflow "messages": [], botium-connector-dialogflow "defaultResponsePlatforms": [], botium-connector-dialogflow "followupIntentInfo": [], botium-connector-dialogflow "name": "*REDACTED**", botium-connector-dialogflow "displayName": "ProductSearch", botium-connector-dialogflow "priority": 0, botium-connector-dialogflow "isFallback": false, botium-connector-dialogflow "webhookState": "WEBHOOK_STATE_UNSPECIFIED", botium-connector-dialogflow "action": "", botium-connector-dialogflow "resetContexts": false, botium-connector-dialogflow "rootFollowupIntentName": "", botium-connector-dialogflow "parentFollowupIntentName": "", botium-connector-dialogflow "mlDisabled": false botium-connector-dialogflow }, botium-connector-dialogflow "intentDetectionConfidence": 1, botium-connector-dialogflow "diagnosticInfo": { botium-connector-dialogflow "fields": { botium-connector-dialogflow "webhook_latency_ms": { botium-connector-dialogflow "numberValue": 91, botium-connector-dialogflow "kind": "numberValue" botium-connector-dialogflow } botium-connector-dialogflow } botium-connector-dialogflow }, botium-connector-dialogflow "languageCode": "en-us" botium-connector-dialogflow }, botium-connector-dialogflow "webhookStatus": { botium-connector-dialogflow "details": [], botium-connector-dialogflow "code": 5, botium-connector-dialogflow "message": "Webhook call failed. Error: 404 Not Found" botium-connector-dialogflow } botium-connector-dialogflow } +499ms
botium.json:
{ "botium": { "Capabilities": { "PROJECTNAME": "REDACTED", "CONTAINERMODE": "dialogflow", "DIALOGFLOW_PROJECT_ID": "REDACTED", "DIALOGFLOW_CLIENT_EMAIL": "REDACTED", "DIALOGFLOW_PRIVATE_KEY": "-----BEGIN PRIVATE KEY-----REDACTED\n-----END PRIVATE KEY-----\n" } } }
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/codeforequity-at/botium-core/issues/78#issuecomment-434408500, or mute the thread https://github.com/notifications/unsubscribe-auth/AZEdT7bbro4Lx3tmNN__ZvaIi8GXhQMQks5uqJaBgaJpZM4VBAb7 .
@codeforequity-at Thank you. Was an issue with the fulfillment URL, the emulator is functioning as expected now. Any chance we can also test GUI elements like rich text responses via Dialogflow or AoG?
Yes, there is a chance to test GUI elements. With the latest builds Botium supports validation of Buttons, Pictures and Card attachments for most connectors (Dialogflow connector is among them). Currently I cannot provide documentation or tutorials for it, the pattern is similar to this convo file:
#bot
Hallo und willkommen
BUTTONS Button 1 | One more button
MEDIA myimage.png
So in addition to validating the text response from the bot, you can also check if the bot shows a button or a picture.
Thank you @codeforequity-at I finally had a chance to give the workflow a test run, but ended up getting the following response from Botium: hello BOT SAYS (default): Cannot display response in Dialogflow simulator. Please test on the Google Assistant simulator instead.
What is this message, and do we display the proper response? Appreciate it.
Hi, please, enable debug mode and post the output, thanks.
Hi @codeforequity-at Thank you for your patience, attached is the debug output:
botium-connector-dialogflow UserSays called +4s botium-connector-dialogflow dialogflow request: { botium-connector-dialogflow "session": “REDACTED”, botium-connector-dialogflow "queryInput": { botium-connector-dialogflow "text": { botium-connector-dialogflow "text": "hello", botium-connector-dialogflow "languageCode": "en-US" botium-connector-dialogflow } botium-connector-dialogflow }, botium-connector-dialogflow "queryParams": null botium-connector-dialogflow } +1ms botium-connector-dialogflow "kind": "listValue" botium-connector-dialogflow }, botium-connector-dialogflow "@type": { botium-connector-dialogflow "stringValue": "type.googleapis.com/google.actions.v2.PermissionValueSpec", botium-connector-dialogflow "kind": "stringValue" botium-connector-dialogflow } botium-connector-dialogflow } botium-connector-dialogflow }, botium-connector-dialogflow "kind": "structValue" botium-connector-dialogflow } botium-connector-dialogflow } botium-connector-dialogflow }, botium-connector-dialogflow "kind": "structValue" botium-connector-dialogflow }, botium-connector-dialogflow "userStorage": { botium-connector-dialogflow "stringValue": "{\"data\":{\"id\":\"OGU3OTY5NWItZTEyZC00NGU2LTllMjgtZWU1NTM4NWY5ZDNm\"}}", botium-connector-dialogflow "kind": "stringValue" botium-connector-dialogflow } botium-connector-dialogflow } botium-connector-dialogflow }, botium-connector-dialogflow "kind": "structValue" botium-connector-dialogflow } botium-connector-dialogflow } botium-connector-dialogflow }, botium-connector-dialogflow "intent": { botium-connector-dialogflow "inputContextNames": [], botium-connector-dialogflow "events": [], botium-connector-dialogflow "trainingPhrases": [], botium-connector-dialogflow "outputContexts": [], botium-connector-dialogflow "parameters": [], botium-connector-dialogflow "messages": [], botium-connector-dialogflow "defaultResponsePlatforms": [], botium-connector-dialogflow "followupIntentInfo": [], botium-connector-dialogflow "name": "REDACTED", botium-connector-dialogflow "displayName": "Welcome", botium-connector-dialogflow "priority": 0, botium-connector-dialogflow "isFallback": false, botium-connector-dialogflow "webhookState": "WEBHOOK_STATE_UNSPECIFIED", botium-connector-dialogflow "action": "", botium-connector-dialogflow "resetContexts": false, botium-connector-dialogflow "rootFollowupIntentName": "", botium-connector-dialogflow "parentFollowupIntentName": "", botium-connector-dialogflow "mlDisabled": false botium-connector-dialogflow }, botium-connector-dialogflow "intentDetectionConfidence": 1, botium-connector-dialogflow "diagnosticInfo": { botium-connector-dialogflow "fields": { botium-connector-dialogflow "webhook_latency_ms": { botium-connector-dialogflow "numberValue": 1367, botium-connector-dialogflow "kind": "numberValue" botium-connector-dialogflow } botium-connector-dialogflow } botium-connector-dialogflow }, botium-connector-dialogflow "languageCode": "en-us" botium-connector-dialogflow }, botium-connector-dialogflow "webhookStatus": { botium-connector-dialogflow "details": [], botium-connector-dialogflow "code": 0, botium-connector-dialogflow "message": "Webhook execution successful" botium-connector-dialogflow } botium-connector-dialogflow } +3s BOT SAYS (default): Cannot display response in Dialogflow simulator. Please test on the Google Assistant simulator instead.
Not possible with dialogflow connector. Working on Google Assistant connector.
I'm using the emulator on verbose mode and although botium gets a responses it doesn't say anything.
I assume the reason is that I'm using the
actions-on-google
package on a fulfillment webhook that returns a payload meant for Google assistant.I suggest adding support to cases in which the dialogflow conversation data appears as part of the payload in a
actions-on-google
format.Example response: