0

In DialogFlow, in the Google Assistant integration settings, I've added an "Implicit Invocation" to one of the intents in the DialogFlow agent.

That Intent is sent for fulfillment to my Node.js code. In that code, how can I know if it was called via the "implicit invocation" or while the user is interacting with the agent?

I need to respond in a slightly different way and immediately end the conversation. So, I need to know if it was from a deep link. I can't simply make a different Intent because the training phrases would all be the same.

Glen Little
  • 6,951
  • 4
  • 46
  • 68

1 Answers1

1

The only way I've found is to check the type property of the conversation object.

If it is 'NEW' then this is the first contact and if we are not in the welcome Intent, then it is likely deep linked.

For example, to only give a response and close the conversation:

const { dialogflow } = require('actions-on-google');
const app = dialogflow();

---

app.intent('say hello', (conv) => {
  conv.ask('Hello!');

  var isDeepLinked = conv.type === 'NEW';

  if(isDeepLinked){
    conv.ask('and Goodbye.');
    conv.close();
  }
});

If anyone can point to the documentation for this, please do!

Glen Little
  • 6,951
  • 4
  • 46
  • 68
  • 2
    This is one way to do it. The other way is to flip a boolean in Default Welcome Intent and then see if that boolean is flipped in your next intent. – Nick Felker Sep 23 '19 at 14:50