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?