0

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?

United121
  • 729
  • 1
  • 10
  • 24

1 Answers1

0

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.

Nick Felker
  • 11,536
  • 1
  • 21
  • 35
  • So do you mean to use ''const app = actionssdk()'' instead of classic webhook, right? Btw it wouldn't be necessary to do according to "Automatic discovery flow" in a link above but it is not working for me... Have experience with that? – United121 Feb 17 '19 at 08:19
  • const app = dialogflow () – Nick Felker Feb 17 '19 at 18:15