Fulfillment

What do we do when the decisions we need to make don't follow the yes/no

We know our users search term but how do we map it to our follow up intents?

To do so we need to enable the fulfilment.

We are going to use the DialogFlow's Inline Editor which is using Cloud Functions for Firebase.

From the menu on the right, go to Fulfillment and then enable the inline editor.

Scroll down at the very bottom and you will see at the autogenerated code that there is an intentMap which will map our intents to the functions we add at this editor. Add the line below at that intentMap. Make sure that the intent name is exactly the same here with what it shows up at the intent list.

 intentMap.set("Default Welcome Intent - search", getSearchTerm);

Now time to create our getSearchTerm function. For the first choice we are going to use for the user's name, for the second the location and for the third for the skill.

function getSearchTerm(agent) {
      if (agent.parameters.search_terms == 1) {
        agent.add(`What's the name?`);
      } else if (agent.parameters.search_terms == 2) {
        agent.add(`For which location are you interested?`);
      } else {
        agent.add(`Which skill are you looking for?`);
      }
    }

In order to inform the agent that it should call the webhook for this intent, we need to go at our search intent, scroll at the very bottom and 'enable webhook for this intent'.

Now give your agent another try.

Success!

We got our text response back!

Last updated