1

If the user has already given me his name in entirely different intent, I store it in my DB. However I need to request it again in another intent where webhook slot filling is enabled and given_name is a required value.

But if he has already given it to me, then there is no need to ask, so I want to grab the stored name in DB and fill the parameter (given_name) with this value, so I don't need to ask

How can I do this? Can I directly alter parameter values with my webhook?

Zurupupz
  • 335
  • 2
  • 12
  • 1
    @Jordi you are right. Just had to set given-name parameter as non required. So if gven-name is not in DB I will ask for it with webhook and not with Dialogflow prompts – Zurupupz Sep 03 '20 at 22:40
  • 1
    Ill put it down as an answer then – Jordi Sep 03 '20 at 23:41

1 Answers1

1

Wouldn't it be possible to call you DB instead of using the parameter values? If your database returns a name, you know that your user has mentioned a name in a previous intent before. From there you can just use the response from your database. If your database doesn't send back a name, then you would know when to ask your user about their name.

A simple example of this would be:

async function handleUsername(agent) {

  // Check if the user has mentioned a name before in your DB.
  const username = await callDatabase();

  if (!userName) {
    // Ask the user for their name.
  }

  // Continue the conversation.

}

Note: Since you mentioned that you are checking if the user had mentioned their name in multiple intents, it would nice to re-use the handleUsername() function across your webhook, if possible.

Jordi
  • 3,041
  • 5
  • 17
  • 36