actions-on-googlegoogle-assistantactions-builder

Google action builder/Google assitant How to use proper noun as type


i would like to have a type that represent proper nom, such as family name for exemple but i can't find anything on this. My goal is to send a info to an other personne using google assistant and my backend.

For exemple the user can say "Send this info to john smith" the info is stored in my backend so i have no problem finding and i got the id of the personne who is talking to the google assistant so this is no problem either.

The problem is how can i get john smith as a parameter that i send to my webhook? So my backend can verify the user list in my database and send the info if the user existe. I tried to use Type but a family doesn't match any pattern because it's can be anything...

If anyone know how to use google action builder with proper noun i would be grateful to know how i can manage to do it.


Solution

  • You have generally two options.

    Free form text approach

    enter image description here First you can create a "Free form text" type which can catch pretty much anything being said.

    enter image description here Then a custom intent can be trained with a few examples to pull out the correct proper noun (or anything else). Your webhook will be able to match at that point.

    Type Overrides approach

    enter image description here Alternatively, you can create a new type that starts with a preset of sample names that you use in your custom intent. Then, when the action starts, you can get the user's personal contact list in the webhook and set session type overrides.

    Here's an example of the code I got from a music player action:

    conv.session.typeOverrides = [{
        name: 'genre',
        mode: Mode.TypeReplace,
        synonym: {
          entries: Array.from(trackGenres).map(genre => ({
            name: genre,
            synonyms: [genre]
          }))
        }
      }]
    

    Depending on your system architecture, one of these may make more sense than the other. The first is better at capturing everything, but may require more post-processing on your webhook. The latter is better at precision, but may mean names may not match if they don't match entirely.