1

After trying and trying countless times, I ask for your help to call a Dialogflow event (GoogleHome) with a specific GoogleHome device.

Through nodeJS I managed to successfully call a Dialogflow event and I get the fullfillment response. All perfect, only I have to let my GoogleHome device speak with fullfillment, I do not need a text-only answer.

My goal is to let my GoogleHome device speak first, without the word "Ok, Google" and wait for a response from the user.

I did not find anything on the web, my attempts stop to invoke the Dialogflow event and have a console response.

This is the code i have tried for fullfillment

test: async function () {
    console.log("[funcGHTalk|test] CALLED");


    const projectId = "[[projectid]]";
    const LANGUAGE_CODE = 'it-IT';
    let eventName = "[[eventname]]";
    const sessionId = uuid.v4();

    const sessionClient = new dialogflow.SessionsClient();
    const sessionPath = sessionClient.sessionPath(projectId, sessionId);

    // The text query request.
    const request = {
        session: sessionPath,
        queryInput: {
            event: {
                name: eventName,
                languageCode: LANGUAGE_CODE
            },
        },
    };

    // Send request and log result
    const responses = await sessionClient.detectIntent(request);
    console.log('Detected intent');

    const result = responses[0].queryResult;        
    console.log(result);

    console.log(`  Query: ${result.queryText}`);
    console.log(`  Response: ${result.fulfillmentText}`);
    if (result.intent) {
        console.log(`  Intent: ${result.intent.displayName}`);
    } else {
        console.log(`  No intent matched.`);
    }
}
Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • Could you share code for what you've tried or documentation that you think might work? This type of question can seem a little too open and hard to answer as it would entail writing an entire solution to the problem. Is there any specific piece you are struggling with? – Scotty Waggoner Jan 24 '19 at 08:27

1 Answers1

0

The code you have written is using the Dialogflow Detect Intent API. This is meant to run on consoles and servers to send a message to Dialogflow, which will parse it, determine which Intent it matches, call fulfillment with that information, and return all the results.

You don't need to run this on a Google Home, since the Google Assistant does all this for you.

What I think you're looking for is to develop fulfillment with Actions on Google and the Dialogflow Fulfillment API. This handles things on the other end - after Dialogflow determines what Intent matches what the user has said, and if that Intent has fulfillment enabled, it will send the information to your webhook which is running on a cloud server somewhere. You would then process it, send a reply (either using the actions-on-google library or the dialogflow-fulfillment library is easiest), and it would send it back to the Assistant.

You indicated that you want the Action to "let my GoogleHome device speak first, without the word "Ok, Google" and wait for a response from the user". This is much more complicated, and not really possible to do with the Google Home device right now. Most Actions have the user initiating the conversation with "Ok Google, talk to my test app" or whatever the name of the Action is.

You don't indicate how you expect to trigger the Home to begin talking, but you may wish to look into notifications to see if those fit your model, however notifications don't work with the Home right now, just the Assistant on mobile devices.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • Thank you for your reply, very clear. I understand that it is very complicated to let GoogleHome speak first and request an answer. For example, as we said, to unleash an event that says "Hello, welcome back! How are you?" and wait for a reply that is then processed by Dialogflow. Can you tell me, please, what should I do to choose this solution? Even without detailed explanation, only suggestions. Thank you! – Stimpfl Daniel Jan 29 '19 at 08:07